Skip to content

Commit

Permalink
Be more tolerant of apt-cache warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
awalsh128 committed Nov 27, 2023
1 parent 45e4578 commit 19a0253
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion apt_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
3 changes: 3 additions & 0 deletions apt_query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 19a0253

Please sign in to comment.