Skip to content

Commit

Permalink
Merge pull request #78 from kubescape/fixrelevant
Browse files Browse the repository at this point in the history
add test with real relevant sbom
  • Loading branch information
matthyx committed Mar 31, 2023
2 parents cac23c9 + 8117787 commit 134db93
Show file tree
Hide file tree
Showing 21 changed files with 127,797 additions and 238 deletions.
2 changes: 1 addition & 1 deletion adapters/mocksbom.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (m MockSBOMAdapter) CreateSBOM(ctx context.Context, imageID string, _ domai
ID: imageID,
SBOMCreatorVersion: m.Version(),
Annotations: map[string]string{
instanceidhandler.ImageTagAnnotationKey: imageID,
instanceidhandler.ImageTagMetadataKey: imageID,
},
Labels: tools.LabelsFromImageID(imageID),
Content: &v1beta1.Document{
Expand Down
12 changes: 7 additions & 5 deletions adapters/v1/armo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ import (
"io"
"net/http"
"os"
"reflect"
"testing"
"time"

"github.com/anchore/grype/grype/presenter/models"
"github.com/armosec/armoapi-go/armotypes"
"github.com/armosec/utils-go/httputils"
"github.com/armosec/utils-k8s-go/armometadata"
"github.com/go-test/deep"
"github.com/google/uuid"
"github.com/kubescape/kubevuln/core/domain"
"github.com/kubescape/kubevuln/internal/tools"
Expand Down Expand Up @@ -74,8 +74,9 @@ func TestArmoAdapter_GetCVEExceptions(t *testing.T) {
t.Errorf("GetCVEExceptions() error = %v, wantErr %v", err, tt.wantErr)
return
}
if !reflect.DeepEqual(got, tt.want) {
t.Errorf("GetCVEExceptions() got = %v, want %v", got, tt.want)
diff := deep.Equal(got, tt.want)
if diff != nil {
t.Errorf("compare failed: %v", diff)
}
})
}
Expand Down Expand Up @@ -160,8 +161,9 @@ func TestNewArmoAdapter(t *testing.T) {
// need to nil functions to compare
got.httpPostFunc = nil
got.getCVEExceptionsFunc = nil
if !reflect.DeepEqual(got, tt.want) {
t.Errorf("NewArmoAdapter() = %v, want %v", got, tt.want)
diff := deep.Equal(got, tt.want)
if diff != nil {
t.Errorf("compare failed: %v", diff)
}
})
}
Expand Down
Loading

0 comments on commit 134db93

Please sign in to comment.