tests: fix snaps tests in armhf #990

Merged
merged 11 commits into from Jan 6, 2017

Conversation

Projects
None yet
4 participants
Member

elopio commented Dec 16, 2016

LP: #1650458

Member

kyrofa commented Dec 19, 2016

(arm tests are failing here).

@sergiusens sergiusens changed the title from Fix snaps tests in armhf to tests: fix snaps tests in armhf Jan 3, 2017

codecov-io commented Jan 3, 2017

Current coverage is 96.37% (diff: 100%)

Merging #990 into master will not change coverage

@@             master       #990   diff @@
==========================================
  Files           194        194          
  Lines         17251      17251          
  Methods           0          0          
  Messages          0          0          
  Branches       1338       1338          
==========================================
  Hits          16625      16625          
  Misses          425        425          
  Partials        201        201          

Powered by Codecov. Last update 934d3d9...d7bf554

elopio added some commits Dec 16, 2016

Looks good. Would of merged but there's too much use of platform and then on yakkety there's (I already re-ran):

======================================================================
ERROR: demos_tests.test_mosquitto.MosquittoTestCase.test_mosquitto
----------------------------------------------------------------------
output: {{{b'Traceback (most recent call last):\n  File "/snap/mosquitto/x1/bin/publish", line 37, in <module>\n    main()\n  File "/snap/mosquitto/x1/bin/publish", line 26, in main\n    client = mqtt_client.Client()\n  File "/snap/mosquitto/x1/lib/python3.5/site-packages/paho/mqtt/client.py", line 422, in __init__\n    self._sockpairR, self._sockpairW = _socketpair_compat()\n  File "/snap/mosquitto/x1/lib/python3.5/site-packages/paho/mqtt/client.py", line 258, in _socketpair_compat\n    listensock = socket.socket(socket.AF_INET, socket.SOCK_STREAM, socket.IPPROTO_IP)\n  File "/snap/mosquitto/x1/usr/lib/python3.5/socket.py", line 134, in __init__\n    _socket.socket.__init__(self, family, type, proto, fileno)\nPermissionError: [Errno 13] Permission denied\n'}}}

Traceback (most recent call last):
  File "/tmp/autopkgtest.LX94UJ/build.afM/snapcraft/snaps_tests/demos_tests/test_mosquitto.py", line 39, in test_mosquitto
    'test-message'], '')
  File "/tmp/autopkgtest.LX94UJ/build.afM/snapcraft/snaps_tests/__init__.py", line 229, in assert_command_in_snappy_testbed
    output = self.run_command_in_snappy_testbed(command, cwd)
  File "/tmp/autopkgtest.LX94UJ/build.afM/snapcraft/snaps_tests/__init__.py", line 241, in run_command_in_snappy_testbed
    return self.snappy_testbed.run_command(command, cwd)
  File "/tmp/autopkgtest.LX94UJ/build.afM/snapcraft/snaps_tests/testbed.py", line 40, in run_command
    stderr=subprocess.STDOUT).decode('utf-8')
  File "/usr/lib/python3.5/subprocess.py", line 626, in check_output
    **kwargs).stdout
  File "/usr/lib/python3.5/subprocess.py", line 708, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '/snap/bin/mosquitto.publish test-mosquitto-topic test-message' returned non-zero exit status 1
snaps_tests/__main__.py
@@ -47,7 +48,11 @@ def main():
arguments = docopt.docopt(__doc__)
- snaps_tests.config['skip-install'] = arguments['--skip-install']
+ if platform.machine() == 'armv7l':
@sergiusens

sergiusens Jan 5, 2017

Collaborator

project_options

@elopio

elopio Jan 5, 2017

Member

@sergiusens but project options is available only when snapcraft is running. These tests just call snapcraft. I'm not sure how you want me to access project_options.

Here I'm just checking for the machine identified as armv7l in our autopkgtests. I'm not yet preoccupied about the actual arch, because that should happen in the plugin. If it doesn't support a particular architecture, it should display a nice error to the user.

@sergiusens

sergiusens Jan 5, 2017

Collaborator
from snapcraft import project_options
...
...
if project_options().deb_arch == 'armhf':
@sergiusens

sergiusens Jan 5, 2017

Collaborator

Or in the main test class

self.deb_arch = project_options().deb_arch
@sergiusens

sergiusens Jan 5, 2017

Collaborator

Or don't use project_options if you are really against it, but set it up only once in setUp

snaps_tests/demos_tests/test_git.py
+ snap_content_dir = 'git'
+
+ def test_gopaste(self):
+ if platform.machine() == 'armv7l':
@sergiusens

sergiusens Jan 5, 2017

Collaborator

please use an instance of project_options for these so we don't have to make a global change everywhere later.

integration_tests/test_maven_plugin.py
import integration_tests
class MavenPluginTestCase(integration_tests.TestCase):
def test_build_maven_plugin(self):
- if platform.machine() == 'armv7l':
+ if snapcraft.project_options().deb_arch == 'armv7l':
@sergiusens

sergiusens Jan 5, 2017

Collaborator

this change is certainly incomplete, right?

elopio added some commits Jan 5, 2017

snaps will soon be installable in lxd containers though ;-)

@sergiusens sergiusens merged commit f467e55 into snapcore:master Jan 6, 2017

5 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
xenial-amd64 autopkgtest finished (success)
Details
xenial-armhf autopkgtest finished (success)
Details
yakkety-amd64 autopkgtest finished (success)
Details
zesty-amd64 autopkgtest finished (success)
Details

@elopio elopio deleted the elopio:bug/1650458/snaps_armhf branch Jan 6, 2017

kalikiana pushed a commit to kalikiana/snapcraft that referenced this pull request Apr 6, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment