@@ -33,6 +33,45 @@ os::cmd::expect_success_and_not_text "oc debug -f examples/hello-openshift/hello
33
33
os::cmd::expect_success_and_not_text " oc debug -f examples/hello-openshift/hello-pod.json -o yaml -- /bin/env" ' tty'
34
34
# TODO: write a test that emulates a TTY to verify the correct defaulting of what the pod is created
35
35
36
+ # Ensure debug does not depend on a container actually existing for the selected resource.
37
+ # The command should not hang waiting for an attachable pod. Timeout each cmd after 10s.
38
+ os::cmd::expect_success ' oc create -f test/integration/testdata/test-replication-controller.yaml'
39
+ os::cmd::expect_success ' oc scale --replicas=0 rc/test-replication-controller'
40
+ os::cmd::expect_success_and_text " oc debug --request-timeout=10s -c ruby-helloworld --one-container rc/test-replication-controller -o jsonpath='{.metadata.name}'" ' test-replication-controller-debug'
41
+
42
+ os::cmd::expect_success ' oc scale --replicas=0 dc/test-deployment-config'
43
+ os::cmd::expect_success_and_text " oc debug --request-timeout=10s -c ruby-helloworld --one-container dc/test-deployment-config -o jsonpath='{.metadata.name}'" ' test-deployment-config'
44
+
45
+ os::cmd::expect_success ' oc create -f - >> cat << __EOF__
46
+ apiVersion: extensions/v1beta1
47
+ kind: Deployment
48
+ metadata:
49
+ name: test-deployment
50
+ labels:
51
+ deployment: test-deployment
52
+ spec:
53
+ replicas: 0
54
+ selector:
55
+ matchLabels:
56
+ deployment: test-deployment
57
+ template:
58
+ metadata:
59
+ labels:
60
+ deployment: test-deployment
61
+ name: test-deployment
62
+ spec:
63
+ containers:
64
+ - name: ruby-helloworld
65
+ image: openshift/origin-pod
66
+ imagePullPolicy: IfNotPresent
67
+ resources: {}
68
+ status: {}
69
+ __EOF__'
70
+ os::cmd::expect_success_and_text " oc debug --request-timeout=10s -c ruby-helloworld --one-container deploy/test-deployment -o jsonpath='{.metadata.name}'" ' test-deployment-debug'
71
+
72
+ # re-scale existing resources
73
+ os::cmd::expect_success ' oc scale --replicas=1 dc/test-deployment-config'
74
+
36
75
os::cmd::expect_success ' oc create -f examples/image-streams/image-streams-centos7.json'
37
76
os::cmd::try_until_success ' oc get imagestreamtags wildfly:latest'
38
77
os::cmd::expect_success_and_text " oc debug istag/wildfly:latest -o yaml" ' image: openshift/wildfly-101-centos7'
0 commit comments