File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ import (
3535 "k8s.io/apimachinery/pkg/runtime/schema"
3636 "k8s.io/client-go/rest"
3737 "k8s.io/client-go/tools/remotecommand"
38+ "k8s.io/utils/ptr"
3839
3940 v1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1"
4041 velerotest "github.com/vmware-tanzu/velero/pkg/test"
@@ -253,6 +254,15 @@ func TestEnsureContainerExists(t *testing.T) {
253254 Name : "foo" ,
254255 },
255256 },
257+ InitContainers : []corev1api.Container {
258+ {
259+ Name : "baz" ,
260+ },
261+ {
262+ Name : "qux" ,
263+ RestartPolicy : ptr .To (corev1api .ContainerRestartPolicyAlways ),
264+ },
265+ },
256266 },
257267 }
258268
@@ -261,6 +271,12 @@ func TestEnsureContainerExists(t *testing.T) {
261271
262272 err = ensureContainerExists (pod , "foo" )
263273 assert .NoError (t , err )
274+
275+ err = ensureContainerExists (pod , "baz" )
276+ require .EqualError (t , err , `no such container: "baz"` )
277+
278+ err = ensureContainerExists (pod , "qux" )
279+ assert .NoError (t , err )
264280}
265281
266282func TestPodCompeted (t * testing.T ) {
You can’t perform that action at this time.
0 commit comments