diff --git a/apt_query.go b/apt_query.go index 8975b76..665933c 100644 --- a/apt_query.go +++ b/apt_query.go @@ -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) } diff --git a/apt_query_test.go b/apt_query_test.go index 65beae0..ea585d3 100644 --- a/apt_query_test.go +++ b/apt_query_test.go @@ -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) }