Merge lp:~canonical-platform-qa/snappy-ecosystem-tests/fix-snap-builder into lp:snappy-ecosystem-tests

Proposed by Omer Akram
Status: Merged
Approved by: I Ahmad
Approved revision: 44
Merged at revision: 44
Proposed branch: lp:~canonical-platform-qa/snappy-ecosystem-tests/fix-snap-builder
Merge into: lp:snappy-ecosystem-tests
Diff against target: 84 lines (+21/-8)
2 files modified
snappy_ecosystem_tests/environment/containers/lxd.py (+1/-1)
snappy_ecosystem_tests/helpers/snapcraft/build_snap.py (+20/-7)
To merge this branch: bzr merge lp:~canonical-platform-qa/snappy-ecosystem-tests/fix-snap-builder
Reviewer Review Type Date Requested Status
platform-qa-bot continuous-integration Approve
I Ahmad (community) Approve
Review via email: mp+320032@code.launchpad.net

Commit message

Fix snap builder

Description of the change

The snap builder is broken right now, this branch fixes it.

Note: the change is isolated so does not affect already existing tests/infrastructure.

To post a comment you must log in.
43. By Omer Akram

Add default description and summary for snap to reduce required parameters

Revision history for this message
Omer Akram (om26er) wrote :

This is to be consumed by a snap upload test that is incoming in a bit. Just wanting to keep this change separate from the actual test. Also the reason to reduce the requirement for parameters while building a snap is "convenience".

Revision history for this message
Omer Akram (om26er) wrote :
44. By Omer Akram

increase container internet wait time

Revision history for this message
I Ahmad (iahmad) wrote :

LGTM - executed the tests on cloud instance and results can be found here

http://paste.ubuntu.com/24188179/

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'snappy_ecosystem_tests/environment/containers/lxd.py'
2--- snappy_ecosystem_tests/environment/containers/lxd.py 2017-03-15 14:12:51 +0000
3+++ snappy_ecosystem_tests/environment/containers/lxd.py 2017-03-16 11:29:36 +0000
4@@ -164,7 +164,7 @@
5 'echo \'{}={}\' >> /etc/environment'.format(variable,
6 value))
7
8- def wait_for_internet(self, container, attempts_count=10,
9+ def wait_for_internet(self, container, attempts_count=30,
10 attempt_interval=1, ping_domain=DOMAIN_PING):
11 """Wait for internet connectivity in the container."""
12 for _ in range(attempts_count):
13
14=== modified file 'snappy_ecosystem_tests/helpers/snapcraft/build_snap.py'
15--- snappy_ecosystem_tests/helpers/snapcraft/build_snap.py 2017-03-07 13:53:31 +0000
16+++ snappy_ecosystem_tests/helpers/snapcraft/build_snap.py 2017-03-16 11:29:36 +0000
17@@ -48,6 +48,10 @@
18 {snap_name}:
19 command: echo ok
20 """
21+SUMMARY_SNAP_DEFAULT = 'A test snap.'
22+DESCRIPTION_SNAP_DEFAULT = 'A very awesome test snap.'
23+GRADE_SNAP_DEFAULT = 'stable'
24+CONFINEMENT_SNAP_DEFAULT = 'strict'
25
26
27 class SnapBuilder:
28@@ -63,6 +67,12 @@
29 execution over ssh"""
30 return SSHManager.get_instance(self.hostname, self.username, self.port)
31
32+ def run_command_ssh(self, command, cwd=''):
33+ """Run command over ssh with optional cwd."""
34+ if cwd:
35+ command = 'cd {}; {}'.format(cwd, command)
36+ return self.ssh.exec_command(command)
37+
38 def is_host_setup(self):
39 """Return bool representing whether the remote host is setup by
40 checking if snapcraft package is installed."""
41@@ -78,8 +88,9 @@
42 for command in COMMANDS_SETUP:
43 self.ssh.exec_command(command)
44
45- def build(self, name, version, summary, description, grade='stable',
46- confinement='strict'):
47+ def build(self, name, version, summary=SUMMARY_SNAP_DEFAULT,
48+ description=DESCRIPTION_SNAP_DEFAULT, grade=GRADE_SNAP_DEFAULT,
49+ confinement=CONFINEMENT_SNAP_DEFAULT):
50 """Build a new snap in the remote host and return its remote path.
51
52 :param name: name of the snap to build.
53@@ -95,8 +106,8 @@
54 if not self.is_host_setup():
55 self.setup_host()
56 tempdir = self.ssh.exec_command('mktemp -d')
57- self.ssh.exec_command('mkdir snap', cwd=tempdir)
58- self.ssh.exec_command('echo "{}" > snap/snapcraft.yaml'.format(
59+ self.run_command_ssh('mkdir snap', cwd=tempdir)
60+ self.run_command_ssh('echo "{}" > snap/snapcraft.yaml'.format(
61 SNAPCRAFT_YAML.format(
62 snap_name=name,
63 version=version,
64@@ -106,7 +117,7 @@
65 confinement=confinement
66 )
67 ), cwd=tempdir)
68- self.ssh.exec_command('snapcraft', cwd=tempdir)
69+ self.run_command_ssh('snapcraft', cwd=tempdir)
70 return os.path.join(
71 tempdir,
72 '{name}_{version}_{arch}.snap'.format(
73@@ -116,8 +127,10 @@
74 )
75 )
76
77- def build_and_pull(self, name, version, summary, description,
78- grade='stable', confinement='strict',
79+ def build_and_pull(self, name, version, summary=SUMMARY_SNAP_DEFAULT,
80+ description=DESCRIPTION_SNAP_DEFAULT,
81+ grade=GRADE_SNAP_DEFAULT,
82+ confinement=CONFINEMENT_SNAP_DEFAULT,
83 output_location='.'):
84 """Build a snap based on the provided arguments and download it.
85

Subscribers

People subscribed via source and target branches