Skip to content

Commit

Permalink
fix: sanity-suite
Browse files Browse the repository at this point in the history
  • Loading branch information
exu committed Jan 18, 2022
1 parent a020b87 commit 8a34c7b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 56 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,13 @@ create-examples:


test-reload-sanity-script:
kubectl delete script sanity || true
kubectl delete script sanity -ntestkube || true
kubectl testkube scripts create -f test/e2e/TestKube-Sanity.postman_collection.json --name sanity


# test local api server intance - need local-postman/collection type registered to local postman executor
test-api-local:
newman run test/e2e/TestKube-Sanity.postman_collection.json --env-var script_name=fill-me --env-var script_type=local-postman/collection --env-var api_uri=http://localhost:8088 --env-var script_api_uri=http://localhost:8088 --env-var execution_name=fill --verbose
newman run test/e2e/TestKube-Sanity.postman_collection.json --env-var script_name=fill-me --env-var script_type=postman/collection --env-var api_uri=http://localhost:8088 --env-var script_api_uri=http://localhost:8088 --env-var execution_name=fill --verbose

# run by newman but on top of port-forwarded cluster service to api-server
# e.g. kubectl port-forward svc/testkube-api-server 8088
Expand Down
62 changes: 8 additions & 54 deletions test/e2e/TestKube-Sanity.postman_collection.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"info": {
"_postman_id": "dfc3423d-1ee1-4403-bee9-9e93caadb45c",
"_postman_id": "286d450e-cec0-4f29-b9fe-85186de7731e",
"name": "TestKube-Sanity",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
Expand Down Expand Up @@ -430,59 +430,6 @@
}
},
"response": []
},
{
"name": "Get created script execution by script and execution name",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Get execution by id\", function () {",
" console.log(\"response\", pm.response.json());",
" var jsonData = pm.response.json();",
" pm.expect(jsonData.executionResult.status).to.eql(\"success\");",
" pm.expect(jsonData[\"name\"]).to.eql(pm.environment.get(\"execution_name\"));",
" pm.expect(jsonData.executionResult[\"output\"]).contains(\"Health\");",
" pm.expect(jsonData.executionResult[\"output\"]).contains(\"200 OK\");",
"});"
],
"type": "text/javascript"
}
},
{
"listen": "prerequest",
"script": {
"exec": [
"console.log(\"uri\", pm.environment.get(\"api_uri\"));",
"console.log(\"script name\", pm.environment.get(\"script_name\"))",
"console.log(\"script type\", pm.environment.get(\"script_type\"))",
"console.log(\"exec name\", pm.environment.get(\"execution_name\"))",
"console.log(\"exec id\", pm.environment.get(\"execution_id\"))",
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{api_uri}}/v1/scripts/{{script_name}}/executions/{{execution_name}}",
"host": [
"{{api_uri}}"
],
"path": [
"v1",
"scripts",
"{{script_name}}",
"executions",
"{{execution_name}}"
]
}
},
"response": []
}
],
"event": [
Expand All @@ -504,5 +451,12 @@
]
}
}
],
"variable": [
{
"key": "script_type",
"value": "postman/collection",
"type": "string"
}
]
}

0 comments on commit 8a34c7b

Please sign in to comment.