Merge lp:~canonical-platform-qa/snappy-ecosystem-tests/test-release-snap into lp:snappy-ecosystem-tests

Proposed by Heber Parrucci
Status: Merged
Approved by: Omer Akram
Approved revision: 54
Merged at revision: 56
Proposed branch: lp:~canonical-platform-qa/snappy-ecosystem-tests/test-release-snap
Merge into: lp:snappy-ecosystem-tests
Prerequisite: lp:~canonical-platform-qa/snappy-ecosystem-tests/test-release-snap-multiple-channels
Diff against target: 92 lines (+70/-0)
2 files modified
snappy_ecosystem_tests/helpers/snapcraft/client.py (+9/-0)
snappy_ecosystem_tests/tests/test_release_snap.py (+61/-0)
To merge this branch: bzr merge lp:~canonical-platform-qa/snappy-ecosystem-tests/test-release-snap
Reviewer Review Type Date Requested Status
Omer Akram (community) Approve
platform-qa-bot continuous-integration Approve
Review via email: mp+321582@code.launchpad.net

Commit message

Adding new test:
release a snap using --release command with snapcraft

Description of the change

Adding new test:
release a snap using --release command with snapcraft

@run_tests: snappy_ecosystem_tests/tests/test_release_snap.py

To post a comment you must log in.
Revision history for this message
platform-qa-bot (platform-qa-bot) wrote :
review: Needs Fixing (continuous-integration)
53. By Heber Parrucci

Fixing pylint issues

Revision history for this message
platform-qa-bot (platform-qa-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Omer Akram (om26er) wrote :

Code looks good, test is passing. Need to look at the pre-req.

review: Approve
54. By Heber Parrucci

merge from parent branch

Revision history for this message
platform-qa-bot (platform-qa-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Omer Akram (om26er) wrote :

Ok, lets land this.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'snappy_ecosystem_tests/helpers/snapcraft/client.py'
--- snappy_ecosystem_tests/helpers/snapcraft/client.py 2017-04-04 20:18:31 +0000
+++ snappy_ecosystem_tests/helpers/snapcraft/client.py 2017-04-04 20:18:31 +0000
@@ -58,6 +58,7 @@
58COMMAND_REGISTER = 'register'58COMMAND_REGISTER = 'register'
59COMMAND_LIST_REGISTERED = 'list-registered'59COMMAND_LIST_REGISTERED = 'list-registered'
60COMMAND_PUSH = 'push'60COMMAND_PUSH = 'push'
61COMMAND_RELEASE = 'release'
61LOGGER = logging.getLogger(__name__)62LOGGER = logging.getLogger(__name__)
6263
63HOSTNAME, USERNAME, PORT = get_snapcraft_remote_host_credentials()64HOSTNAME, USERNAME, PORT = get_snapcraft_remote_host_credentials()
@@ -324,6 +325,14 @@
324 '--release', ','.join(channels))325 '--release', ','.join(channels))
325 self._run_snapcraft_command_ssh(command)326 self._run_snapcraft_command_ssh(command)
326327
328 def release(self, snap_name, revision, channel):
329 """Release a snap revision to a particular channel"""
330 return self._run_snapcraft_command_ssh('{} {} {} {}'.format(
331 COMMAND_RELEASE,
332 snap_name,
333 revision,
334 channel))
335
327 def make_dummy_snap_file(self, name, version, arch=None):336 def make_dummy_snap_file(self, name, version, arch=None):
328 """337 """
329 Create an empty snap file338 Create an empty snap file
330339
=== added file 'snappy_ecosystem_tests/tests/test_release_snap.py'
--- snappy_ecosystem_tests/tests/test_release_snap.py 1970-01-01 00:00:00 +0000
+++ snappy_ecosystem_tests/tests/test_release_snap.py 2017-04-04 20:18:31 +0000
@@ -0,0 +1,61 @@
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2
3#
4# Snappy Ecosystem Tests
5# Copyright (C) 2017 Canonical
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation, either version 3 of the License, or
10# (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20
21"""Tests for releasing snaps to the store."""
22from snappy_ecosystem_tests.helpers.snapcraft.client import Snapcraft
23from snappy_ecosystem_tests.helpers.store_apis.rest_apis import Store
24from snappy_ecosystem_tests.helpers.test_base import SnappyEcosystemTestCase
25from snappy_ecosystem_tests.tests.commons import get_random_snap_name
26from snappy_ecosystem_tests.utils.storeconfig import get_store_credentials
27
28
29class ReleaseSnapTestCase(SnappyEcosystemTestCase):
30
31 def setUp(self):
32 super().setUp()
33 email, password = get_store_credentials()
34 self.store = Store()
35 self.store.login(email, password)
36 self.addCleanup(self.store.logout)
37 self.snapcraft = Snapcraft()
38 self.assertTrue(self.snapcraft.login(email, password))
39 self.addCleanup(self.snapcraft.logout)
40
41 def test_release_snap(self):
42 """Verify that snapcraft can release a snap against a new snap
43 registered via RESTful API
44 """
45 snap_name = get_random_snap_name()
46 channel = 'candidate'
47 revision = 1
48 version = '0.1'
49 self.assertTrue(self.store.register(snap_name),
50 'Unable to register snap')
51 # Upload the snap and wait for its processing on server to finish.
52 tracker = self.store.upload(
53 snap_name, self.snapcraft.build_and_pull(snap_name, '0.1'))
54 tracker.track()
55 # Release the snap via Snapcraft
56 self.snapcraft.release(snap_name, revision, channel)
57 # Check using REST API if snap was released to the channel
58 self.assertTrue(self.store.is_snap_published(snap_name,
59 version,
60 revision,
61 channels=[channel]))

Subscribers

People subscribed via source and target branches