Skip to content

Commit

Permalink
slicer/test: Define all release archives
Browse files Browse the repository at this point in the history
Currently the slicer test defines one archive named "ubuntu" for all
test cases no matter what they define in chisel.yaml. But since commit
afad3d2 we allow more archives with different names to be defined in
chisel.yaml. Define a test archive for each of them.
  • Loading branch information
woky committed Jun 19, 2023
1 parent afad3d2 commit d9f5be9
Showing 1 changed file with 34 additions and 3 deletions.
37 changes: 34 additions & 3 deletions internal/slicer/slicer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,35 @@ var slicerTests = []slicerTest{{
`,
},
error: `slice base-files_myslice: content is not a file: /x/y`,
}, {
summary: "Non-default archive",
slices: []setup.SliceKey{{"base-files", "myslice"}},
release: map[string]string{
"chisel.yaml": `
format: chisel-v1
archives:
foo:
version: 22.04
components: [main, universe]
default: true
bar:
version: 22.04
components: [main]
`,
"slices/mydir/base-files.yaml": `
package: base-files
archive: bar
slices:
myslice:
contents:
/usr/bin/hello:
`,
},
result: map[string]string{
"/usr/": "dir 0755",
"/usr/bin/": "dir 0755",
"/usr/bin/hello": "file 0775 eaf29575",
},
}}

const defaultChiselYaml = `
Expand Down Expand Up @@ -549,11 +578,13 @@ func (s *S) TestRun(c *C) {
c.Assert(err, IsNil)
pkgs[name] = deb
}
archives := map[string]archive.Archive{
"ubuntu": &testArchive{
archives := map[string]archive.Archive{}
for name, _ := range release.Archives {
archive := &testArchive{
arch: test.arch,
pkgs: pkgs,
},
}
archives[name] = archive
}

targetDir := c.MkDir()
Expand Down

0 comments on commit d9f5be9

Please sign in to comment.