@@ -12,147 +12,147 @@ load variables
1212
1313 run dispatch create base-image base-nodejs $DOCKER_REGISTRY /$BASE_IMAGE_NODEJS6 --language nodejs
1414 assert_success
15- run_with_retry " dispatch get base-image base-nodejs -o json | jq -r .status" " READY" 8 2
15+ run_with_retry " dispatch get base-image base-nodejs -o json | jq -r .status" " READY"
1616
1717 run dispatch create image nodejs base-nodejs
1818 assert_success
19- run_with_retry " dispatch get image nodejs -o json | jq -r .status" " READY" 8 2
19+ run_with_retry " dispatch get image nodejs -o json | jq -r .status" " READY"
2020}
2121
2222@test " Create Functions for test" {
2323 run dispatch create function --image=nodejs func-nodejs ${DISPATCH_ROOT} /examples/nodejs --handler=./hello.js
2424 echo_to_log
2525 assert_success
2626
27- run_with_retry " dispatch get function func-nodejs -o json | jq -r .status" " READY" 10 2
27+ run_with_retry " dispatch get function func-nodejs -o json | jq -r .status" " READY"
2828
2929 run dispatch create function --image=nodejs node-echo-back ${DISPATCH_ROOT} /examples/nodejs --handler=./debug.js
3030 echo_to_log
3131 assert_success
3232
33- run_with_retry " dispatch get function node-echo-back -o json | jq -r .status" " READY" 10 2
33+ run_with_retry " dispatch get function node-echo-back -o json | jq -r .status" " READY"
3434}
3535
3636@test " Test APIs with HTTP(S)" {
3737 run dispatch create api api-test-http func-nodejs -m POST -p /http --auth public
3838 echo_to_log
3939 assert_success
4040
41- run_with_retry " dispatch get api api-test-http -o json | jq -r .status" " READY" 10 2
41+ run_with_retry " dispatch get api api-test-http -o json | jq -r .status" " READY"
4242
4343 echo " ${API_GATEWAY_HTTPS_HOST} "
4444
4545 run_with_retry " curl -s -X POST ${API_GATEWAY_HTTP_HOST} /${DISPATCH_ORGANIZATION} /http -H \" Content-Type: application/json\" -d '{
4646 \" name\" : \" VMware\" ,
4747 \" place\" : \" HTTP\"
48- }' | jq -r .myField" " Hello, VMware from HTTP" 6 2
48+ }' | jq -r .myField" " Hello, VMware from HTTP"
4949
5050 run_with_retry " curl -s -X POST ${API_GATEWAY_HTTPS_HOST} /${DISPATCH_ORGANIZATION} /http -k -H \" Content-Type: application/json\" -d '{
5151 \" name\" : \" VMware\" ,
5252 \" place\" : \" HTTPS\"
53- }' | jq -r .myField" " Hello, VMware from HTTPS" 6 2
53+ }' | jq -r .myField" " Hello, VMware from HTTPS"
5454}
5555
5656@test " Test APIs with HTTPS ONLY" {
5757 run dispatch create api api-test-https-only func-nodejs -m POST --https-only -p /https-only --auth public
5858 echo_to_log
5959 assert_success
60- run_with_retry " dispatch get api api-test-https-only -o json | jq -r .status" " READY" 6 2
60+ run_with_retry " dispatch get api api-test-https-only -o json | jq -r .status" " READY"
6161
6262 run_with_retry " curl -s -X POST ${API_GATEWAY_HTTP_HOST} /${DISPATCH_ORGANIZATION} /https-only -H \" Content-Type: application/json\" -d '{ \
6363 \" name\" : \" VMware\" ,
6464 \" place\" : \" HTTPS ONLY\"
65- }' | jq -r .message" " Please use HTTPS protocol" 6 2
65+ }' | jq -r .message" " Please use HTTPS protocol"
6666
6767 run_with_retry " curl -s -X POST ${API_GATEWAY_HTTPS_HOST} /${DISPATCH_ORGANIZATION} /https-only -k -H \" Content-Type: application/json\" -d '{ \
6868 \" name\" : \" VMware\" ,
6969 \" place\" : \" HTTPS ONLY\"
70- }' | jq -r .myField" " Hello, VMware from HTTPS ONLY" 6 2
70+ }' | jq -r .myField" " Hello, VMware from HTTPS ONLY"
7171}
7272
7373@test " Test APIs with Kong Plugins" {
7474
7575 run dispatch create api api-test func-nodejs -m GET -m DELETE -m POST -m PUT -p /hello --auth public
7676 echo_to_log
7777 assert_success
78- run_with_retry " dispatch get api api-test -o json | jq -r .status" " READY" 6 2
78+ run_with_retry " dispatch get api api-test -o json | jq -r .status" " READY"
7979
8080 run dispatch create api api-echo node-echo-back -m GET -m DELETE -m POST -m PUT -p /echo --auth public
8181 echo_to_log
8282 assert_success
83- run_with_retry " dispatch get api api-echo -o json | jq -r .status" " READY" 6 2
83+ run_with_retry " dispatch get api api-echo -o json | jq -r .status" " READY"
8484
8585 # "x-dispatch-blocking: true" is default header
8686 run_with_retry " curl -s -X PUT ${API_GATEWAY_HTTPS_HOST} /${DISPATCH_ORGANIZATION} /hello -k -H \" Content-Type: application/json\" -d '{ \
8787 \" name\" : \" VMware\" ,
8888 \" place\" : \" Palo Alto\"
89- }' | jq -r .myField" " Hello, VMware from Palo Alto" 6 2
89+ }' | jq -r .myField" " Hello, VMware from Palo Alto"
9090
9191 # with "x-dispatch-blocking: false", it will not return an result
9292 run_with_retry " curl -s -X PUT ${API_GATEWAY_HTTPS_HOST} /${DISPATCH_ORGANIZATION} /hello -k -H \" Content-Type: application/json\" -H 'x-dispatch-blocking: false' -d '{
9393 \" name\" : \" VMware\" ,
9494 \" place\" : \" Palo Alto\"
95- }'" " " 6 2
95+ }'" " "
9696
9797 # with "x-dispatch-org: invalid", setting this header should have no effect as it's overwritten by the plugin.
9898 # if the plugin fails to overwrite this HEADER, it will allow end-users to switch orgs and this test should fail
9999 # with {"message":"function not found"}.
100100 run_with_retry " curl -s -X PUT ${API_GATEWAY_HTTPS_HOST} /${DISPATCH_ORGANIZATION} /hello -k -H \" Content-Type: application/json\" -H 'x-dispatch-org: invalid' -d '{
101101 \" name\" : \" VMware\" ,
102102 \" place\" : \" Palo Alto\"
103- }' | jq -r .myField" " Hello, VMware from Palo Alto" 6 2
103+ }' | jq -r .myField" " Hello, VMware from Palo Alto"
104104
105105 # PUT with no content-type and no payload
106- run_with_retry " curl -s -X PUT ${API_GATEWAY_HTTPS_HOST} /${DISPATCH_ORGANIZATION} /hello -k | jq -r .myField" " Hello, Noone from Nowhere" 6 2
106+ run_with_retry " curl -s -X PUT ${API_GATEWAY_HTTPS_HOST} /${DISPATCH_ORGANIZATION} /hello -k | jq -r .myField" " Hello, Noone from Nowhere"
107107
108108 # PUT with json content-type and non-json payload
109109 run_with_retry " curl -s -X PUT ${API_GATEWAY_HTTPS_HOST} /${DISPATCH_ORGANIZATION} /hello -k \
110- -H \" Content-Type: application/json\" -d \" not a json payload\" | jq -r .message" " request body is not json" 6 2
110+ -H \" Content-Type: application/json\" -d \" not a json payload\" | jq -r .message" " request body is not json"
111111
112112 # PUT with x-www-form-urlencoded content-type and x-www-form-urlencoded payload
113113 run_with_retry " curl -s -X PUT ${API_GATEWAY_HTTPS_HOST} /${DISPATCH_ORGANIZATION} /hello -k \
114- -H \" Content-Type: application/x-www-form-urlencoded\" -d \" name=VMware&place=Palo Alto\" | jq -r .myField" " Hello, VMware from Palo Alto" 6 2
114+ -H \" Content-Type: application/x-www-form-urlencoded\" -d \" name=VMware&place=Palo Alto\" | jq -r .myField" " Hello, VMware from Palo Alto"
115115
116116 # PUT with non-supported content-type and payload
117117 run_with_retry " curl -s -X PUT ${API_GATEWAY_HTTPS_HOST} /${DISPATCH_ORGANIZATION} /hello -k \
118- -H \" Content-Type: unsupported-content-type\" -d \" some payload\" | jq -r .message" " request body type is not supported: unsupported-content-type" 6 2
118+ -H \" Content-Type: unsupported-content-type\" -d \" some payload\" | jq -r .message" " request body type is not supported: unsupported-content-type"
119119
120120 # GET with parameters
121- run_with_retry " curl -s -X GET ${API_GATEWAY_HTTPS_HOST} /${DISPATCH_ORGANIZATION} /hello?name=vmware\&place=PaloAlto -k | jq -r .myField" " Hello, vmware from PaloAlto" 6 2
121+ run_with_retry " curl -s -X GET ${API_GATEWAY_HTTPS_HOST} /${DISPATCH_ORGANIZATION} /hello?name=vmware\&place=PaloAlto -k | jq -r .myField" " Hello, vmware from PaloAlto"
122122
123123 # GET without parameters
124- run_with_retry " curl -s -X GET ${API_GATEWAY_HTTPS_HOST} /${DISPATCH_ORGANIZATION} /hello -k | jq -r .myField" " Hello, Noone from Nowhere" 6 2
124+ run_with_retry " curl -s -X GET ${API_GATEWAY_HTTPS_HOST} /${DISPATCH_ORGANIZATION} /hello -k | jq -r .myField" " Hello, Noone from Nowhere"
125125
126126 # Test HTTP Context
127- run_with_retry " curl -s -X PUT ${API_GATEWAY_HTTPS_HOST} /${DISPATCH_ORGANIZATION} /echo -k | jq -r .context.httpContext.method" " PUT" 6 2
127+ run_with_retry " curl -s -X PUT ${API_GATEWAY_HTTPS_HOST} /${DISPATCH_ORGANIZATION} /echo -k | jq -r .context.httpContext.method" " PUT"
128128}
129129
130130@test " Test APIs with CORS" {
131131 run dispatch create api api-test-cors func-nodejs -m POST -m PUT -p /cors --auth public --cors
132132 echo_to_log
133133 assert_success
134- run_with_retry " dispatch get api api-test-cors -o json | jq -r .status" " READY" 10 2
134+ run_with_retry " dispatch get api api-test-cors -o json | jq -r .status" " READY"
135135
136136 # contains "Access-Control-Allow-Origin: *"
137137 run_with_retry " curl -s -X PUT ${API_GATEWAY_HTTPS_HOST} /${DISPATCH_ORGANIZATION} /cors -k -v -H \" Content-Type: application/json\" -d '{
138138 \" name\" : \" VMware\" ,
139139 \" place\" : \" Palo Alto\"
140- }' 2>&1 | grep -c \" Access-Control-Allow-Origin: *\" " 1 10 2
140+ }' 2>&1 | grep -c \" Access-Control-Allow-Origin: *\" " 1
141141}
142142
143143@test " Test API Updates" {
144144 run dispatch create api api-test-update func-nodejs -m GET -p /hello --auth public
145145 assert_success
146- run_with_retry " dispatch get api api-test-update -o json | jq -r .status" " READY" 6 2
146+ run_with_retry " dispatch get api api-test-update -o json | jq -r .status" " READY"
147147
148- run_with_retry " curl -s -X GET ${API_GATEWAY_HTTP_HOST} /${DISPATCH_ORGANIZATION} /hello -k | jq -r .myField" " Hello, Noone from Nowhere" 6 5
148+ run_with_retry " curl -s -X GET ${API_GATEWAY_HTTP_HOST} /${DISPATCH_ORGANIZATION} /hello -k | jq -r .myField" " Hello, Noone from Nowhere"
149149
150150 # update path and https
151151 run dispatch update --work-dir ${BATS_TEST_DIRNAME} -f api_update.yaml
152152 assert_success
153- run_with_retry " dispatch get api api-test-update -o json | jq -r .status" " READY" 6 2
153+ run_with_retry " dispatch get api api-test-update -o json | jq -r .status" " READY"
154154
155- run_with_retry " curl -s -X GET ${API_GATEWAY_HTTPS_HOST} /${DISPATCH_ORGANIZATION} /goodbye -k | jq -r .myField" " Hello, Noone from Nowhere" 6 5
155+ run_with_retry " curl -s -X GET ${API_GATEWAY_HTTPS_HOST} /${DISPATCH_ORGANIZATION} /goodbye -k | jq -r .myField" " Hello, Noone from Nowhere"
156156}
157157
158158@test " Cleanup" {
0 commit comments