Add test for DefaultResourceModifierConfigMap in AllResources

Verify the --default-resource-modifier-configmap flag is wired through
VeleroOptions to the deployment args via AllResources.

Signed-off-by: Shubham Pampattiwar <spampatt@redhat.com>
This commit is contained in:
Shubham Pampattiwar
2026-08-03 13:22:09 -07:00
parent ee2c3a4cd2
commit b025fe3a9b
2 changed files with 28 additions and 2 deletions
File diff suppressed because one or more lines are too long
+26
View File
@@ -118,6 +118,32 @@ func TestAllResources(t *testing.T) {
assert.Len(t, ds, 2)
}
func TestAllResourcesWithDefaultResourceModifierConfigMap(t *testing.T) {
option := &VeleroOptions{
Namespace: "velero",
SecretData: []byte{'a'},
DefaultResourceModifierConfigMap: "default-rm",
}
list := AllResources(option)
for _, item := range list.Items {
if item.GetKind() == "Deployment" && item.GetName() == "velero" {
containers, _, _ := unstructured.NestedSlice(item.Object, "spec", "template", "spec", "containers")
args, _, _ := unstructured.NestedStringSlice(containers[0].(map[string]any), "args")
found := false
for _, arg := range args {
if arg == "--default-resource-modifier-configmap=default-rm" {
found = true
break
}
}
assert.True(t, found, "expected --default-resource-modifier-configmap=default-rm in deployment args")
return
}
}
t.Fatal("velero deployment not found in AllResources output")
}
func TestAllResourcesWithPriorityClassName(t *testing.T) {
testCases := []struct {
name string