Browse code

removed tryuntil from test-cmd

Steve Kuznetsov authored on 2015/12/01 12:45:16
Showing 6 changed files
... ...
@@ -128,8 +128,6 @@ function os::cmd::try_until_text() {
128 128
 	local duration=${3:-minute}
129 129
 	local interval=${4:-0.2}
130 130
 
131
-	echo os::cmd::internal::run_until_text "${cmd}" "${text}" "${duration}" "${interval}"
132
-
133 131
 	os::cmd::internal::run_until_text "${cmd}" "${text}" "${duration}" "${interval}"
134 132
 }
135 133
 
... ...
@@ -31,9 +31,9 @@ os::cmd::expect_success 'oc delete pods hello-openshift'
31 31
 echo "pods: ok"
32 32
 
33 33
 os::cmd::expect_success_and_text 'oc create -f examples/hello-openshift/hello-pod.json -o name' 'pod/hello-openshift'
34
-os::cmd::expect_success "tryuntil 'oc label pod/hello-openshift acustom=label'" # can race against scheduling and status updates
34
+os::cmd::try_until_success 'oc label pod/hello-openshift acustom=label' # can race against scheduling and status updates
35 35
 os::cmd::expect_success_and_text 'oc describe pod/hello-openshift' 'acustom=label'
36
-os::cmd::expect_success "tryuntil 'oc annotate pod/hello-openshift foo=bar'" # can race against scheduling and status updates
36
+os::cmd::try_until_success 'oc annotate pod/hello-openshift foo=bar' # can race against scheduling and status updates
37 37
 os::cmd::expect_success_and_text 'oc get -o yaml pod/hello-openshift' 'foo: bar'
38 38
 os::cmd::expect_success 'oc delete pods -l acustom=label'
39 39
 os::cmd::expect_failure 'oc get pod/hello-openshift'
... ...
@@ -73,11 +73,11 @@ os::cmd::expect_success 'oc get bc'
73 73
 os::cmd::expect_success 'oc get builds'
74 74
 
75 75
 # make sure the imagestream has the latest tag before starting a build or the build will immediately fail.
76
-os::cmd::expect_success "tryuntil 'oc get is ruby-22-centos7 | grep latest'"
76
+os::cmd::try_until_text 'oc get is ruby-22-centos7' 'latest'
77 77
 
78 78
 REAL_OUTPUT_TO=$(oc get bc/ruby-sample-build --template='{{ .spec.output.to.name }}')
79 79
 os::cmd::expect_success "oc patch bc/ruby-sample-build -p '{\"spec\":{\"output\":{\"to\":{\"name\":\"different:tag1\"}}}}'"
80
-os::cmd::expect_success "oc get bc/ruby-sample-build --template='{{ .spec.output.to.name }}' | grep 'different'"
80
+os::cmd::expect_success_and_text "oc get bc/ruby-sample-build --template='{{ .spec.output.to.name }}'" 'different'
81 81
 os::cmd::expect_success "oc patch bc/ruby-sample-build -p '{\"spec\":{\"output\":{\"to\":{\"name\":\"${REAL_OUTPUT_TO}\"}}}}'"
82 82
 echo "patchAnonFields: ok"
83 83
 
... ...
@@ -103,21 +103,13 @@ frombuild=$(oc start-build --from-build="${started}")
103 103
 os::cmd::expect_success_and_text "oc describe build ${frombuild}" 'centos/ruby-22-centos7$'
104 104
 echo "start-build: ok"
105 105
 
106
-os::cmd::expect_success "oc cancel-build ${started} --dump-logs --restart | grep 'Restarted build ${started}.'"
106
+os::cmd::expect_success_and_text "oc cancel-build ${started} --dump-logs --restart" "Restarted build ${started}."
107 107
 os::cmd::expect_success 'oc delete all --all'
108 108
 os::cmd::expect_success 'oc process -f examples/sample-app/application-template-dockerbuild.json -l build=docker | oc create -f -'
