Unable to run tests from snapcraft

Hello all,

I am having these weird issues when trying to run the tests.

Initially, running the tests would bring weird outputs related to LXC and it would not perform the tests correctly:

 lxc info --show-log local:snapcraft-build-test
Name: snapcraft-build-test
Remote: unix:/var/lib/lxd/unix.socket
Architecture: x86_64
Created: 2017/11/17 23:30 UTC
Status: Stopped
Type: persistent
Profiles: default

Log:

            lxc 20171117234531.947 ERROR    lxc_cgfsng - cgroups/cgfsng.c:create_path_for_hierarchy:1328 - Path "/sys/fs/cgroup/systemd//lxc/snapcraft-build-test" already existed.
            lxc 20171117234531.947 ERROR    lxc_cgfsng - cgroups/cgfsng.c:cgfsng_create:1385 - No such file or directory - Failed to create /sys/fs/cgroup/systemd//lxc/snapcraft-build-test: No such file or directory
            lxc 20171117234531.947 ERROR    lxc_cgfsng - cgroups/cgfsng.c:create_path_for_hierarchy:1328 - Path "/sys/fs/cgroup/systemd//lxc/snapcraft-build-test-1" already existed.
            lxc 20171117234531.947 ERROR    lxc_cgfsng - cgroups/cgfsng.c:cgfsng_create:1385 - No such file or directory - Failed to create /sys/fs/cgroup/systemd//lxc/snapcraft-build-test-1: No such file or directory
            lxc 20171117234531.947 ERROR    lxc_cgfsng - cgroups/cgfsng.c:create_path_for_hierarchy:1328 - Path "/sys/fs/cgroup/systemd//lxc/snapcraft-build-test-2" already existed.
            lxc 20171117234531.947 ERROR    lxc_cgfsng - cgroups/cgfsng.c:cgfsng_create:1385 - No such file or directory - Failed to create /sys/fs/cgroup/systemd//lxc/snapcraft-build-test-2: No such file or directory
            lxc 20171117234531.952 ERROR    lxc_start - start.c:lxc_spawn:1186 - Failed to set up id mapping.
            lxc 20171117234532.404 WARN     lxc_conf - conf.c:lxc_delete_network:3103 - Failed to remove "vethOSB041" from host: Invalid argument.
            lxc 20171117234532.417 ERROR    lxc_start - start.c:__lxc_start:1358 - Failed to spawn container "snapcraft-build-test".
            lxc 20171117234532.645 ERROR    lxc_conf - conf.c:run_buffer:416 - Script exited with status 1.
            lxc 20171117234532.645 ERROR    lxc_start - start.c:lxc_fini:546 - Failed to run lxc.hook.post-stop for container "snapcraft-build-test".
            lxc 20171117234532.645 WARN     lxc_commands - commands.c:lxc_cmd_rsp_recv:177 - Command get_cgroup failed to receive response: Connection reset by peer.
            lxc 20171117234532.645 WARN     lxc_commands - commands.c:lxc_cmd_rsp_recv:177 - Command get_cgroup failed to receive response: Connection reset by peer.
            lxc 20171117234532.648 ERROR    lxc_conf - conf.c:userns_exec_1:4608 - Error setting up child mappings
            lxc 20171117234532.648 ERROR    lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:1288 - Error destroying /sys/fs/cgroup/systemd//lxc/snapcraft-build-test-3
            lxc 20171117234532.650 ERROR    lxc_conf - conf.c:userns_exec_1:4608 - Error setting up child mappings
            lxc 20171117234532.650 ERROR    lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:1288 - Error destroying /sys/fs/cgroup/net_cls//lxc/snapcraft-build-test-3
            lxc 20171117234532.652 ERROR    lxc_conf - conf.c:userns_exec_1:4608 - Error setting up child mappings
            lxc 20171117234532.652 ERROR    lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:1288 - Error destroying /sys/fs/cgroup/cpu//lxc/snapcraft-build-test-3
            lxc 20171117234532.655 ERROR    lxc_conf - conf.c:userns_exec_1:4608 - Error setting up child mappings
            lxc 20171117234532.655 ERROR    lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:1288 - Error destroying /sys/fs/cgroup/devices//lxc/snapcraft-build-test-3
            lxc 20171117234532.657 ERROR    lxc_conf - conf.c:userns_exec_1:4608 - Error setting up child mappings
            lxc 20171117234532.657 ERROR    lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:1288 - Error destroying /sys/fs/cgroup/blkio//lxc/snapcraft-build-test-3
            lxc 20171117234532.659 ERROR    lxc_conf - conf.c:userns_exec_1:4608 - Error setting up child mappings
            lxc 20171117234532.659 ERROR    lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:1288 - Error destroying /sys/fs/cgroup/pids//lxc/snapcraft-build-test-3
            lxc 20171117234532.662 ERROR    lxc_conf - conf.c:userns_exec_1:4608 - Error setting up child mappings
            lxc 20171117234532.662 ERROR    lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:1288 - Error destroying /sys/fs/cgroup/freezer//lxc/snapcraft-build-test-3
            lxc 20171117234532.664 ERROR    lxc_conf - conf.c:userns_exec_1:4608 - Error setting up child mappings
            lxc 20171117234532.664 ERROR    lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:1288 - Error destroying /sys/fs/cgroup/memory//lxc/snapcraft-build-test-3
            lxc 20171117234532.667 ERROR    lxc_conf - conf.c:userns_exec_1:4608 - Error setting up child mappings
            lxc 20171117234532.667 ERROR    lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:1288 - Error destroying /sys/fs/cgroup/perf_event//lxc/snapcraft-build-test-3
            lxc 20171117234532.669 ERROR    lxc_conf - conf.c:userns_exec_1:4608 - Error setting up child mappings
            lxc 20171117234532.669 ERROR    lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:1288 - Error destroying /sys/fs/cgroup/cpuset//lxc/snapcraft-build-test-3
            lxc 20171117234532.671 ERROR    lxc_conf - conf.c:userns_exec_1:4608 - Error setting up child mappings
            lxc 20171117234532.671 ERROR    lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:1288 - Error destroying /sys/fs/cgroup/hugetlb//lxc/snapcraft-build-test-3

