Skip to content

Commit 4a91887

Browse files
authored
feat: add postman tests for api v2 (#707)
* feat: add postman.yml to github actions
1 parent fc3c2ac commit 4a91887

8 files changed

Lines changed: 100 additions & 3 deletions

File tree

.github/workflows/postman.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: 'postman'
2+
on:
3+
pull_request:
4+
branches:
5+
- '*'
6+
workflow_dispatch:
7+
jobs:
8+
postman:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- name: Set npm token
13+
env:
14+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
15+
run: |
16+
echo "@linode:registry=https://npm.pkg.github.com/linode" > .npmrc
17+
echo "//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}" >> .npmrc
18+
echo '::set-output name=diff::1'
19+
- name: Install Node
20+
run: |
21+
export NVM_DIR="$HOME/.nvm"
22+
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
23+
nvm install
24+
nvm use
25+
node -v
26+
npm install
27+
- uses: actions/checkout@v4
28+
with:
29+
repository: linode/apl-core
30+
path: apl-core
31+
- name: Create Git repo
32+
run: |
33+
readonly env_dir="$HOME/workspace/linode/values-ofld1"
34+
readonly apl_core_test_fixtures="$HOME/work/apl-api/apl-api/apl-core/tests/fixtures"
35+
mkdir -p "$(dirname $env_dir)"
36+
cp -R $apl_core_test_fixtures $env_dir
37+
cd $env_dir
38+
git init
39+
git checkout -b main
40+
git config user.name "github-actions[bot]"
41+
git config user.email "github-actions[bot]@users.noreply.github.com"
42+
git add .
43+
git commit -a -m 'init'
44+
# Mark this repo as bare so the local_env_dir can push to env_dir repo
45+
git config --bool core.bare true
46+
echo "The values bare repo has been successfully set up"
47+
ls
48+
- name: Start core server
49+
run: |
50+
cd apl-core
51+
npm install
52+
npm run server > $GITHUB_WORKSPACE/core.log 2>&1 &
53+
- name: Start api
54+
run: |
55+
npm install
56+
cp .env.sample .env
57+
npm run dev > $GITHUB_WORKSPACE/api.log 2>&1 &
58+
- name: Wait for api
59+
run: |
60+
echo "Waiting for API to be ready..."
61+
while ! curl -s -f -o /dev/null http://localhost:8080/v2/builds; do
62+
sleep 10
63+
done
64+
echo "API is ready!"
65+
- name: Install Postman CLI
66+
run: |
67+
curl -o- "https://dl-cli.pstmn.io/install/linux64.sh" | sh
68+
- name: Login to Postman CLI
69+
run: postman login --with-api-key ${{ secrets.POSTMAN_API_KEY }}
70+
71+
- name: Run API tests
72+
#The UUID's are the order the requests are executed in. So that the POST are executed first
73+
run: |
74+
postman collection run 44183872-1d1f2dba-6c47-4764-a847-a6bca216ecea -e 43715313-d380e919-5142-44e6-b52c-02f8b04da8fa -i 44183872-be57d2e3-650d-4494-ba65-6486b68082b0 -i 44183872-f50a0c10-89ef-4352-8a56-3093811b3311 -i 44183872-0a01d698-5d93-4ebf-bd52-6cd7b1af9735 -i 44183872-6229c491-250d-49a4-8388-7a2353129925 -i 44183872-07ac4c2a-037a-4002-a5d1-2e990cfcb1b0 -i 44183872-297df31a-4560-4f27-aa06-31437d59dd7c -i 44183872-47db1e8a-9245-49a6-a6ff-7044b95d8ad3 -i 44183872-beeb6115-2e7b-4a7b-bcd8-eb605a5cd3fc -i 44183872-eff09537-0ab0-4914-a15d-a08270360574 -i 44183872-5003d09d-439f-456a-8864-e6e1f62db807 -i 44183872-a25b9ea2-1c64-4bf1-a5e4-dc905f1a9a6a -i 44183872-7082300f-e721-43f3-9828-1f3bbd25ab0a -i 44183872-6631ed83-0ff4-4515-8fa6-2d57c2959e77 -i 44183872-0a483150-4d00-49f1-8f9a-31ab467f79ec -i 44183872-15ce6497-700f-49f9-949a-ec22bf169c3f -i 44183872-c4097a49-9f17-4d6e-8ff2-a1a1fcec2dff -i 44183872-e357451a-9526-4b57-bb5b-1190e0d6788f -i 44183872-9abfae13-8983-453e-85c5-a3951dddd8e6 -i 44183872-3db33396-563e-4f0a-b074-fc74680c72bd -i 44183872-61b903cb-d623-4b6d-85a3-ab2f7b0575d8 -i 44183872-34fb39a5-5bc2-4528-886a-49e4caf2d9b5 -i 44183872-e34ef3b6-f979-4407-8e69-b972be4d5184 -i 44183872-da7d9d0c-3ab1-457a-a56f-2fa49b151f1d -i 44183872-d7d08dac-364f-4f94-9c48-64dbd77fcadd -i 44183872-a6fad9da-3fae-4c7c-9e15-ec6d67a79b78 -i 44183872-79ff962a-4117-4b91-8cb6-2653b6d5a687 -i 44183872-225a21ca-9106-484c-83b5-1257bc6433e7 -i 44183872-7ac118a2-7f55-4996-a2e6-0b34eb7058ae -i 44183872-4d49d6c6-6367-4ec4-8b4c-6c6154118a3a -i 44183872-dd1b76be-26ee-4b5b-913b-8ce465778229 -i 44183872-ee200410-27ac-4c28-a469-21f487dfbaec -i 44183872-c7676daa-2257-47d6-88ca-178d433a5f28 -i 44183872-f162b5b5-1428-4f9e-8ea5-6bb3b7980b48 -i 44183872-048cddb0-5671-4abb-ac9f-8985c8e4ed6d -i 44183872-a9b4f64a-60be-43e5-bb55-6e16c85c9215 -i 44183872-a26a7e26-0df8-4ad9-95ce-ce168010f631 -i 44183872-9feaad53-dac9-475d-bd71-192d0c844e59 -i 44183872-d09732cd-0395-4b25-85c9-01b9c6a7d43c -i 44183872-1c7dca5b-58aa-4bb6-9224-d703e88b17cd -i 44183872-d183edcc-b144-4e80-9e10-72bf49f535d0 -i 44183872-7451bc15-e0cc-44a8-946b-f09bf024c9eb -i 44183872-3d6e845b-8a82-43b4-a6be-e30effc16d46 -i 44183872-d81fa269-56a3-4eef-934e-39a30e9e5dfd -i 44183872-0ed3bf3e-d78b-4818-bb47-ded64e22525f -i 44183872-fe220b54-58ce-427f-bd19-2f2716cfaa65
75+
- name: Upload logs
76+
if: always()
77+
uses: actions/upload-artifact@v4
78+
with:
79+
name: server-logs
80+
path: |
81+
core.log
82+
api.log

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,5 @@ secrets.*.yaml.dec
5050
.idea/
5151

5252
.DS_Store
53+
54+
src/.DS_Store

src/openapi/api.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2602,7 +2602,6 @@ components:
26022602
type: object
26032603
properties:
26042604
name:
2605-
example: name
26062605
$ref: 'definitions.yaml#/idName'
26072606
required:
26082607
- name
@@ -2615,12 +2614,11 @@ components:
26152614
type: object
26162615
properties:
26172616
name:
2618-
type: string
2617+
$ref: 'definitions.yaml#/idName'
26192618
labels:
26202619
type: object
26212620
properties:
26222621
apl.io/teamId:
2623-
example: team-name
26242622
$ref: 'definitions.yaml#/idName'
26252623
required:
26262624
- apl.io/teamId

src/openapi/build.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,11 @@ buildMode:
118118
name:
119119
title: Name
120120
type: string
121+
example: MY_ENV_VAR
121122
value:
122123
title: Value
123124
type: string
125+
example: my-value
124126
required:
125127
- name
126128
- value

src/openapi/codeRepo.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ AplCodeRepoSpec:
5959
default: false
6060
secret:
6161
type: string
62+
example: my-secret
6263
required:
6364
- gitService
6465
- repositoryUrl

src/openapi/definitions.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ alerts:
108108
annotation:
109109
type: string
110110
pattern: ^((.){1,253}\/)?(.){1,63}$
111+
example: apl.io/annotation
111112
annotations:
112113
description: Kubernetes annotations with arbitrary metadata
113114
type: array
@@ -119,6 +120,7 @@ annotations:
119120
value:
120121
type: string
121122
maxLength: 32767
123+
example: apl-value
122124
autoscaling:
123125
type: object
124126
properties:
@@ -625,6 +627,7 @@ idName:
625627
pattern: ^[a-z]([-a-z0-9]*[a-z0-9])+$
626628
type: string
627629
x-message: a valid name that consists of lowercase letters, dashes
630+
example: team-name
628631
image:
629632
allOf:
630633
- properties:
@@ -654,6 +657,7 @@ imageTag:
654657
pattern: '[\w][\w.-]{0,127}'
655658
type: string
656659
x-message: a valid container registry image tag
660+
example: latest
657661
imageSimple:
658662
properties:
659663
tag:
@@ -951,6 +955,7 @@ repoUrl:
951955
pattern: ^(.+@)*([\w\d\.]+)(:[\d]+){0,1}/*(.*)$
952956
type: string
953957
x-message: a valid git repo URL
958+
example: github.com/example/repo
954959
resource:
955960
properties:
956961
cpu:
@@ -1106,6 +1111,7 @@ svcPredeployed:
11061111
url:
11071112
pattern: ^https?:\/\/[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&\/=]*)
11081113
type: string
1114+
example: https://gituhb.com/example
11091115
vaultToken:
11101116
title: Token
11111117
type: string

src/openapi/netpol.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,12 @@ ruleType:
5555
type: string
5656
title: Selector label name
5757
description: 'The name of the Pod selector label.'
58+
example: app
5859
toLabelValue:
5960
type: string
6061
title: Selector label value
6162
description: 'The value of the Pod selector label.'
63+
example: my-app
6264
mode:
6365
type: string
6466
default: AllowAll
@@ -80,10 +82,12 @@ ruleType:
8082
type: string
8183
title: Selector label name
8284
description: 'The name of the Pod selector label.'
85+
example: app
8386
fromLabelValue:
8487
type: string
8588
title: Selector label value
8689
description: 'The value of the Pod selector label.'
90+
example: my-app
8791
required:
8892
- fromNamespace
8993
required:

src/openapi/service.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,9 +308,11 @@ AplServiceSpec:
308308
name:
309309
title: Name
310310
type: string
311+
example: my-header
311312
value:
312313
title: Value
313314
type: string
315+
example: my-value
314316
required:
315317
- name
316318
- value

0 commit comments

Comments
 (0)