← Back to issue list

test_cleanbuild unit test fails when executed in a platform that's not amd64

View original Launchpad issue

Metadata

Project
snapcraft (launchpad)
Number
#1589747
Type
issue
State
closed
Author
~elopio
Labels
verification-done
Created
Updated
Closed

Current evaluation

Fixed by PR ubuntu-core/snapcraft#552 (commit 65c1fac22), making test_cleanbuild architecture-aware; released in snapcraft 2.11 and verified in xenial -updates.

Resolution: closed resolved

Reason: PR #552 removed the test's hardcoded amd64 assumption and was released in snapcraft 2.11. SRU verification completed successfully before the issue was closed.

Evaluated by: mr-cal-bot

No scores available.

Issue body

The unittest has the expected architecture value hardcoded to amd64, so when it is run in a different architecture it will fail. FAIL: test_cleanbuild (snapcraft.tests.test_lxd.LXDTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/lib/python3.5/unittest/mock.py", line 1157, in patched return func(*args, **keywargs) File "/tmp/autopkgtest.v8hLiN/build.kH3/snapcraft-2.9/snapcraft/tests/test_lxd.py", line 76, in test_cleanbuild call(['lxc', 'remote', 'remove', 'my-pet'])]) File "/usr/lib/python3.5/unittest/mock.py", line 824, in assert_has_calls ) from cause AssertionError: Calls not found. Expected: [call(['lxc', 'remote', 'add', 'my-pet', 'https://images.linuxcontainers.org:8443']), call(['lxc', 'launch', 'my-pet:ubuntu/xenial/amd64', 'snapcraft-my-pet']), call(['lxc', 'file', 'push', 'project.tar', 'snapcraft-my-pet//root/project.tar']), call(['lxc', 'exec', 'snapcraft-my-pet', '--', 'tar', 'xvf', '/root/project.tar']), call(['lxc', 'exec', 'snapcraft-my-pet', '--', 'python3', '-c', 'import urllib.request; urllib.request.urlopen("http://start.ubuntu.com/connectivity-check.html", timeout=5)']), call(['lxc', 'exec', 'snapcraft-my-pet', '--', 'apt-get', 'update']), call(['lxc', 'exec', 'snapcraft-my-pet', '--', 'apt-get', 'install', 'snapcraft', '-y']), call(['lxc', 'exec', 'snapcraft-my-pet', '--', 'snapcraft', 'snap', '--output', 'snap.snap']), call(['lxc', 'file', 'pull', 'snapcraft-my-pet//root/snap.snap', 'snap.snap']), call(['lxc', 'stop', 'snapcraft-my-pet']), call(['lxc', 'remote', 'remove', 'my-pet'])] Actual: [call(['lxc', 'remote', 'add', 'my-pet', 'https://images.linuxcontainers.org:8443']), call(['lxc', 'launch', 'my-pet:ubuntu/xenial/i386', 'snapcraft-my-pet']), call(['lxc', 'file', 'push', 'project.tar', 'snapcraft-my-pet//root/project.tar']), call(['lxc', 'exec', 'snapcraft-my-pet', '--', 'tar', 'xvf', '/root/project.tar']), call(['lxc', 'exec', 'snapcraft-my-pet', '--', 'python3', '-c', 'import urllib.request; urllib.request.urlopen("http://start.ubuntu.com/connectivity-check.html", timeout=5)']), call(['lxc', 'exec', 'snapcraft-my-pet', '--', 'apt-get', 'update']), call(['lxc', 'exec', 'snapcraft-my-pet', '--', 'apt-get', 'install', 'snapcraft', '-y']), call(['lxc', 'exec', 'snapcraft-my-pet', '--', 'snapcraft', 'snap', '--output', 'snap.snap']), call(['lxc', 'file', 'pull', 'snapcraft-my-pet//root/snap.snap', 'snap.snap']), call(['lxc', 'stop', 'snapcraft-my-pet']), [Impact] * No visible impact for users. * Fixing this test will get us closer to have green executions in autopkgtests in all the platforms. [Test Case] * Run the autopkgtests in a platform that's not amd64, [Regression Potential] * This could make fail the tests in amd64. But as it's in an autopkgtest, any regression will block the new version to get to proposed.

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Fixed by PR ubuntu-core/snapcraft#552 (commit 65c1fac22), making test_cleanbuild architecture-aware; released in snapcraft 2.11 and verified in xenial -updates.
stealth/space-bunny-alpha — closed resolved Fixed by merged PR canonical/snapcraft#552 (commit 65c1fac) which made the LXD cleanbuild unit test arch-agnostic; released in snapcraft 2.11 (LP #1589747) and verified to -updates, closing the issue.
stealth/space-bunny-alpha — closed resolved Fixed test_cleanbuild’s hardcoded amd64 expectation by detecting the host architecture dynamically, allowing the LXD unit test to pass on other platforms.
qwen/qwen3.6-35b-a3b — — Fixed test_cleanbuild unit test failure on non-amd64 platforms by replacing the hardcoded amd64 architecture with dynamic detection. Ensures cross-platform compatibility. Resolved and verified.
qwen/qwen3.6-35b-a3b — — The hardcoded amd64 architecture in the test_cleanbuild unit test was updated to dynamically detect the system architecture, fixing autopkgtest failures on non-amd64 platforms and ensuring cross-platform test compatibility.
qwen/qwen3.6-35b-a3b — — Fixed test_cleanbuild unit test failure on non-amd64 platforms by replacing the hardcoded amd64 architecture with dynamic detection. The change ensures cross-platform compatibility and enables successful autopkgtest execution.

Update history

Date Change
created

Related work

  • Likely Fixed By: ubuntu-core/snapcraft#552 (confidence 100%)

    Merged as commit 65c1fac22 and cited in the snapcraft 2.11 changelog as the fix for LP #1589747.

Related issues

Issue Project State Summary Similarity
#1589779 snap tests fail when executed in a platform that's not amd64 snapcraft (launchpad) closed Fixed by ubuntu-core/snapcraft PR #554 (commit baed96749), making snaps tests architecture-aware; released in snapcraft 2.11 after successful verification.
85%
#1589752 unit tests in IsDirtyTestCase fail when executed in a platform that's not amd64 snapcraft (launchpad) closed Fixed by upstream PR ubuntu-core/snapcraft#553 (commit 393c4e201), which made IsDirtyTestCase architecture-agnostic; released in snapcraft 2.11 to xenial -updates, SRU verified.
83%
#1737532 "snapcraft cleanbuild --target-arch=i386" produces amd64 executables snapcraft (launchpad) closed Resolved with base-based builds; maintainer Sergiusens noted in 2021 that the legacy LXD cleanbuild architecture issue no longer applied.
73%