Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

slicer/test: Define all release archives #81

Merged
merged 1 commit into from
Aug 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity, how did you know the checksum of the /usr/bin/hello here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is the same file from the embedded base-files package, so I've just copied it from the result maps from earlier test cases.

},
}}

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