109
-os::cmd::expect_success "tryuntil 'oc get build/ruby-sample-build-1'"
109
+os::cmd::try_until_success 'oc get build/ruby-sample-build-1'
110 110
 # Uses type/name resource syntax to cancel the build and check for proper message
111
-os::cmd::expect_success "oc cancel-build build/ruby-sample-build-1 | grep 'Build ruby-sample-build-1 was cancelled.'"
111
+os::cmd::expect_success_and_text 'oc cancel-build build/ruby-sample-build-1' 'Build ruby-sample-build-1 was cancelled.'
112 112
 # Make sure canceling already cancelled build returns proper message
113
-os::cmd::expect_success "tryuntil $(oc cancel-build build/ruby-sample-build-1 | grep 'A cancellation event was already triggered for the build build/ruby-sample-build-1.')"
114
-os::cmd::expect_success 'oc delete all --all'
115
-
116
-# Make sure failed build returns proper message when cancelled
117
-os::cmd::expect_success 'oc create -f test/fixtures/failing-bc.json'
118
-os::cmd::expect_success "tryuntil 'oc get bc failing-build'"
119
-os::cmd::expect_success 'oc start-build failing-build'
120
-os::cmd::expect_success "tryuntil $(oc get build failing-build-1 | grep Failed)"
121
-os::cmd::expect_success "tryuntil $(oc cancel-build build/failing-build-1 | grep 'A build can be cancelled only if it has new/pending/running status.')"
113
+os::cmd::try_until_text 'oc cancel-build build/ruby-sample-build-1' 'A cancellation event was already triggered for the build ruby-sample-build-1.'
122 114
 os::cmd::expect_success 'oc delete all --all'
123 115
 echo "cancel-build: ok"
... ...
@@ -68,7 +68,7 @@ sleep 1
68 68
 os::cmd::expect_success 'oc delete all --all'
69 69
 
70 70
 os::cmd::expect_success 'oc process -f examples/sample-app/application-template-dockerbuild.json -l app=dockerbuild | oc create -f -'
71
-tryuntil "os::cmd::expect_success 'oc get rc/database-1'"
71
+os::cmd::try_until_success 'oc get rc/database-1'
72 72
 
73 73
 os::cmd::expect_success 'oc rollback database --to-version=1 -o=yaml'
74 74
 os::cmd::expect_success 'oc rollback dc/database --to-version=1 -o=yaml'
... ...
@@ -18,13 +18,13 @@ os::cmd::expect_failure 'oc new-app unknownhubimage -o yaml'
18 18
 # verify we can generate a Docker image based component "mongodb" directly
19 19
 os::cmd::expect_success_and_text 'oc new-app mongo -o yaml' 'library/mongo'
20 20
 # the local image repository takes precedence over the Docker Hub "mysql" image
21
-os::cmd::expect_success "tryuntil 'oc get imagestreamtags mysql:latest'"
22
-os::cmd::expect_success "tryuntil 'oc get imagestreamtags mysql:5.5'"
23
-os::cmd::expect_success "tryuntil 'oc get imagestreamtags mysql:5.6'"
21
+os::cmd::try_until_success 'oc get imagestreamtags mysql:latest'
22
+os::cmd::try_until_success 'oc get imagestreamtags mysql:5.5'
23
+os::cmd::try_until_success 'oc get imagestreamtags mysql:5.6'
24 24
 os::cmd::expect_success_and_text 'oc new-app mysql -o yaml' 'mysql'
25
-os::cmd::expect_success "tryuntil 'oc get imagestreamtags php:latest'"
26
-os::cmd::expect_success "tryuntil 'oc get imagestreamtags php:5.5'"
27
-os::cmd::expect_success "tryuntil 'oc get imagestreamtags php:5.6'"
25
+os::cmd::try_until_success 'oc get imagestreamtags php:latest'
26
+os::cmd::try_until_success 'oc get imagestreamtags php:5.5'
27
+os::cmd::try_until_success 'oc get imagestreamtags php:5.6'
28 28
 
29 29
 # check label creation
30 30
 os::cmd::expect_success 'oc new-app php mysql -l no-source=php-mysql'
