Skip to content

Commit

Permalink
fix: renaming in postman tests
Browse files Browse the repository at this point in the history
  • Loading branch information
exu committed Feb 12, 2022
1 parent 6d63b0c commit 63841cc
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 24 deletions.
2 changes: 1 addition & 1 deletion docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ kubectl testkube tests list
kubectl testkube tests executions TEST_NAME

+------------+--------------------+--------------------------+---------------------------+----------+
| SCRIPT | TYPE | EXECUTION ID | EXECUTION NAME | STATUS |
| TEST | TYPE | EXECUTION ID | EXECUTION NAME | STATUS |
+------------+--------------------+--------------------------+---------------------------+----------+
| parms-test | postman/collection | 611a5a1a910ca385751eb2c6 | pt1 | success |
| parms-test | postman/collection | 611a5a40910ca385751eb2c8 | pt2 | error |
Expand Down
4 changes: 2 additions & 2 deletions docs/tests-getting-results.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ kubectl testkube tests executions
Output:
```sh
SCRIPT | TYPE | NAME | ID | STATUS
TEST | TYPE | NAME | ID | STATUS
+---------------------+--------------------+------+--------------------------+---------+
api-incluster-test | postman/collection | | 615d7e1ab046f8fbd3d955d6 | success
api-incluster-test | postman/collection | | 615d6398b046f8fbd3d955d4 | success
Expand Down Expand Up @@ -144,7 +144,7 @@ kubectl testkube tests executions api-incluster-test
Output:
```sh
SCRIPT | TYPE | NAME | ID | STATUS
TEST | TYPE | NAME | ID | STATUS
+--------------------+--------------------+------+--------------------------+---------+
api-incluster-test | postman/collection | | 615d6398b046f8fbd3d955d4 | success
api-incluster-test | postman/collection | | 615d7e1ab046f8fbd3d955d6 | success
Expand Down
8 changes: 4 additions & 4 deletions internal/pkg/api/repository/result/mongo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,14 @@ func TestStorage(t *testing.T) {
assert.Equal(int32(1), totals.Pending)
})

t.Run("filter with script name that doesn't exist should return 0 results", func(t *testing.T) {
t.Run("filter with test name that doesn't exist should return 0 results", func(t *testing.T) {

executions, err := repository.GetExecutions(context.Background(), NewExecutionsFilter().WithTestName("noneExisting"))
assert.NoError(err)
assert.Empty(executions)
})

t.Run("getting totals with script name that doesn't exist should return 0 results", func(t *testing.T) {
t.Run("getting totals with test name that doesn't exist should return 0 results", func(t *testing.T) {
totals, err := repository.GetExecutionTotals(context.Background(), false, NewExecutionsFilter().WithTestName("noneExisting"))

assert.NoError(err)
Expand Down Expand Up @@ -208,15 +208,15 @@ func TestStorage(t *testing.T) {
err = repository.insertExecutionResult(name, testkube.PENDING_ExecutionStatus, twoDaysAgo, nil)
assert.NoError(err)

t.Run("filter with script name should return result only for that script name", func(t *testing.T) {
t.Run("filter with test name should return result only for that test name", func(t *testing.T) {

executions, err := repository.GetExecutions(context.Background(), NewExecutionsFilter().WithTestName(name))
assert.NoError(err)
assert.Len(executions, 1)
assert.Equal(executions[0].TestName, name)
})

t.Run("getting totals with script name should return result only for that script name", func(t *testing.T) {
t.Run("getting totals with test name should return result only for that test name", func(t *testing.T) {
totals, err := repository.GetExecutionTotals(context.Background(), false, NewExecutionsFilter().WithTestName(name))

assert.NoError(err)
Expand Down
31 changes: 15 additions & 16 deletions test/e2e/TestKube-Sanity.postman_collection.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
},
"item": [
{
"name": "Create postman/collection script",
"name": "Create postman/collection test",
"event": [
{
"listen": "prerequest",
"script": {
"exec": [
"console.log(\"uri\", pm.environment.get(\"api_uri\"));",
"console.log(\"script name\", pm.environment.get(\"test_name\"))",
"console.log(\"script type\", pm.environment.get(\"test_type\"))",
"console.log(\"test name\", pm.environment.get(\"test_name\"))",
"console.log(\"test type\", pm.environment.get(\"test_type\"))",
"",
"",
"function makeid(length) {",
Expand All @@ -41,7 +41,7 @@
" pm.response.to.have.status(200);",
"});",
"",
"pm.test(\"Check if script created successfully\", function () {",
"pm.test(\"Check if test created successfully\", function () {",
" let jsonData = pm.response.json();",
" let name = jsonData.metadata.name;",
" let testName = pm.environment.get(\"test_name\");",
Expand Down Expand Up @@ -70,7 +70,7 @@
}
},
"url": {
"raw": "{{api_uri}}/v1/scripts",
"raw": "{{api_uri}}/v1/tests",
"host": [
"{{api_uri}}"
],
Expand All @@ -83,7 +83,7 @@
"response": []
},
{
"name": "List scripts",
"name": "List tests",
"event": [
{
"listen": "test",
Expand Down Expand Up @@ -127,20 +127,20 @@
"method": "GET",
"header": [],
"url": {
"raw": "{{api_uri}}/v1/scripts",
"raw": "{{api_uri}}/v1/tests",
"host": [
"{{api_uri}}"
],
"path": [
"v1",
"scripts"
"tests"
]
}
},
"response": []
},
{
"name": "Get script",
"name": "Get test",
"event": [
{
"listen": "test",
Expand Down Expand Up @@ -175,7 +175,7 @@
"method": "GET",
"header": [],
"url": {
"raw": "{{api_uri}}/v1/scripts/{{test_name}}",
"raw": "{{api_uri}}/v1/tests/{{test_name}}",
"host": [
"{{api_uri}}"
],
Expand All @@ -201,7 +201,6 @@
"",
"pm.test(\"Check execution is created\", function () {",
" let jsonData = pm.response.json();",
" let script = pm.environment.get(\"test_name\")",
" console.log(\"create response\", jsonData);",
"",
" let executionName = jsonData.name ",
Expand Down Expand Up @@ -238,7 +237,7 @@
}
},
"url": {
"raw": "{{api_uri}}/v1/scripts/{{test_name}}/executions",
"raw": "{{api_uri}}/v1/tests/{{test_name}}/executions",
"host": [
"{{api_uri}}"
],
Expand All @@ -253,7 +252,7 @@
"response": []
},
{
"name": "Get created script execution by ID",
"name": "Get created test execution by ID",
"event": [
{
"listen": "test",
Expand Down Expand Up @@ -317,7 +316,7 @@
"response": []
},
{
"name": "List script executions",
"name": "List test executions",
"event": [
{
"listen": "test",
Expand Down Expand Up @@ -360,7 +359,7 @@
"method": "GET",
"header": [],
"url": {
"raw": "{{api_uri}}/v1/scripts/{{test_name}}/executions",
"raw": "{{api_uri}}/v1/tests/{{test_name}}/executions",
"host": [
"{{api_uri}}"
],
Expand All @@ -375,7 +374,7 @@
"response": []
},
{
"name": "List recent script executions",
"name": "List recent test executions",
"event": [
{
"listen": "test",
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func TestE2E(t *testing.T) {
a.Contains(string(out), "Kasia.in Homepage")
a.Contains(string(out), "Google")

// then check if scripts completed with success
// then check if tests completed with success
a.Contains(string(out), "Test execution completed with sucess")

executionID := GetExecutionID(out)
Expand Down

0 comments on commit 63841cc

Please sign in to comment.