Skip to content
Merged
Show file tree
Hide file tree
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
114 changes: 114 additions & 0 deletions internal/setup/setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,120 @@ var setupTests = []setupTest{{
EndOfLife: time.Date(2100, time.January, 1, 0, 0, 0, 0, time.UTC),
},
},
}, {
summary: "Invalid pro in archives ignored",
input: map[string]string{
"chisel.yaml": `
format: v3
maintenance:
standard: 2001-02-03
end-of-life: 2010-11-12
archives:
ubuntu:
version: 20.04
suites: [focal]
components: [main]
public-keys: [test-key]
priority: 10
ubuntu-invalid:
pro: invalid-pro # <- invalid pro should be ignored, not cause an error
version: 20.04
components: [main]
suites: [focal]
public-keys: [test-key]
priority: 20
public-keys:
test-key:
id: ` + testKey.ID + `
armor: |` + "\n" + testutil.PrefixEachLine(testKey.PubKeyArmor, "\t\t\t\t\t\t") + `
`,
"slices/mydir/mypkg.yaml": `
package: mypkg
`,
},
release: &setup.Release{
Format: "v3",
Archives: map[string]*setup.Archive{
"ubuntu": {
Name: "ubuntu",
Version: "20.04",
Suites: []string{"focal"},
Components: []string{"main"},
Priority: 10,
PubKeys: []*packet.PublicKey{testKey.PubKey},
Maintained: false,
OldRelease: true,
},
},
Packages: map[string]*setup.Package{
"mypkg": {
Name: "mypkg",
Path: "slices/mydir/mypkg.yaml",
Slices: map[string]*setup.Slice{},
},
},
Maintenance: &setup.Maintenance{
Standard: time.Date(2001, time.February, 3, 0, 0, 0, 0, time.UTC),
EndOfLife: time.Date(2010, time.November, 12, 0, 0, 0, 0, time.UTC),
},
},
}, {
summary: "Invalid pro in archives ignored in v2-archives",
input: map[string]string{
"chisel.yaml": `
format: v1
maintenance:
standard: 2001-02-03
end-of-life: 2010-11-12
archives:
ubuntu:
version: 20.04
suites: [focal]
components: [main]
public-keys: [test-key]
default: true
v2-archives:
ubuntu-invalid:
pro: invalid-pro # <- invalid pro should be ignored, not cause an error
version: 20.04
components: [main]
suites: [focal]
public-keys: [test-key]
public-keys:
test-key:
id: ` + testKey.ID + `
armor: |` + "\n" + testutil.PrefixEachLine(testKey.PubKeyArmor, "\t\t\t\t\t\t") + `
`,
"slices/mydir/mypkg.yaml": `
package: mypkg
`,
},
release: &setup.Release{
Format: "v1",
Archives: map[string]*setup.Archive{
"ubuntu": {
Name: "ubuntu",
Version: "20.04",
Suites: []string{"focal"},
Components: []string{"main"},
Priority: 1,
PubKeys: []*packet.PublicKey{testKey.PubKey},
Maintained: false,
OldRelease: true,
},
},
Packages: map[string]*setup.Package{
"mypkg": {
Name: "mypkg",
Path: "slices/mydir/mypkg.yaml",
Slices: map[string]*setup.Slice{},
},
},
Maintenance: &setup.Maintenance{
Standard: time.Date(2001, time.February, 3, 0, 0, 0, 0, time.UTC),
EndOfLife: time.Date(2010, time.November, 12, 0, 0, 0, 0, time.UTC),
},
},
}, {
summary: "Cycles are detected within packages",
input: map[string]string{
Expand Down
2 changes: 1 addition & 1 deletion internal/setup/yaml.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ func parseRelease(baseDir, filePath string, data []byte) (*Release, error) {
// negative priorities to all but the default one, which means all
// others will be ignored unless pinned.
var archiveNames []string
for archiveName := range yamlArchives {
for archiveName := range release.Archives {
archiveNames = append(archiveNames, archiveName)
}
// Make it deterministic.
Expand Down
Loading