Browse code

Print line of error

Clayton Coleman authored on 2015/08/22 05:14:11
Showing 13 changed files
... ...
@@ -107,6 +107,12 @@ function test_privileges {
107 107
   set -e
108 108
 }
109 109
 
110
+# tryuntil loops up to 60 seconds to redo this action
111
+function tryuntil {
112
+  timeout=$(($(date +%s) + 60))
113
+  until eval "${@}" || [[ $(date +%s) -gt $timeout ]]; do :; done
114
+}
115
+
110 116
 # wait_for_command executes a command and waits for it to
111 117
 # complete or times out after max_wait.
112 118
 #
... ...
@@ -4,10 +4,9 @@ set -o errexit
4 4
 set -o nounset
5 5
 set -o pipefail
6 6
 
7
-function tryuntil {
8
-  timeout=$(($(date +%s) + 60))
9
-  until eval "${@}" || [[ $(date +%s) -gt $timeout ]]; do :; done
10
-}
7
+OS_ROOT=$(dirname "${BASH_SOURCE}")/../..
8
+source "${OS_ROOT}/hack/util.sh"
9
+os::log::install_errexit
11 10
 
12 11
 # Cleanup cluster resources created by this test
13 12
 (
... ...
@@ -4,6 +4,10 @@ set -o errexit
4 4
 set -o nounset
5 5
 set -o pipefail
6 6
 
7
+OS_ROOT=$(dirname "${BASH_SOURCE}")/../..
8
+source "${OS_ROOT}/hack/util.sh"
9
+os::log::install_errexit
10
+
7 11
 # This test validates basic resource retrieval and command interaction
8 12
 
9 13
 # Test resource builder filtering of files with expected extensions inside directories, and individual files without expected extensions
... ...
@@ -23,7 +27,7 @@ oc delete pods hello-openshift
23 23
 echo "pods: ok"
24 24
 
25 25
 oc create -f examples/hello-openshift/hello-pod.json
26
-oc label pod/hello-openshift acustom=label
26
+tryuntil oc label pod/hello-openshift acustom=label # can race against scheduling and status updates
27 27
 [ "$(oc describe pod/hello-openshift | grep 'acustom=label')" ]
28 28
 oc delete pods -l acustom=label
29 29
 [ ! "$(oc get pod/hello-openshift)" ]
... ...
@@ -4,6 +4,10 @@ set -o errexit
4 4
 set -o nounset
5 5
 set -o pipefail
6 6
 
7
+OS_ROOT=$(dirname "${BASH_SOURCE}")/../..
8
+source "${OS_ROOT}/hack/util.sh"
9
+os::log::install_errexit
10
+
7 11
 url=":${API_PORT:-8443}"
8 12
 project="$(oc project -q)"
9 13
 
... ...
@@ -4,10 +4,9 @@ set -o errexit
4 4
 set -o nounset
5 5
 set -o pipefail
6 6
 
7
-function tryuntil {
8
-  timeout=$(($(date +%s) + 60))
9
-  until eval "${@}" || [[ $(date +%s) -gt $timeout ]]; do :; done
10
-}
7
+OS_ROOT=$(dirname "${BASH_SOURCE}")/../..
8
+source "${OS_ROOT}/hack/util.sh"
9
+os::log::install_errexit
11 10
 
12 11
 # This test validates deployments
13 12
 
... ...
@@ -4,6 +4,10 @@ set -o errexit
4 4
 set -o nounset
5 5
 set -o pipefail
6 6
 
7
+OS_ROOT=$(dirname "${BASH_SOURCE}")/../..
8
+source "${OS_ROOT}/hack/util.sh"
9
+os::log::install_errexit
10
+
7 11
 # This test validates the edit command
8 12
 
9 13
 oc create -f examples/hello-openshift/hello-pod.json
... ...
@@ -4,6 +4,10 @@ set -o errexit
4 4
 set -o nounset
5 5
 set -o pipefail
6 6
 
7
+OS_ROOT=$(dirname "${BASH_SOURCE}")/../..
8
+source "${OS_ROOT}/hack/util.sh"
9
+os::log::install_errexit
10
+
7 11
 # This test validates the export command
8 12
 
9 13
 oc new-app -f examples/sample-app/application-template-stibuild.json --name=sample
... ...
@@ -4,6 +4,10 @@ set -o errexit
4 4
 set -o nounset
5 5
 set -o pipefail
6 6
 
7
+OS_ROOT=$(dirname "${BASH_SOURCE}")/../..
8
+source "${OS_ROOT}/hack/util.sh"
9
+os::log::install_errexit
10
+
7 11
 # This test validates the help commands and output text
8 12
 
9 13
 # verify some default commands
... ...
@@ -4,10 +4,9 @@ set -o errexit
4 4
 set -o nounset
5 5
 set -o pipefail
6 6
 
7
-function tryuntil {
8
-  timeout=$(($(date +%s) + 60))
9
-  until eval "${@}" || [[ $(date +%s) -gt $timeout ]]; do :; done
10
-}
7
+OS_ROOT=$(dirname "${BASH_SOURCE}")/../..
8
+source "${OS_ROOT}/hack/util.sh"
9
+os::log::install_errexit
11 10
 
12 11
 # Cleanup cluster resources created by this test
13 12
 (
... ...
@@ -4,10 +4,9 @@ set -o errexit
4 4
 set -o nounset
5 5
 set -o pipefail
6 6
 
7
-function tryuntil {
8
-  timeout=$(($(date +%s) + 60))
9
-  until eval "${@}" || [[ $(date +%s) -gt $timeout ]]; do :; done
10
-}
7
+OS_ROOT=$(dirname "${BASH_SOURCE}")/../..
8
+source "${OS_ROOT}/hack/util.sh"
9
+os::log::install_errexit
11 10
 
12 11
 # This test validates the new-app command
13 12
 
... ...
@@ -4,6 +4,10 @@ set -o errexit
4 4
 set -o nounset
5 5
 set -o pipefail
6 6
 
7
+OS_ROOT=$(dirname "${BASH_SOURCE}")/../..
8
+source "${OS_ROOT}/hack/util.sh"
9
+os::log::install_errexit
10
+
7 11
 # This test validates user level policy
8 12
 
9 13
 oc policy add-role-to-group cluster-admin system:unauthenticated
... ...
@@ -4,6 +4,10 @@ set -o errexit
4 4
 set -o nounset
5 5
 set -o pipefail
6 6
 
7
+OS_ROOT=$(dirname "${BASH_SOURCE}")/../..
8
+source "${OS_ROOT}/hack/util.sh"
9
+os::log::install_errexit
10
+
7 11
 # This test validates secret interaction
8 12
 
9 13
 oc secrets new-dockercfg dockercfg --docker-username=sample-user --docker-password=sample-password --docker-email=fake@example.org
... ...
@@ -4,6 +4,10 @@ set -o errexit
4 4
 set -o nounset
5 5
 set -o pipefail
6 6
 
7
+OS_ROOT=$(dirname "${BASH_SOURCE}")/../..
8
+source "${OS_ROOT}/hack/util.sh"
9
+os::log::install_errexit
10
+
7 11
 # This test validates template commands
8 12
 
9 13
 oc get templates