Skip to content

Commit ed7a901

Browse files
committed
added postman collection e2e test for API server
1 parent 8432521 commit ed7a901

File tree

7 files changed

+548
-1
lines changed

7 files changed

+548
-1
lines changed

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ test-e2e:
5353
test-e2e-namespace:
5454
NAMESPACE=$(NAMESPACE) go test --tags=e2e -v ./test/e2e
5555

56+
test-postman-local-api-server:
57+
REQUEST_DELAY=2000
58+
newman run test/e2e/Kubtest-Sanity.postman_collection.json --env-var script_name=postman-test-100 --env-var script_type=local-postman/collection --env-var api_uri=http://localhost:8088 --env-var execution_name=fill --delay-request $(REQUEST_DELAY)
59+
5660
cover:
5761
@go test -failfast -count=1 -v -tags test -coverprofile=./testCoverage.txt ./... && go tool cover -html=./testCoverage.txt -o testCoverage.html && rm ./testCoverage.txt
5862
open testCoverage.html
@@ -75,4 +79,4 @@ version-bump-dev:
7579
go run cmd/tools/main.go bump --dev
7680

7781
commands-reference:
78-
go run cmd/kubectl-kubtest/main.go doc > ./docs/reference.md
82+
go run cmd/kubectl-kubtest/main.go doc > ./docs/reference.md

api/v1/kubtest.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,9 @@ components:
417417
type: string
418418
description: execution id
419419
format: bson objectId
420+
name:
421+
type: string
422+
description: execution name
420423
script-name:
421424
type: string
422425
description: name of the script

data.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
[
2+
{
3+
"NAME": "postman-test-1",
4+
"TYPE": "local-postman/collection"
5+
},
6+
{
7+
"NAME": "postman-test-2",
8+
"TYPE": "local-postman/collection"
9+
},
10+
{
11+
"NAME": "postman-test-3",
12+
"TYPE": "local-postman/collection"
13+
},
14+
{
15+
"NAME": "postman-test-4",
16+
"TYPE": "local-postman/collection"
17+
},
18+
{
19+
"NAME": "postman-test-5",
20+
"TYPE": "local-postman/collection"
21+
},
22+
{
23+
"NAME": "postman-test-6",
24+
"TYPE": "local-postman/collection"
25+
},
26+
{
27+
"NAME": "postman-test-7",
28+
"TYPE": "local-postman/collection"
29+
}
30+
]

internal/app/api/v1/scripts.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ func (s kubtestAPI) ListExecutions() fiber.Handler {
233233
for i, s := range executions {
234234
result[i] = kubtest.ExecutionSummary{
235235
Id: s.Id,
236+
Name: s.Name,
236237
ScriptName: s.ScriptName,
237238
ScriptType: s.ScriptType,
238239
Status: s.Execution.Status,

local-postman.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
apiVersion: executor.kubtest.io/v1
2+
kind: Executor
3+
metadata:
4+
annotations:
5+
meta.helm.sh/release-name: kubtest
6+
meta.helm.sh/release-namespace: default
7+
labels:
8+
app.kubernetes.io/managed-by: Helm
9+
name: local-postman-executor
10+
namespace: default
11+
spec:
12+
types:
13+
- local-postman/collection
14+
uri: http://localhost:8082

pkg/api/kubtest/model_execution_summary.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ import (
1717
type ExecutionSummary struct {
1818
// execution id
1919
Id string `json:"id,omitempty"`
20+
// execution name
21+
Name string `json:"name,omitempty"`
2022
// name of the script
2123
ScriptName string `json:"script-name,omitempty"`
2224
// the type of script for this execution

0 commit comments

Comments
 (0)