@@ -110,15 +110,30 @@ func TestUpdateForCNBImage(t *testing.T) {
110
110
},
111
111
}
112
112
for _ , test := range tests {
113
- testutil .Run (t , test .description , func (t * testutil.T ) {
114
- dummyTransform := func (c * v1.Container , ic imageConfiguration ) (ContainerDebugConfiguration , string , error ) {
113
+ // Test that when a transform modifies the command-line arguments, then
114
+ // the changes are reflected to the launcher command-line
115
+ testutil .Run (t , test .description + " (args changed)" , func (t * testutil.T ) {
116
+ argsChangedTransform := func (c * v1.Container , ic imageConfiguration ) (ContainerDebugConfiguration , string , error ) {
115
117
c .Args = ic .arguments
116
118
return ContainerDebugConfiguration {}, "" , nil
117
119
}
118
-
119
120
copy := v1.Container {}
120
- _ , _ , err := updateForCNBImage (& copy , test .input , dummyTransform )
121
+ _ , _ , err := updateForCNBImage (& copy , test .input , argsChangedTransform )
121
122
t .CheckErrorAndDeepEqual (test .shouldErr , err , test .expected , copy )
122
123
})
124
+
125
+ // Test that when the arguments are left unchanged, that the container is unchanged
126
+ testutil .Run (t , test .description + " (args unchanged)" , func (t * testutil.T ) {
127
+ argsUnchangedTransform := func (c * v1.Container , ic imageConfiguration ) (ContainerDebugConfiguration , string , error ) {
128
+ return ContainerDebugConfiguration {}, "" , nil
129
+ }
130
+
131
+ copy := v1.Container {}
132
+ _ , _ , err := updateForCNBImage (& copy , test .input , argsUnchangedTransform )
133
+ t .CheckError (test .shouldErr , err )
134
+ if copy .Args != nil {
135
+ t .Errorf ("args not nil: %v" , copy .Args )
136
+ }
137
+ })
123
138
}
124
139
}
0 commit comments