Skip to content

Commit 5af100c

Browse files
authored
feat: add integration tests with coveralls report (#41)
* feat: add integration tests with coveralls report * fix: wrong working directory * fix: remove pytest * fix: add poetry install * fix: change deck file path * fix: change deck file path * fix: add deck file * fix: change path * fix: add new deck config from gefyra demo * fix: remove option from stop command
1 parent f7b1655 commit 5af100c

File tree

4 files changed

+356
-24
lines changed

4 files changed

+356
-24
lines changed

.github/workflows/python-tester.yaml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: pytest and try it yourself example
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
timeout-minutes: 5
13+
steps:
14+
- uses: actions/checkout@v2
15+
- name: Set up Python
16+
uses: actions/setup-python@v2
17+
with:
18+
python-version: '3.x'
19+
- name: Install Poetry
20+
uses: snok/install-poetry@v1
21+
- name: Poetry installation
22+
run: |
23+
poetry install
24+
# Run the 'Try it yourself'
25+
- uses: Getdeck/getdeck-action@main
26+
name: Create Infrastructure from Deckfile
27+
with:
28+
deck-file-path: https://github.com/gefyrahq/gefyra-demos.git
29+
- name: Remove cluster using getdeck
30+
run: |
31+
poetry run coverage run -a -m getdeck remove deck.gefyra.test.yaml --name oauth2-demo
32+
- name: Create a cluster using getdeck
33+
run: |
34+
poetry run coverage run -a -m getdeck get deck.gefyra.test.yaml --name oauth2-demo
35+
- name: Stop cluster
36+
run: |
37+
poetry run coverage run -a -m getdeck stop deck.gefyra.test.yaml
38+
- name: Show coverage report
39+
run: |
40+
poetry run coverage report
41+
- name: Upload coverage data to coveralls.io
42+
env:
43+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44+
COVERALLS_FLAG_NAME: ${{ matrix.python-version }}
45+
COVERALLS_PARALLEL: true
46+
run: |
47+
poetry run coveralls --service=github
48+
coveralls:
49+
name: Indicate completion to coveralls.io
50+
# need secrets.GITHUB_TOKEN
51+
needs: test
52+
runs-on: ubuntu-latest
53+
container: python:3-slim
54+
steps:
55+
- name: Finished
56+
run: |
57+
pip3 install --upgrade coveralls
58+
coveralls --finish
59+
env:
60+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

deck.gefyra.test.yaml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
version: "1"
2+
3+
# the cluster configuration across all decks
4+
cluster:
5+
provider: k3d
6+
minVersion: 4.0.0
7+
name: gefyra-demos
8+
nativeConfig: # content of the native config file (e.g. https://k3d.io/v5.0.0/usage/configfile/)
9+
apiVersion: k3d.io/v1alpha2
10+
kind: Simple
11+
servers: 1 # same as `--servers 1`
12+
agents: 1 # same as `--agents 2`
13+
image: rancher/k3s:v1.22.9-k3s1
14+
ports:
15+
- port: 8080:80
16+
nodeFilters:
17+
- loadbalancer
18+
- port: 31820:31820/UDP
19+
nodeFilters:
20+
- agent[0]
21+
22+
decks:
23+
- name: oauth2-demo
24+
namespace: oauth2-demo
25+
notes: |
26+
Please find the app at: http://oauth2-demo.127.0.0.1.nip.io:8080/ with username '[email protected]' and password '[email protected]'.
27+
The Kubernetes dashboard is running at: http://dashboard.127.0.0.1.nip.io:8080
28+
sources:
29+
- type: helm
30+
ref: https://codecentric.github.io/helm-charts
31+
chart: keycloak
32+
releaseName: keycloak
33+
parameters:
34+
- name: ingress.enabled
35+
value: true
36+
- name: ingress.rules[0].host
37+
value: keycloak.127.0.0.1.nip.io
38+
- name: ingress.rules[0].paths[0].path
39+
value: "/"
40+
- name: ingress.rules[0].paths[0].pathType
41+
value: Prefix
42+
- name: ingress.console.enabled
43+
value: true
44+
- name: ingress.console.rules[0].host
45+
value: keycloak.127.0.0.1.nip.io
46+
- name: ingress.console.rules[0].paths[0].path
47+
value: "/auth/admin"
48+
- name: ingress.console.rules[0].paths[0].pathType
49+
value: Prefix
50+
- type: file
51+
ref: https://raw.githubusercontent.com/gefyrahq/gefyra-demos/main/oauth2-demo/initialize-kc.yaml
52+
53+
- type: file
54+
ref: https://raw.githubusercontent.com/gefyrahq/gefyra-demos/main/oauth2-demo/oauth2-demo.yaml
55+
56+
# Everything below: Kubernetes Dashboard
57+
- type: helm
58+
ref: https://kubernetes.github.io/dashboard/
59+
chart: kubernetes-dashboard
60+
releaseName: dashboard
61+
parameters:
62+
- name: ingress.enabled
63+
value: true
64+
- name: ingress.hosts
65+
value: '{dashboard.127.0.0.1.nip.io}'
66+
- name: protocolHttp
67+
value: true
68+
- name: service.externalPort
69+
value: 61348
70+
- name: serviceAccount.create
71+
value: true
72+
- name: serviceAccount.name
73+
value: kubernetes-dashboard
74+
75+
- type: file
76+
content:
77+
apiVersion: rbac.authorization.k8s.io/v1
78+
kind: ClusterRoleBinding
79+
metadata:
80+
name: kubernetes-dashboard
81+
namespace: kubernetes-dashboard
82+
roleRef:
83+
apiGroup: rbac.authorization.k8s.io
84+
kind: ClusterRole
85+
name: cluster-admin
86+
subjects:
87+
- kind: ServiceAccount
88+
name: kubernetes-dashboard
89+
namespace: oauth2-demo

0 commit comments

Comments
 (0)