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

Subscribers

People subscribed via source and target branches