Skip to content

Commit

Permalink
slicer/test: Set archive options from release
Browse files Browse the repository at this point in the history
Currently testArchive.Options() returns archive.Options with only the
Arch field set. In future we would like to extend testArchive to behave
differently based on its chisel.yaml definition.

Initialize archive.Options from setup.Release and store it in the
testArchive structure for each archive defined in chise.yaml.
  • Loading branch information
woky committed Jun 19, 2023
1 parent d9f5be9 commit 9aad663
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions internal/slicer/slicer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -527,12 +527,12 @@ const defaultChiselYaml = `
`

type testArchive struct {
arch string
pkgs map[string][]byte
options archive.Options
pkgs map[string][]byte
}

func (a *testArchive) Options() *archive.Options {
return &archive.Options{Arch: a.arch}
return &a.options
}

func (a *testArchive) Fetch(pkg string) (io.ReadCloser, error) {
Expand Down Expand Up @@ -579,9 +579,15 @@ func (s *S) TestRun(c *C) {
pkgs[name] = deb
}
archives := map[string]archive.Archive{}
for name, _ := range release.Archives {
for name, setupArchive := range release.Archives {
archive := &testArchive{
arch: test.arch,
options: archive.Options{
Label: setupArchive.Name,
Version: setupArchive.Version,
Suites: setupArchive.Suites,
Components: setupArchive.Components,
Arch: test.arch,
},
pkgs: pkgs,
}
archives[name] = archive
Expand Down

0 comments on commit 9aad663

Please sign in to comment.