mirror of
https://github.com/token2/snapd.git
synced 2026-03-13 11:15:47 -07:00
overlord: fix generated snap-revision assertions in remodel unit tests
When building on LP, the mock snap files generated with mksquashfs end up having the same sha3-348 digest, despite forcing a 1s delay between consecutive snap builds, what should have affected the internal file timestamps. As a workaround, use a different content of mock files, such that the files must yield a different digest. Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
This commit is contained in:
committed by
Michael Vogt
parent
3546f33f73
commit
d07bfcd9ad
@@ -844,7 +844,7 @@ func (s *baseMgrsSuite) makeStoreSnapRevision(c *C, name, revno, digest string,
|
||||
snapRev, err := s.storeSigning.Sign(asserts.SnapRevisionType, headers, nil, "")
|
||||
c.Assert(err, IsNil)
|
||||
err = s.storeSigning.Add(snapRev)
|
||||
c.Assert(err, IsNil)
|
||||
c.Assert(err, IsNil, Commentf("cannot add snap revision %v", headers))
|
||||
return snapRev
|
||||
}
|
||||
|
||||
@@ -6222,8 +6222,21 @@ var (
|
||||
"baz": "version: 1.0\nname: baz\nbase: core20",
|
||||
}
|
||||
snapFilesForRemodel = map[string][][]string{
|
||||
"pc": pcGadgetFiles,
|
||||
"pc": pcGadgetFiles,
|
||||
// use a different fileset, such that the pc snap with this
|
||||
// content will have a different digest than the regular pc snap
|
||||
"pc-rev-33": append(pcGadgetFiles, []string{
|
||||
"this-is-new", "",
|
||||
}),
|
||||
"pc-kernel": pcKernelFiles,
|
||||
// similar reasoning as for the pc snap
|
||||
"pc-kernel-rev-33": append(pcKernelFiles, []string{
|
||||
"this-is-new", "",
|
||||
}),
|
||||
// and again
|
||||
"core20-rev-33": {
|
||||
{"this-is-new", ""},
|
||||
},
|
||||
}
|
||||
|
||||
// headers of a regular UC20 model assertion
|
||||
@@ -6836,10 +6849,8 @@ func (s *mgrsSuite) testRemodelUC20WithRecoverySystemSimpleSetUp(c *C) {
|
||||
|
||||
func (s *mgrsSuite) TestRemodelUC20DifferentKernelChannel(c *C) {
|
||||
s.testRemodelUC20WithRecoverySystemSimpleSetUp(c)
|
||||
// add sleep such that the assertion timestamp will be different and
|
||||
// won't conflict with already existing one
|
||||
time.Sleep(time.Second)
|
||||
snapPath, _ := s.makeStoreTestSnapWithFiles(c, snapYamlsForRemodel["pc-kernel"], "33", snapFilesForRemodel["pc-kernel"])
|
||||
// use a different set of files, such that the snap digest must also be different
|
||||
snapPath, _ := s.makeStoreTestSnapWithFiles(c, snapYamlsForRemodel["pc-kernel"], "33", snapFilesForRemodel["pc-kernel-rev-33"])
|
||||
s.serveSnap(snapPath, "33")
|
||||
newModel := s.brands.Model("can0nical", "my-model", uc20ModelDefaults, map[string]interface{}{
|
||||
"snaps": []interface{}{
|
||||
@@ -6967,10 +6978,8 @@ func (s *mgrsSuite) TestRemodelUC20DifferentKernelChannel(c *C) {
|
||||
|
||||
func (s *mgrsSuite) TestRemodelUC20DifferentGadgetChannel(c *C) {
|
||||
s.testRemodelUC20WithRecoverySystemSimpleSetUp(c)
|
||||
// add sleep such that the assertion timestamp will be different and
|
||||
// won't conflict with already existing one
|
||||
time.Sleep(time.Second)
|
||||
snapPath, _ := s.makeStoreTestSnapWithFiles(c, snapYamlsForRemodel["pc"], "33", snapFilesForRemodel["pc"])
|
||||
// use a different set of files, such that the snap digest must also be different
|
||||
snapPath, _ := s.makeStoreTestSnapWithFiles(c, snapYamlsForRemodel["pc"], "33", snapFilesForRemodel["pc-rev-33"])
|
||||
s.serveSnap(snapPath, "33")
|
||||
newModel := s.brands.Model("can0nical", "my-model", uc20ModelDefaults, map[string]interface{}{
|
||||
"snaps": []interface{}{
|
||||
@@ -7074,10 +7083,8 @@ func (s *mgrsSuite) TestRemodelUC20DifferentGadgetChannel(c *C) {
|
||||
|
||||
func (s *mgrsSuite) TestRemodelUC20DifferentBaseChannel(c *C) {
|
||||
s.testRemodelUC20WithRecoverySystemSimpleSetUp(c)
|
||||
// add sleep such that the assertion timestamp will be different and
|
||||
// won't conflict with already existing one
|
||||
time.Sleep(time.Second)
|
||||
snapPath, _ := s.makeStoreTestSnapWithFiles(c, snapYamlsForRemodel["core20"], "33", snapFilesForRemodel["core20"])
|
||||
// use a different set of files, such that the snap digest must also be different
|
||||
snapPath, _ := s.makeStoreTestSnapWithFiles(c, snapYamlsForRemodel["core20"], "33", snapFilesForRemodel["core20-rev-33"])
|
||||
s.serveSnap(snapPath, "33")
|
||||
newModel := s.brands.Model("can0nical", "my-model", uc20ModelDefaults, map[string]interface{}{
|
||||
"snaps": []interface{}{
|
||||
|
||||
Reference in New Issue
Block a user