tests: add spread test for assertions in prepare-image's extra-snaps #16

Merged
merged 4 commits into from Apr 27, 2017

Conversation

Projects
None yet
2 participants

fgimenez commented Apr 27, 2017

Hi Michael, this is the test I mentioned, it can be executed with: spread -v -debug qemu:ubuntu-16.04-64:tests/nested/extra-snaps-assertions. The test downloads core, creates a new image with it as --extra-snaps, boots it with qemu (doing all the required magic for putting in place a system-user assertion) and checks that the core in the image has a proper revision number (not x1). The last part, the checks on the created image, is performed in tests/nested/prepare-image-check, maybe we could add more checks there.

All the nested suite is marked as manual, so that this test won't be included in regular PR executions, we should setup a spread-cron branch for having them executed as needed (either in response to events like merges to master or cron-based).

Thanks for this branch, the nested suite is real magic, nice work! I added some comments, but this looks very good.

+
+ # create ubuntu-core image
+ mkdir -p /tmp/work-dir
+ snap install --devmode --beta ubuntu-image
@mvo5

mvo5 Apr 27, 2017

Owner

Installing this ubuntu-image snap will bundle its own /usr/bin/snap - so this test (as is) will not work, will it? We can probably tweak it by mount -o bind /usr/bin/snap /snap/ubuntu-image/current/bin/snap ?

@fgimenez

fgimenez Apr 27, 2017

Brilliant! I was using an ubuntu-image built using your branch as source for snapd, bind mounting works like a charm :) changes pushed, the test is passing now, you can try it with spread -v qemu:ubuntu-16.04-64:tests/nested/extra-snaps-assertions

+ mv ubuntu-core.img /tmp/work-dir
+
+ # create assertion block device
+ genisoimage -volid cidata -joliet -rock -o assertions.disk $TESTSLIB/assertions/auto-import.assert
@mvo5

mvo5 Apr 27, 2017

Owner

Do we need this auto-import.assert file here?

@fgimenez

fgimenez Apr 27, 2017

AFAIK yes, if not the nested instance is not accessible at all, we would need to go through the console-conf initialization, this system-user assertion allows us to access as user1:ubuntu, which is used later to configure the test user required by spread.

@mvo5

mvo5 Apr 27, 2017

Owner

Aha, nice. Thank you

+
+execute: |
+ execute_remote(){
+ sshpass -p ubuntu ssh -p 8022 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no user1@localhost "$*"
+
+ set +x
+ export SPREAD_EXTERNAL_ADDRESS=localhost:8022
+ rm -f snapd-state.tar.gz npm-debug.log
@mvo5

mvo5 Apr 27, 2017

Owner

Where does npm come from?

@fgimenez

fgimenez Apr 27, 2017

No idea, the first runs were failing because the state tarball was being left at the root of the project, while looking there I saw that npm file there too (~800kb), I'll dig deeper to find the cause.

+ snap known model|grep "series: 16"
+
+ echo "Make sure core has an actual revision"
+ snap list | MATCH "^core +[0-9]+\.[0-9]+ +[0-9]+ +canonical +\-"
@mvo5

mvo5 Apr 27, 2017

Owner

One extra test that would be nice is to check if snap info |MATCH "tracking: (stable|candidate|beta|edge)" (not sure if MATCH supports this syntax. I.e. ensure we are tracking a channel.

@mvo5 thanks! comments addressed, pls take another look

@mvo5 mvo5 merged commit ff637cb into mvo5:prepare-image-local-assertions Apr 27, 2017

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