... ...
@@ -58,32 +58,32 @@ os::cmd::expect_failure 'oc new-app -S --template=nodejs'
58 58
 os::cmd::expect_failure 'oc new-app -S --template=perl'
59 59
 # check search - filtered, exact matches
60 60
 # make sure the imagestreams are imported first.
61
-os::cmd::expect_success "tryuntil 'oc get imagestreamtags mongodb:latest'"
62
-os::cmd::expect_success "tryuntil 'oc get imagestreamtags mongodb:2.4'"
63
-os::cmd::expect_success "tryuntil 'oc get imagestreamtags mongodb:2.6'"
64
-os::cmd::expect_success "tryuntil 'oc get imagestreamtags mysql:latest'"
65
-os::cmd::expect_success "tryuntil 'oc get imagestreamtags mysql:5.5'"
66
-os::cmd::expect_success "tryuntil 'oc get imagestreamtags mysql:5.6'"
67
-os::cmd::expect_success "tryuntil 'oc get imagestreamtags nodejs:latest'"
68
-os::cmd::expect_success "tryuntil 'oc get imagestreamtags nodejs:0.10'"
69
-os::cmd::expect_success "tryuntil 'oc get imagestreamtags perl:latest'"
70
-os::cmd::expect_success "tryuntil 'oc get imagestreamtags perl:5.16'"
71
-os::cmd::expect_success "tryuntil 'oc get imagestreamtags perl:5.20'"
72
-os::cmd::expect_success "tryuntil 'oc get imagestreamtags php:latest'"
73
-os::cmd::expect_success "tryuntil 'oc get imagestreamtags php:5.5'"
74
-os::cmd::expect_success "tryuntil 'oc get imagestreamtags php:5.6'"
75
-os::cmd::expect_success "tryuntil 'oc get imagestreamtags postgresql:latest'"
76
-os::cmd::expect_success "tryuntil 'oc get imagestreamtags postgresql:9.2'"
77
-os::cmd::expect_success "tryuntil 'oc get imagestreamtags postgresql:9.4'"
78
-os::cmd::expect_success "tryuntil 'oc get imagestreamtags python:latest'"
79
-os::cmd::expect_success "tryuntil 'oc get imagestreamtags python:2.7'"
80
-os::cmd::expect_success "tryuntil 'oc get imagestreamtags python:3.3'"
81
-os::cmd::expect_success "tryuntil 'oc get imagestreamtags python:3.4'"
82
-os::cmd::expect_success "tryuntil 'oc get imagestreamtags ruby:latest'"
83
-os::cmd::expect_success "tryuntil 'oc get imagestreamtags ruby:2.0'"
84
-os::cmd::expect_success "tryuntil 'oc get imagestreamtags ruby:2.2'"
85
-os::cmd::expect_success "tryuntil 'oc get imagestreamtags wildfly:latest'"
86
-os::cmd::expect_success "tryuntil 'oc get imagestreamtags wildfly:8.1'"
61
+os::cmd::try_until_success 'oc get imagestreamtags mongodb:latest'
62
+os::cmd::try_until_success 'oc get imagestreamtags mongodb:2.4'
63
+os::cmd::try_until_success 'oc get imagestreamtags mongodb:2.6'
64
+os::cmd::try_until_success 'oc get imagestreamtags mysql:latest'
65
+os::cmd::try_until_success 'oc get imagestreamtags mysql:5.5'
66
+os::cmd::try_until_success 'oc get imagestreamtags mysql:5.6'
67
+os::cmd::try_until_success 'oc get imagestreamtags nodejs:latest'
68
+os::cmd::try_until_success 'oc get imagestreamtags nodejs:0.10'
69
+os::cmd::try_until_success 'oc get imagestreamtags perl:latest'
70
+os::cmd::try_until_success 'oc get imagestreamtags perl:5.16'
71
+os::cmd::try_until_success 'oc get imagestreamtags perl:5.20'
72
+os::cmd::try_until_success 'oc get imagestreamtags php:latest'
73
+os::cmd::try_until_success 'oc get imagestreamtags php:5.5'
74
+os::cmd::try_until_success 'oc get imagestreamtags php:5.6'
75
+os::cmd::try_until_success 'oc get imagestreamtags postgresql:latest'
76
+os::cmd::try_until_success 'oc get imagestreamtags postgresql:9.2'
77
+os::cmd::try_until_success 'oc get imagestreamtags postgresql:9.4'
78
+os::cmd::try_until_success 'oc get imagestreamtags python:latest'
79
+os::cmd::try_until_success 'oc get imagestreamtags python:2.7'
80
+os::cmd::try_until_success 'oc get imagestreamtags python:3.3'
81
+os::cmd::try_until_success 'oc get imagestreamtags python:3.4'
82
+os::cmd::try_until_success 'oc get imagestreamtags ruby:latest'
83
+os::cmd::try_until_success 'oc get imagestreamtags ruby:2.0'
84
+os::cmd::try_until_success 'oc get imagestreamtags ruby:2.2'
85
+os::cmd::try_until_success 'oc get imagestreamtags wildfly:latest'
86
+os::cmd::try_until_success 'oc get imagestreamtags wildfly:8.1'
87 87
 
