Skip to content

Commit

Permalink
Metadata-test now includes a collection of expected labels to compare…
Browse files Browse the repository at this point in the history
… to.
  • Loading branch information
SnorreSelmer committed Sep 3, 2024
1 parent edad22d commit cde0bdc
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions pkg/resourcegenerator/resourceutils/metadata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,19 @@ func TestSetResourceLabels(t *testing.T) {
},
}

expectedLabels := map[string]string{
"app.kubernetes.io/name": "testapp",
"app.kubernetes.io/version": "latest",
"app.kubernetes.io/managed-by": "skiperator",
"skiperator.kartverket.no/controller": "application",
"application.skiperator.no/app": "testapp",
"application.skiperator.no/app-name": "testapp",
"application.skiperator.no/app-namespace": "testns",
"someLabel": "someValue",
}

SetApplicationLabels(sa, app)
assert.True(t, len(sa.GetLabels()) == 8)
assert.True(t, sa.GetLabels()["someLabel"] == "someValue")
assert.Equal(t, expectedLabels, sa.GetLabels())
// assert.True(t, sa.GetLabels()["someLabel"] == "someValue")
assert.Empty(t, sa.GetLabels()["otherLabel"])
}

0 comments on commit cde0bdc

Please sign in to comment.