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
12 changes: 6 additions & 6 deletions pkg/database/api-check_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func TestAPIDB_Check_NoPackages(t *testing.T) {
vulns, err := db.Check([]internal.PackageDetails{})

if err != nil {
t.Errorf("unexpected error \"%v\"", err)
t.Fatalf("unexpected error \"%v\"", err)
}

if len(vulns) > 0 {
Expand Down Expand Up @@ -297,7 +297,7 @@ func TestAPIDB_Check_FetchSuccessful(t *testing.T) {
})

if err != nil {
t.Errorf("unexpected error \"%v\"", err)
t.Fatalf("unexpected error \"%v\"", err)
}

if len(vulns) != 1 {
Expand Down Expand Up @@ -353,7 +353,7 @@ func TestAPIDB_Check_FetchFails(t *testing.T) {
})

if err != nil {
t.Errorf("unexpected error \"%v\"", err)
t.Fatalf("unexpected error \"%v\"", err)
}

if len(vulns) != 1 {
Expand Down Expand Up @@ -410,7 +410,7 @@ func TestAPIDB_Check_FetchMixed(t *testing.T) {
})

if err != nil {
t.Errorf("unexpected error \"%v\"", err)
t.Fatalf("unexpected error \"%v\"", err)
}

if len(vulns) != 1 {
Expand Down Expand Up @@ -452,7 +452,7 @@ func TestAPIDB_Check_WithCommit(t *testing.T) {
})

if err != nil {
t.Errorf("unexpected error \"%v\"", err)
t.Fatalf("unexpected error \"%v\"", err)
}

if len(vulns) != 1 {
Expand Down Expand Up @@ -524,7 +524,7 @@ func TestAPIDB_Check_Batches(t *testing.T) {
})

if err != nil {
t.Errorf("unexpected error \"%v\"", err)
t.Fatalf("unexpected error \"%v\"", err)
}

if requestCount != 2 {
Expand Down
5 changes: 1 addition & 4 deletions pkg/database/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,11 @@ func TestNewAPIDB_Valid(t *testing.T) {
)

if err != nil {
t.Errorf("NewAPIDB() unexpected error \"%v\"", err)
t.Fatalf("NewAPIDB() unexpected error \"%v\"", err)
}

if db == nil {
t.Fatalf("NewAPIDB() db unexpectedly nil")

// this is required currently to make the staticcheck linter
return
}

if !reflect.DeepEqual(db.BaseURL, u) {
Expand Down
4 changes: 2 additions & 2 deletions pkg/database/dir_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func TestNewDirDB(t *testing.T) {
db, err := database.NewDirDB(database.Config{URL: "file:/testdata/db"}, false)

if err != nil {
t.Errorf("unexpected error \"%v\"", err)
t.Fatalf("unexpected error \"%v\"", err)
}

expectDBToHaveOSVs(t, db, osvs)
Expand Down Expand Up @@ -85,7 +85,7 @@ func TestNewDirDB_WorkingDirectory(t *testing.T) {
db, err := database.NewDirDB(database.Config{URL: "file:/testdata/db", WorkingDirectory: "nested-1"}, false)

if err != nil {
t.Errorf("unexpected error \"%v\"", err)
t.Fatalf("unexpected error \"%v\"", err)
}

expectDBToHaveOSVs(t, db, osvs)
Expand Down
12 changes: 6 additions & 6 deletions pkg/database/zip_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func cacheWrite(t *testing.T, cache database.Cache) {
}

if err != nil {
t.Errorf("unexpected error with cache: %v", err)
t.Fatalf("unexpected error with cache: %v", err)
}
}

Expand All @@ -86,7 +86,7 @@ func cacheWriteBad(t *testing.T, url string, contents string) {
err := os.WriteFile(cachePath(url), []byte(contents), 0644)

if err != nil {
t.Errorf("unexpected error with cache: %v", err)
t.Fatalf("unexpected error with cache: %v", err)
}
}

Expand Down Expand Up @@ -179,7 +179,7 @@ func TestNewZippedDB_Offline_WithCache(t *testing.T) {
db, err := database.NewZippedDB(database.Config{URL: ts.URL}, true)

if err != nil {
t.Errorf("unexpected error \"%v\"", err)
t.Fatalf("unexpected error \"%v\"", err)
}

if db.UpdatedAt != date {
Expand Down Expand Up @@ -237,7 +237,7 @@ func TestNewZippedDB_Online_WithoutCache(t *testing.T) {
db, err := database.NewZippedDB(database.Config{URL: ts.URL}, false)

if err != nil {
t.Errorf("unexpected error \"%v\"", err)
t.Fatalf("unexpected error \"%v\"", err)
}

expectDBToHaveOSVs(t, db, osvs)
Expand Down Expand Up @@ -399,7 +399,7 @@ func TestNewZippedDB_FileChecks(t *testing.T) {
db, err := database.NewZippedDB(database.Config{URL: ts.URL}, false)

if err != nil {
t.Errorf("unexpected error \"%v\"", err)
t.Fatalf("unexpected error \"%v\"", err)
}

expectDBToHaveOSVs(t, db, osvs)
Expand All @@ -421,7 +421,7 @@ func TestNewZippedDB_WorkingDirectory(t *testing.T) {
db, err := database.NewZippedDB(database.Config{URL: ts.URL, WorkingDirectory: "reviewed"}, false)

if err != nil {
t.Errorf("unexpected error \"%v\"", err)
t.Fatalf("unexpected error \"%v\"", err)
}

expectDBToHaveOSVs(t, db, osvs)
Expand Down
Loading