| ... | ... |
@@ -231,8 +231,8 @@ function os::cmd::internal::describe_call() {
|
| 231 | 231 |
echo "${full_name}"
|
| 232 | 232 |
} |
| 233 | 233 |
|
| 234 |
-# os::cmd::internal::determine_caller determines the file and line number of the function call to |
|
| 235 |
-# the outer os::cmd wrapper function |
|
| 234 |
+# os::cmd::internal::determine_caller determines the file relative to the OpenShift Origin root directory |
|
| 235 |
+# and line number of the function call to the outer os::cmd wrapper function |
|
| 236 | 236 |
function os::cmd::internal::determine_caller() {
|
| 237 | 237 |
local call_depth= |
| 238 | 238 |
local len_sources="${#BASH_SOURCE[@]}"
|
| ... | ... |
@@ -244,6 +244,13 @@ function os::cmd::internal::determine_caller() {
|
| 244 | 244 |
done |
| 245 | 245 |
|
| 246 | 246 |
local caller_file="${BASH_SOURCE[${call_depth}]}"
|
| 247 |
+ if which realpath >&/dev/null; then |
|
| 248 |
+ # if the caller has `realpath`, we can use it to make our file names cleaner by |
|
| 249 |
+ # trimming the absolute file path up to `...openshift/origin/` and showing only |
|
| 250 |
+ # the relative path from the Origin root directory |
|
| 251 |
+ caller_file="$( realpath "${caller_file}" )"
|
|
| 252 |
+ caller_file="${caller_file//*openshift\/origin\/}"
|
|
| 253 |
+ fi |
|
| 247 | 254 |
local caller_line="${BASH_LINENO[${call_depth}-1]}"
|
| 248 | 255 |
echo "${caller_file}:${caller_line}"
|
| 249 | 256 |
} |
| ... | ... |
@@ -137,26 +137,26 @@ echo "routes: ok" |
| 137 | 137 |
# Validate the probe command |
| 138 | 138 |
arg="-f examples/hello-openshift/hello-pod.json" |
| 139 | 139 |
os::cmd::expect_failure_and_text "oc set probe" "error: one or more resources" |
| 140 |
-os::cmd::expect_failure_and_text "oc set probe $arg" "error: you must specify one of --readiness or --liveness" |
|
| 141 |
-os::cmd::expect_success_and_text "oc set probe $arg --liveness -o yaml" 'livenessProbe: \{\}'
|
|
| 142 |
-os::cmd::expect_success_and_text "oc set probe $arg -o yaml --liveness --initial-delay-seconds=10 -o yaml" "livenessProbe:" |
|
| 143 |
-os::cmd::expect_success_and_text "oc set probe $arg -o yaml --liveness --initial-delay-seconds=10 -o yaml" "initialDelaySeconds: 10" |
|
| 144 |
-os::cmd::expect_success_and_text "oc set probe $arg -o yaml --liveness -- echo test" "livenessProbe:" |
|
| 145 |
-os::cmd::expect_success_and_text "oc set probe $arg -o yaml --readiness -- echo test" "readinessProbe:" |
|
| 146 |
-os::cmd::expect_success_and_text "oc set probe $arg -o yaml --liveness -- echo test" "exec:" |
|
| 147 |
-os::cmd::expect_success_and_text "oc set probe $arg -o yaml --liveness -- echo test" "\- echo" |
|
| 148 |
-os::cmd::expect_success_and_text "oc set probe $arg -o yaml --liveness -- echo test" "\- test" |
|
| 149 |
-os::cmd::expect_success_and_text "oc set probe $arg -o yaml --liveness --open-tcp=3306" "tcpSocket:" |
|
| 150 |
-os::cmd::expect_success_and_text "oc set probe $arg -o yaml --liveness --open-tcp=3306" "port: 3306" |
|
| 151 |
-os::cmd::expect_success_and_text "oc set probe $arg -o yaml --liveness --open-tcp=port" "port: port" |
|
| 152 |
-os::cmd::expect_success_and_text "oc set probe $arg -o yaml --liveness --get-url=https://127.0.0.1:port/path" "port: port" |
|
| 153 |
-os::cmd::expect_success_and_text "oc set probe $arg -o yaml --liveness --get-url=https://127.0.0.1:8080/path" "port: 8080" |
|
| 154 |
-os::cmd::expect_success_and_text "oc set probe $arg -o yaml --liveness --get-url=https://127.0.0.1/path" 'port: ""' |
|
| 155 |
-os::cmd::expect_success_and_text "oc set probe $arg -o yaml --liveness --get-url=https://127.0.0.1:port/path" "path: /path" |
|
| 156 |
-os::cmd::expect_success_and_text "oc set probe $arg -o yaml --liveness --get-url=https://127.0.0.1:port/path" "scheme: HTTPS" |
|
| 157 |
-os::cmd::expect_success_and_text "oc set probe $arg -o yaml --liveness --get-url=http://127.0.0.1:port/path" "scheme: HTTP" |
|
| 158 |
-os::cmd::expect_success_and_text "oc set probe $arg -o yaml --liveness --get-url=https://127.0.0.1:port/path" "host: 127.0.0.1" |
|
| 159 |
-os::cmd::expect_success_and_text "oc set probe $arg -o yaml --liveness --get-url=https://127.0.0.1:port/path" "port: port" |
|
| 140 |
+os::cmd::expect_failure_and_text "oc set probe ${arg}" "error: you must specify one of --readiness or --liveness"
|
|
| 141 |
+os::cmd::expect_success_and_text "oc set probe ${arg} --liveness -o yaml" 'livenessProbe: \{\}'
|
|
| 142 |
+os::cmd::expect_success_and_text "oc set probe ${arg} -o yaml --liveness --initial-delay-seconds=10 -o yaml" "livenessProbe:"
|
|
| 143 |
+os::cmd::expect_success_and_text "oc set probe ${arg} -o yaml --liveness --initial-delay-seconds=10 -o yaml" "initialDelaySeconds: 10"
|
|
| 144 |
+os::cmd::expect_success_and_text "oc set probe ${arg} -o yaml --liveness -- echo test" "livenessProbe:"
|
|
| 145 |
+os::cmd::expect_success_and_text "oc set probe ${arg} -o yaml --readiness -- echo test" "readinessProbe:"
|
|
| 146 |
+os::cmd::expect_success_and_text "oc set probe ${arg} -o yaml --liveness -- echo test" "exec:"
|
|
| 147 |
+os::cmd::expect_success_and_text "oc set probe ${arg} -o yaml --liveness -- echo test" "\- echo"
|
|
| 148 |
+os::cmd::expect_success_and_text "oc set probe ${arg} -o yaml --liveness -- echo test" "\- test"
|
|
| 149 |
+os::cmd::expect_success_and_text "oc set probe ${arg} -o yaml --liveness --open-tcp=3306" "tcpSocket:"
|
|
| 150 |
+os::cmd::expect_success_and_text "oc set probe ${arg} -o yaml --liveness --open-tcp=3306" "port: 3306"
|
|
| 151 |
+os::cmd::expect_success_and_text "oc set probe ${arg} -o yaml --liveness --open-tcp=port" "port: port"
|
|
| 152 |
+os::cmd::expect_success_and_text "oc set probe ${arg} -o yaml --liveness --get-url=https://127.0.0.1:port/path" "port: port"
|
|
| 153 |
+os::cmd::expect_success_and_text "oc set probe ${arg} -o yaml --liveness --get-url=https://127.0.0.1:8080/path" "port: 8080"
|
|
| 154 |
+os::cmd::expect_success_and_text "oc set probe ${arg} -o yaml --liveness --get-url=https://127.0.0.1/path" 'port: ""'
|
|
| 155 |
+os::cmd::expect_success_and_text "oc set probe ${arg} -o yaml --liveness --get-url=https://127.0.0.1:port/path" "path: /path"
|
|
| 156 |
+os::cmd::expect_success_and_text "oc set probe ${arg} -o yaml --liveness --get-url=https://127.0.0.1:port/path" "scheme: HTTPS"
|
|
| 157 |
+os::cmd::expect_success_and_text "oc set probe ${arg} -o yaml --liveness --get-url=http://127.0.0.1:port/path" "scheme: HTTP"
|
|
| 158 |
+os::cmd::expect_success_and_text "oc set probe ${arg} -o yaml --liveness --get-url=https://127.0.0.1:port/path" "host: 127.0.0.1"
|
|
| 159 |
+os::cmd::expect_success_and_text "oc set probe ${arg} -o yaml --liveness --get-url=https://127.0.0.1:port/path" "port: port"
|
|
| 160 | 160 |
os::cmd::expect_success "oc create -f test/integration/fixtures/test-deployment-config.yaml" |
| 161 | 161 |
os::cmd::expect_failure_and_text "oc set probe dc/test-deployment-config --liveness" "Required value: must specify a handler type" |
| 162 | 162 |
os::cmd::expect_success_and_text "oc set probe dc test-deployment-config --liveness --open-tcp=8080" "updated" |
| ... | ... |
@@ -257,8 +257,7 @@ os::cmd::expect_failure 'oc get dc/ruby-hello-world' |
| 257 | 257 |
echo "delete all: ok" |
| 258 | 258 |
|
| 259 | 259 |
# service accounts should not be allowed to request new projects |
| 260 |
-SA_TOKEN=`oc get sa/builder --template='{{range .secrets}}{{ .name }} {{end}}' | xargs -n 1 oc get secret --template='{{ if .data.token }}{{ .data.token }}{{end}}' | os::util::base64decode -`
|
|
| 261 |
-os::cmd::expect_failure_and_text "oc new-project --token=${SA_TOKEN} will-fail" 'Error from server: You may not request a new project via this API'
|
|
| 260 |
+os::cmd::expect_failure_and_text "oc new-project --token="$( oc sa get-token builder )" will-fail" 'Error from server: You may not request a new project via this API' |
|
| 262 | 261 |
|
| 263 | 262 |
|
| 264 | 263 |
# Validate patching works correctly |
| ... | ... |
@@ -168,7 +168,6 @@ os::cmd::expect_success_and_text "oc describe is/newrepo" '\* tag is scheduled' |
| 168 | 168 |
os::cmd::expect_success 'oc tag --source=docker mysql:5.7 newrepo:latest --insecure' |
| 169 | 169 |
os::cmd::expect_success_and_text "oc describe is/newrepo" '\! tag is insecure' |
| 170 | 170 |
os::cmd::expect_success_and_not_text "oc describe is/newrepo" '\* tag is scheduled' |
| 171 |
-oc get -o yaml is/newrepo |
|
| 172 | 171 |
os::cmd::expect_success_and_text "oc get is/newrepo --template='{{(index .spec.tags 0).importPolicy.insecure}}'" 'true'
|
| 173 | 172 |
|
| 174 | 173 |
# test creating streams that don't exist |
| ... | ... |
@@ -15,7 +15,7 @@ os::log::install_errexit |
| 15 | 15 |
oc delete all,templates --all |
| 16 | 16 |
oc delete template/ruby-helloworld-sample -n openshift |
| 17 | 17 |
oc delete project test-template-project |
| 18 |
- os::cmd::try_until_failure 'oc get project test-template-project' |
|
| 18 |
+ wait_for_command '! oc get project test-template-project' |
|
| 19 | 19 |
exit 0 |
| 20 | 20 |
) &>/dev/null |
| 21 | 21 |
|
| ... | ... |
@@ -80,8 +80,8 @@ echo "template data precision: ok" |
| 80 | 80 |
os::cmd::expect_success 'oc create -f examples/sample-app/application-template-dockerbuild.json -n openshift' |
| 81 | 81 |
os::cmd::expect_success 'oc policy add-role-to-user admin test-user' |
| 82 | 82 |
new="$(mktemp -d)/tempconfig" |
| 83 |
-os::cmd::expect_success "oc config view --raw > $new" |
|
| 84 |
-export KUBECONFIG=$new |
|
| 83 |
+os::cmd::expect_success "oc config view --raw > ${new}"
|
|
| 84 |
+export KUBECONFIG=${new}
|
|
| 85 | 85 |
os::cmd::expect_success 'oc login -u test-user -p password' |
| 86 | 86 |
os::cmd::expect_success 'oc new-project test-template-project' |
| 87 | 87 |
# make sure the permissions on the new project are set up |