integration-tests: get name of OS snap from bootloader #343

Merged
merged 3 commits into from Jan 25, 2016

Conversation

Projects
None yet
3 participants
Member

elopio commented Jan 19, 2016

First branch for getting the integration tests working in raspberry pi2.
Currently the os snap is called ubuntu-core in amd64-generic and ubuntu-core-armhf in rpi2. According to Matias, by the end of the next week the store will support the same name for multiple architectures, so we might go back to hardcode the value. Instead of that, I would prefer to get a nice way to query for the name of the os snap, which has a bug reported in https://bugs.launchpad.net/snappy/+bug/1534029 . But we'll see what happens first...

- "^Reboot to use ubuntu-core version .*\\.\n"
+ expected := fmt.Sprintf("(?ms)"+
+ ".*"+
+ "^Reboot to use %s version .*\\.\n", common.OSSnapName(c))
@fgimenez

fgimenez Jan 21, 2016

Contributor

I would leave the first two lines outside the fmt.Sprintf call, but it's ok as it is

+ c.Assert(err, check.IsNil, check.Commentf("Error getting the name of the OS snap: %s", err))
+ return strings.Split(snappyOS, ".")[0]
+}
+
@fgimenez

fgimenez Jan 21, 2016

Contributor

I prefer to move things from common to the proper package instead of adding more code to it, what do you think? Would the testutils/partition package be a good place for this function? Or perhaps a new one, including GetCurrentUbuntuCoreVersion?

@fgimenez

fgimenez Jan 21, 2016

Contributor

Also a unit test for this function would be nice

@elopio

elopio Jan 22, 2016

Member

partition is clearly not a good place for this. But the right place depends on how https://bugs.launchpad.net/snappy/+bug/1532245 is fixed.
For now I'll put it in partition, which we also have to rename. And when the bug is fixed, we'll have to update this and it will be easier to find a name for that new package.

Contributor

fgimenez commented Jan 21, 2016

Looks good, the only real concern is about adding code to the common package, thanks! :)

elopio added some commits Jan 22, 2016

Member

elopio commented Jan 22, 2016

@fgimenez please, take another look.

@@ -134,6 +134,17 @@ func (s *bootloaderTestSuite) TestModeReturnsSnappyModeFromConf(c *check.C) {
c.Assert(mode, check.Equals, "test_mode", check.Commentf("Wrong mode"))
}
+func (s *bootloaderTestSuite) TestOSSnapNameReturnsSnapFromConf(c *check.C) {
@fgimenez

fgimenez Jan 22, 2016

Contributor

Nice!

@@ -74,6 +75,19 @@ func Mode() (mode string, err error) {
return confValue("snappy_mode")
}
+// OSSnapName returns the name of the OS snap.
+func OSSnapName(c *check.C) string {
+ snappyOS, err := snappyOS()
@fgimenez

fgimenez Jan 22, 2016

Contributor

IMO much better without the external dependency, thanks :)

Contributor

fgimenez commented Jan 22, 2016

LGTM thanks Leo

Collaborator

mvo5 commented Jan 22, 2016

I think we need the new changelog format in the pull-request description now :) Then this can land

@niemeyer niemeyer changed the title from Get the name of the OS snap from the bootloader. to integration-tests: get name of OS snap from bootloader Jan 22, 2016

mvo5 added a commit that referenced this pull request Jan 25, 2016

Merge pull request #343 from elopio/all_snaps_rpi2
integration-tests: get name of OS snap from bootloader

@mvo5 mvo5 merged commit 48a6c44 into snapcore:master Jan 25, 2016

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage increased (+0.1%) to 67.884%
Details

@elopio elopio deleted the elopio:all_snaps_rpi2 branch Jan 25, 2016

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