88 88
 os::cmd::expect_success_and_text 'oc new-app --search --image-stream=mongodb' "Tags:\s+2.4, 2.6, latest"
89 89
 os::cmd::expect_success_and_text 'oc new-app --search --image-stream=mysql' "Tags:\s+5.5, 5.6, latest"
... ...
@@ -139,11 +139,11 @@ os::cmd::expect_success 'oc create -f test/fixtures/installable-stream.yaml'
139 139
 project=$(oc project -q)
140 140
 os::cmd::expect_success 'oc policy add-role-to-user edit test-user'
141 141
 os::cmd::expect_success 'oc login -u test-user -p anything'
142
-os::cmd::expect_success "tryuntil 'oc project ${project}'"
142
+os::cmd::try_until_success 'oc project ${project}'
143 143
 
144
-os::cmd::expect_success "tryuntil 'oc get imagestreamtags installable:file'"
145
-os::cmd::expect_success "tryuntil 'oc get imagestreamtags installable:token'"
146
-os::cmd::expect_success "tryuntil 'oc get imagestreamtags installable:serviceaccount'"
144
+os::cmd::try_until_success 'oc get imagestreamtags installable:file'
145
+os::cmd::try_until_success 'oc get imagestreamtags installable:token'
146
+os::cmd::try_until_success 'oc get imagestreamtags installable:serviceaccount'
147 147
 os::cmd::expect_failure 'oc new-app installable:file'
148 148
 os::cmd::expect_failure_and_text 'oc new-app installable:file' 'requires that you grant the image access'
149 149
 os::cmd::expect_failure_and_text 'oc new-app installable:serviceaccount' "requires an 'installer' service account with project editor access"
... ...
@@ -10,9 +10,9 @@ source "${OS_ROOT}/hack/cmd_util.sh"
10 10
 os::log::install_errexit
11 11
 
12 12
 # This test validates secret interaction
13
-[ "$(oc secrets new foo --type=blah makefile=Makefile 2>&1 | grep 'error: unknown secret type "blah"')" ]
14
-oc secrets new foo --type=blah makefile=Makefile --confirm
15
-oc get secrets/foo -o jsonpath={.type} | grep 'blah'
13
+os::cmd::expect_failure_and_text 'oc secrets new foo --type=blah makefile=Makefile' 'error: unknown secret type "blah"'
14
+os::cmd::expect_success 'oc secrets new foo --type=blah makefile=Makefile --confirm'
15
+os::cmd::expect_success_and_text 'oc get secrets/foo -o jsonpath={.type}' 'blah'
16 16
 
17 17
 os::cmd::expect_success 'oc secrets new-dockercfg dockercfg --docker-username=sample-user --docker-password=sample-password --docker-email=fake@example.org'
18 18
 # can't use a go template here because the output needs to be base64 decoded.  base64 isn't installed by default in all distros