test: simplify swagger json check script
This commit is contained in:
parent
48e68b7c77
commit
0bd30e039f
|
@ -194,15 +194,12 @@ jobs:
|
|||
run: |
|
||||
CID=$(docker run -d --rm -P $EMQX_IMAGE_TAG)
|
||||
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
|
||||
docker stop $CID
|
||||
- name: test two nodes cluster with proto_dist=inet_tls in docker
|
||||
run: |
|
||||
./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)
|
||||
# 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
|
||||
# cleanup
|
||||
./scripts/test/start-two-nodes-in-docker.sh -c
|
||||
|
|
|
@ -52,13 +52,10 @@ check_swagger_json() {
|
|||
## assert swagger.json is valid json
|
||||
JSON="$(curl -s "$url")"
|
||||
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)
|
||||
if echo "$JSON" | grep -q trie_compaction; then
|
||||
echo "swagger.json contains hidden fields"
|
||||
exit 1
|
||||
fi
|
||||
## assert swagger.json does not contain trie_compaction (which is a hidden field)
|
||||
if echo "$JSON" | grep -q trie_compaction; then
|
||||
echo "swagger.json contains hidden fields"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -82,9 +79,9 @@ main() {
|
|||
local JSON_STATUS
|
||||
JSON_STATUS="$(json_status)"
|
||||
check_api_docs
|
||||
check_swagger_json
|
||||
## The json status feature was added after hotconf and bridges schema API
|
||||
if [ "$JSON_STATUS" != 'NOT_JSON' ]; then
|
||||
check_swagger_json
|
||||
check_schema_json hotconf "EMQX Hot Conf API Schema"
|
||||
check_schema_json bridges "EMQX Data Bridge API Schema"
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue