Skip to content

Commit

Permalink
correct assert.Equal parameters order in tests
Browse files Browse the repository at this point in the history
Signed-off-by: Matthias Bertschy <matthias.bertschy@gmail.com>
  • Loading branch information
matthyx committed Jun 9, 2023
1 parent 3d8a23f commit 4a8646c
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions adapters/mockcve_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

func TestMockCVEAdapter_DBVersion(t *testing.T) {
m := NewMockCVEAdapter()
assert.Equal(t, m.DBVersion(context.TODO()), "v1.0.0")
assert.Equal(t, "v1.0.0", m.DBVersion(context.TODO()))
}

func TestMockCVEAdapter_Ready(t *testing.T) {
Expand All @@ -26,5 +26,5 @@ func TestMockCVEAdapter_ScanSBOM(t *testing.T) {

func TestMockCVEAdapter_Version(t *testing.T) {
m := NewMockCVEAdapter()
assert.Equal(t, m.Version(context.TODO()), "Mock CVE 1.0")
assert.Equal(t, "Mock CVE 1.0", m.Version(context.TODO()))
}
4 changes: 2 additions & 2 deletions adapters/mocksbom_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ func TestMockSBOMAdapter_CreateSBOM_Error(t *testing.T) {
func TestMockSBOMAdapter_CreateSBOM_Timeout(t *testing.T) {
m := NewMockSBOMAdapter(false, true, false)
sbom, _ := m.CreateSBOM(context.TODO(), "name", "image", domain.RegistryOptions{})
assert.Equal(t, sbom.Status, instanceidhandler.Incomplete)
assert.Equal(t, instanceidhandler.Incomplete, sbom.Status)
}

func TestMockSBOMAdapter_Version(t *testing.T) {
m := NewMockSBOMAdapter(false, false, false)
assert.Equal(t, m.Version(), "Mock SBOM 1.0")
assert.Equal(t, "Mock SBOM 1.0", m.Version())
}
2 changes: 1 addition & 1 deletion adapters/v1/armo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func TestArmoAdapter_GetCVEExceptions(t *testing.T) {
t.Errorf("GetCVEExceptions() error = %v, wantErr %v", err, tt.wantErr)
return
}
assert.Equal(t, got, tt.want)
assert.Equal(t, tt.want, got)
})
}
}
Expand Down
4 changes: 2 additions & 2 deletions adapters/v1/armo_utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ func TestGetCVEExceptionMatchCVENameFromList(t *testing.T) {
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
actual := getCVEExceptionMatchCVENameFromList(tc.srcCVEList, tc.CVEName, tc.isFixed)
assert.Equal(t, actual, tc.expected)
assert.Equal(t, tc.expected, actual)
})
}
}
Expand Down Expand Up @@ -501,7 +501,7 @@ func Test_summarize(t *testing.T) {
sort.Slice(got.SeveritiesStats, func(i, j int) bool {
return got.SeveritiesStats[i].Severity < got.SeveritiesStats[j].Severity
})
assert.Equal(t, got, tt.want)
assert.Equal(t, tt.want, got)
})
}
}
4 changes: 2 additions & 2 deletions adapters/v1/domain_to_armo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func Test_domainToArmo(t *testing.T) {
}
got[0].ContainerScanID = ""
got[0].Timestamp = 0
assert.Equal(t, got, tt.want)
assert.Equal(t, tt.want, got)
})
}
}
Expand Down Expand Up @@ -162,7 +162,7 @@ func Test_parseLayersPayload(t *testing.T) {
t.Errorf("parseLayersPayload() error = %v, wantErr %v", err, tt.wantErr)
return
}
assert.Equal(t, got, tt.want)
assert.Equal(t, tt.want, got)
})
}
}
2 changes: 1 addition & 1 deletion adapters/v1/domain_to_syft_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func Test_domainToSpdx(t *testing.T) {
t.Errorf("domainToSpdx() error = %v, wantErr %v", err, tt.wantErr)
return
}
assert.Equal(t, got, tt.want)
assert.Equal(t, tt.want, got)
})
}
}
2 changes: 1 addition & 1 deletion adapters/v1/grype_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func Test_grypeAdapter_DBVersion(t *testing.T) {
g := NewGrypeAdapterFixedDB()
g.Ready(ctx) // need to call ready to load the DB
version := g.DBVersion(ctx)
assert.Equal(t, version, "sha256:9be2df3d7d657bfb40ddcc68c9d00520ee7f5a34c7a26333f90cf89cefd5668a")
assert.Equal(t, "sha256:9be2df3d7d657bfb40ddcc68c9d00520ee7f5a34c7a26333f90cf89cefd5668a", version)
}

func fileToSBOM(path string) *v1beta1.Document {
Expand Down
2 changes: 1 addition & 1 deletion adapters/v1/grype_to_domain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func Test_grypeToDomain(t *testing.T) {
t.Errorf("grypeToDomain() error = %v, wantErr %v", err, tt.wantErr)
return
}
assert.Equal(t, got, tt.want)
assert.Equal(t, tt.want, got)
})
}
}
2 changes: 1 addition & 1 deletion adapters/v1/syft_to_domain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func TestSyftAdapter_spdxToDomain(t *testing.T) {
t.Errorf("spdxToDomain() error = %v, wantErr %v", err, tt.wantErr)
return
}
assert.Equal(t, got, tt.want)
assert.Equal(t, tt.want, got)
})
}
}
4 changes: 2 additions & 2 deletions core/services/mockscan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func TestMockScanService_ValidateGenerateSBOM(t *testing.T) {
t.Errorf("ValidateGenerateSBOM() error = %v, wantErr %v", err, tt.wantErr)
return
}
assert.Equal(t, got, tt.want)
assert.Equal(t, tt.want, got)
})
}
}
Expand Down Expand Up @@ -183,7 +183,7 @@ func TestMockScanService_ValidateScanCVE(t *testing.T) {
t.Errorf("ValidateScanCVE() error = %v, wantErr %v", err, tt.wantErr)
return
}
assert.Equal(t, got, tt.want)
assert.Equal(t, tt.want, got)
})
}
}

0 comments on commit 4a8646c

Please sign in to comment.