Skip to content

Instantly share code, notes, and snippets.

@jwillker
Created May 8, 2022 22:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jwillker/968fcdb922ebea9a94857b8acf3f6e88 to your computer and use it in GitHub Desktop.
Save jwillker/968fcdb922ebea9a94857b8acf3f6e88 to your computer and use it in GitHub Desktop.
func assertName(t assert.TestingT, name string, deployment appsv1.Deployment) bool {
// Only assert if theres a want value to assert
// if not return true to don't fail the test
if name == "" {
return true
}
return assert.Equal(
t,
name,
deployment.Name,
"Rendered Deployment name is not the expected!",
)
}
func assertLabels(t assert.TestingT, labels map[string]string, deployment appsv1.Deployment) bool {
// Only assert if theres a want value to assert
// if not return true to don't fail the test
if labels != nil {
for k, v := range labels {
assert.Equal(
t,
v,
deployment.Labels[k],
"Rendered Deployment '%s' label is not the expected!", k,
)
}
}
return true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment