Skip to content

Commit

Permalink
add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
dbw7 committed May 20, 2024
1 parent 3358e20 commit c4e63e2
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions pkg/registry/manifests_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,29 @@ func TestStoreManifestImages(t *testing.T) {
assert.ElementsMatch(t, expectedImages, allImages)
}

func TestStoreManifestImages_InvalidKinds(t *testing.T) {
// Setup
var extractedImagesSet = make(map[string]bool)
manifestData := map[string]any{
"apiVersion": "apps/v1",
"kind": "InvalidKind",
"spec": map[string]any{
"containers": []any{
map[string]any{
"name": "nginx",
"image": "nginx:1.14.2",
},
},
},
}

// Test
storeManifestImages(manifestData, extractedImagesSet)

// Verify
assert.Equal(t, map[string]bool{}, extractedImagesSet)
}

func TestStoreManifestImages_EmptyManifest(t *testing.T) {
// Setup
var extractedImagesSet = make(map[string]bool)
Expand Down

0 comments on commit c4e63e2

Please sign in to comment.