Be more tolerant of apt-cache warnings.

This commit is contained in:
Andrew Walsh 2023-11-26 21:08:43 -08:00
parent 45e4578f79
commit 19a0253e65
2 changed files with 4 additions and 1 deletions

View file

@ -65,7 +65,7 @@ func getPackages(names []string) AptPackages {
pkg.Name = strings.TrimSpace(strings.Split(line, ":")[1])
} else if strings.HasPrefix(line, "Version: ") {
pkg.Version = strings.TrimSpace(strings.Split(line, ":")[1])
} else if strings.HasPrefix(line, "N: ") || strings.HasPrefix(line, "E: ") {
} else if strings.HasPrefix(line, "N: Unable to locate package ") || strings.HasPrefix(line, "E: ") {
if !contains(errorMessages, line) {
errorMessages = append(errorMessages, line)
}

View file

@ -28,6 +28,9 @@ func (r *RunResult) expectSuccessfulOut(expected string) {
r.TestContext.Errorf("Error running command: %v", r.Err)
return
}
if r.Stderr != "" {
r.TestContext.Errorf("Unexpected stderr messages found.\nExpected: none\nActual:\n'%s'", r.Stderr)
}
if r.Stdout != expected+"\n" { // Output will always have a end of output newline.
r.TestContext.Errorf("Unexpected stdout found.\nExpected:\n'%s'\nActual:\n'%s'", expected, r.Stdout)
}