test: simplify swagger json check script
This commit is contained in:
parent
48e68b7c77
commit
0bd30e039f
|
@ -194,15 +194,12 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
CID=$(docker run -d --rm -P $EMQX_IMAGE_TAG)
|
CID=$(docker run -d --rm -P $EMQX_IMAGE_TAG)
|
||||||
HTTP_PORT=$(docker inspect --format='{{(index (index .NetworkSettings.Ports "18083/tcp") 0).HostPort}}' $CID)
|
HTTP_PORT=$(docker inspect --format='{{(index (index .NetworkSettings.Ports "18083/tcp") 0).HostPort}}' $CID)
|
||||||
export EMQX_SMOKE_TEST_CHECK_HIDDEN_FIELDS='yes'
|
|
||||||
./scripts/test/emqx-smoke-test.sh localhost $HTTP_PORT
|
./scripts/test/emqx-smoke-test.sh localhost $HTTP_PORT
|
||||||
docker stop $CID
|
docker stop $CID
|
||||||
- name: test two nodes cluster with proto_dist=inet_tls in docker
|
- name: test two nodes cluster with proto_dist=inet_tls in docker
|
||||||
run: |
|
run: |
|
||||||
./scripts/test/start-two-nodes-in-docker.sh -P $EMQX_IMAGE_TAG $EMQX_IMAGE_OLD_VERSION_TAG
|
./scripts/test/start-two-nodes-in-docker.sh -P $EMQX_IMAGE_TAG $EMQX_IMAGE_OLD_VERSION_TAG
|
||||||
HTTP_PORT=$(docker inspect --format='{{(index (index .NetworkSettings.Ports "18083/tcp") 0).HostPort}}' haproxy)
|
HTTP_PORT=$(docker inspect --format='{{(index (index .NetworkSettings.Ports "18083/tcp") 0).HostPort}}' haproxy)
|
||||||
# versions before 5.0.22 have hidden fields included in the API spec
|
|
||||||
export EMQX_SMOKE_TEST_CHECK_HIDDEN_FIELDS='no'
|
|
||||||
./scripts/test/emqx-smoke-test.sh localhost $HTTP_PORT
|
./scripts/test/emqx-smoke-test.sh localhost $HTTP_PORT
|
||||||
# cleanup
|
# cleanup
|
||||||
./scripts/test/start-two-nodes-in-docker.sh -c
|
./scripts/test/start-two-nodes-in-docker.sh -c
|
||||||
|
|
|
@ -52,14 +52,11 @@ check_swagger_json() {
|
||||||
## assert swagger.json is valid json
|
## assert swagger.json is valid json
|
||||||
JSON="$(curl -s "$url")"
|
JSON="$(curl -s "$url")"
|
||||||
echo "$JSON" | jq . >/dev/null
|
echo "$JSON" | jq . >/dev/null
|
||||||
|
|
||||||
if [ "${EMQX_SMOKE_TEST_CHECK_HIDDEN_FIELDS:-yes}" = 'yes' ]; then
|
|
||||||
## assert swagger.json does not contain trie_compaction (which is a hidden field)
|
## assert swagger.json does not contain trie_compaction (which is a hidden field)
|
||||||
if echo "$JSON" | grep -q trie_compaction; then
|
if echo "$JSON" | grep -q trie_compaction; then
|
||||||
echo "swagger.json contains hidden fields"
|
echo "swagger.json contains hidden fields"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
check_schema_json() {
|
check_schema_json() {
|
||||||
|
@ -82,9 +79,9 @@ main() {
|
||||||
local JSON_STATUS
|
local JSON_STATUS
|
||||||
JSON_STATUS="$(json_status)"
|
JSON_STATUS="$(json_status)"
|
||||||
check_api_docs
|
check_api_docs
|
||||||
check_swagger_json
|
|
||||||
## The json status feature was added after hotconf and bridges schema API
|
## The json status feature was added after hotconf and bridges schema API
|
||||||
if [ "$JSON_STATUS" != 'NOT_JSON' ]; then
|
if [ "$JSON_STATUS" != 'NOT_JSON' ]; then
|
||||||
|
check_swagger_json
|
||||||
check_schema_json hotconf "EMQX Hot Conf API Schema"
|
check_schema_json hotconf "EMQX Hot Conf API Schema"
|
||||||
check_schema_json bridges "EMQX Data Bridge API Schema"
|
check_schema_json bridges "EMQX Data Bridge API Schema"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue