From 74816c26a13b1aed628d435206b43df2a4ebf509 Mon Sep 17 00:00:00 2001 From: Suneha Bose Date: Mon, 20 Mar 2023 21:26:57 -0700 Subject: [PATCH] integration test for update dry run --- test/gen_integration.sh | 24 +++++++++++ test/update_dry_run_schema.json | 71 +++++++++++++++++++++++++++++++++ 2 files changed, 95 insertions(+) create mode 100644 test/update_dry_run_schema.json diff --git a/test/gen_integration.sh b/test/gen_integration.sh index 5ec06f87..11e98449 100755 --- a/test/gen_integration.sh +++ b/test/gen_integration.sh @@ -288,6 +288,14 @@ languageVariables: curl -m 3 \$SERVICEIP:$serviceport kill \$tunnelPID - run: ./draft -b main -v generate-workflow -d ./langtest/ -c someAksCluster -r someRegistry -g someResourceGroup --container-name someContainer + - name: Execute dry run for update command + run: | + mkdir -p test/temp + ./draft --dry-run --dry-run-file test/temp/update_dry_run.json update -d ./langtest/ $ingress_test_args + - name: Validate JSON + run: | + npm install -g ajv-cli@5.0.0 + ajv validate -s test/update_dry_run_schema.json -d test/temp/update_dry_run.json - run: ./draft -v update -d ./langtest/ $ingress_test_args - name: Check default namespace if: steps.deploy.outcome != 'success' @@ -401,6 +409,14 @@ languageVariables: curl -m 3 \$SERVICEIP:$serviceport kill \$tunnelPID - run: ./draft -v generate-workflow -b main -d ./langtest/ -c someAksCluster -r someRegistry -g someResourceGroup --container-name someContainer + - name: Execute dry run for update command + run: | + mkdir -p test/temp + ./draft --dry-run --dry-run-file test/temp/update_dry_run.json update -d ./langtest/ $ingress_test_args + - name: Validate JSON + run: | + npm install -g ajv-cli@5.0.0 + ajv validate -s test/update_dry_run_schema.json -d test/temp/update_dry_run.json - run: ./draft -v update -d ./langtest/ $ingress_test_args - name: Check default namespace if: steps.deploy.outcome != 'success' @@ -507,6 +523,14 @@ languageVariables: curl -m 3 \$SERVICEIP:$serviceport kill \$tunnelPID - run: ./draft -v generate-workflow -d ./langtest/ -b main -c someAksCluster -r localhost -g someResourceGroup --container-name testapp + - name: Execute dry run for update command + run: | + mkdir -p test/temp + ./draft --dry-run --dry-run-file test/temp/update_dry_run.json update -d ./langtest/ $ingress_test_args + - name: Validate JSON + run: | + npm install -g ajv-cli@5.0.0 + ajv validate -s test/update_dry_run_schema.json -d test/temp/update_dry_run.json - uses: actions/upload-artifact@v3 with: name: $lang-manifests-create diff --git a/test/update_dry_run_schema.json b/test/update_dry_run_schema.json new file mode 100644 index 00000000..d84bffea --- /dev/null +++ b/test/update_dry_run_schema.json @@ -0,0 +1,71 @@ +{ + "definitions": {}, + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://example.com/object1670282842.json", + "title": "Root", + "type": "object", + "properties": { + "variables": { + "$id": "#root/variables", + "title": "Variables", + "type": "object", + "properties": { + "ingress-host": { + "$id": "#root/variables/ingress-host", + "title": "IngressHost", + "type": "string", + "default": "", + "pattern": "^.*$" + }, + "ingress-tls-cert-keyvault-uri": { + "$id": "#root/variables/ingress-tls-cert-keyvault-uri", + "title": "IngressTlsCertKeyvaultUri", + "type": "string", + "default": "", + "pattern": "^.*$" + }, + "ingress-use-osm-mtls": { + "$id": "#root/variables/ingress-use-osm-mtls", + "title": "IngressUseOsmMtls", + "type": "string", + "default": "", + "pattern": "^.*$" + }, + "service-name": { + "$id": "#root/variables/service-name", + "title": "ServiceName", + "type": "string", + "default": "", + "pattern": "^.*$" + }, + "service-namespace": { + "$id": "#root/variables/service-namespace", + "title": "ServiceNamespace", + "type": "string", + "default": "", + "pattern": "^.*$" + }, + "service-port": { + "$id": "#root/variables/service-port", + "title": "ServicePort", + "type": "string", + "default": "", + "pattern": "^.*$" + } + } + }, + "filesToWrite": { + "$id": "#root/filesToWrite", + "title": "FilesToWrite", + "type": "array", + "default": [], + "items": { + "$id": "#root/filesToWrite/items", + "title": "Items", + "type": "string", + "default": "", + "pattern": "^.*$" + } + } + } +} \ No newline at end of file