I proceeded to do a clean installation of LXC, LXD and Snapcraft. However, I was not able to install Snapcraft. When running pip instal -r requirements.txt -r requirements-devel.txt, I was getting erorrs saying I had some missing dependencies. However, those dependencies were installed in the environment. So I proceeded to try with pip3 and it finally reinstalled snapcraft - yey!

However, I was working on a method implementation and got new errors:

gsilvapt at machina in [~/Documents/snapcraft]  on git:update_version_command ✗  36f62b84 "dotnet plugin: new plugin (#1574)"
18:52:31 › ./runtests.sh snapcraft/tests/commands 
Not recognized option, should be one of all, static, unit, integration, store, plugins, snapd, snaps or spread

gsilvapt at machina in [~/Documents/snapcraft]  on git:update_version_command ✗  36f62b84 "dotnet plugin: new plugin (#1574)"
18:55:19 › ./runtests.sh snapcraft/tests/unit    
Not recognized option, should be one of all, static, unit, integration, store, plugins, snapd, snaps or spread

gsilvapt at machina in [~/Documents/snapcraft]  on git:update_version_command ✗  36f62b84 "dotnet plugin: new plugin (#1574)"
18:55:29 › ./runtests.sh unit                
snapcraft.tests (unittest.loader._FailedTest) ... ERROR

======================================================================
ERROR: snapcraft.tests (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: snapcraft.tests
Traceback (most recent call last):
  File "/usr/lib/python3.5/unittest/loader.py", line 462, in _find_test_path
    package = self._get_module_from_name(name)
  File "/usr/lib/python3.5/unittest/loader.py", line 369, in _get_module_from_name
    __import__(name)
  File "/home/gsilvapt/Documents/snapcraft/snapcraft/tests/__init__.py", line 31, in <module>
    from snapcraft.tests import fake_servers, fixture_setup
  File "/home/gsilvapt/Documents/snapcraft/snapcraft/tests/fixture_setup.py", line 41, in <module>
    from snapcraft.tests.fake_servers import (
  File "/home/gsilvapt/Documents/snapcraft/snapcraft/tests/fake_servers/api.py", line 23, in <module>
    from pyramid import response
  File "/usr/local/lib/python3.5/dist-packages/pyramid/response.py", line 11, in <module>
    from pyramid.interfaces import IResponse, IResponseFactory
  File "/usr/local/lib/python3.5/dist-packages/pyramid/interfaces.py", line 1, in <module>
    from zope.deprecation import deprecated
ImportError: No module named 'zope.deprecation'


----------------------------------------------------------------------
Ran 1 test in 0.000s

FAILED (errors=1)

All those packages are installed so I don’t know what is going on here. I have a feeling this is related with Python 2 and Python 3 but i can’t seem to find anything useful to work on as this is a snapcraft related bug and only we have documentation about it.

Hope someone has experienced and knows how to fix this. I thought about either doing a clean installation as my python installation may be messed up but there has to be a cleaner and quicker way.

Thank you for your attention.

Problem is solved. I forgot to pull before doing stuff and thus was trying to run commands that were not implemented at the time.

As I go by the shame path, I ask a moderator to close this thread :smile:

2 Likes