Skip to content

Commit 976c922

Browse files
committed
Created test_with_ns file in manifests
1 parent 076b3f3 commit 976c922

File tree

3 files changed

+64
-44
lines changed

3 files changed

+64
-44
lines changed

.github/workflows/run-integration-tests-namespace-optional.yml

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ jobs:
4848
run: |
4949
kubectl create ns ${{ env.NAMESPACE1 }}
5050
kubectl create ns ${{ env.NAMESPACE2 }}
51+
kubectl create ns test-namespace
5152
5253
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # 5.6.0
5354
name: Install Python
@@ -56,44 +57,44 @@ jobs:
5657

5758
- name: Cleaning any previously created items
5859
run: |
59-
python test/integration/k8s-deploy-delete.py 'Deployment' 'all' ${{ env.NAMESPACE1 }}
60-
python test/integration/k8s-deploy-delete.py 'Deployment' 'all' ${{ env.NAMESPACE2 }}
60+
python test/integration/k8s-deploy-delete.py 'Deployment' 'all' ${{ env.NAMESPACE1 }}
61+
python test/integration/k8s-deploy-delete.py 'Deployment' 'all' ${{ env.NAMESPACE2 }}
6162
- name: Create test manifests
6263
run: |
63-
echo "Creating test manifests..."
64-
cat <<EOF > test_with_ns.yaml
65-
apiVersion: apps/v1
66-
kind: Deployment
67-
metadata:
68-
name: test-deployment
69-
namespace: ${{ env.NAMESPACE1 }}
70-
spec:
71-
replicas: 1
72-
selector:
73-
matchLabels:
74-
app: test-app
75-
template:
76-
metadata:
77-
labels:
78-
app: test-app
79-
spec:
80-
containers:
81-
- name: test-container
82-
image: nginx:latest
83-
ports:
84-
- containerPort: 80
64+
echo "Creating test manifests..."
65+
cat <<EOF > test_with_ns.yaml
66+
apiVersion: apps/v1
67+
kind: Deployment
68+
metadata:
69+
name: test-deployment
70+
namespace: ${{ env.NAMESPACE1 }}
71+
spec:
72+
replicas: 1
73+
selector:
74+
matchLabels:
75+
app: test-app
76+
template:
77+
metadata:
78+
labels:
79+
app: test-app
80+
spec:
81+
containers:
82+
- name: test-container
83+
image: nginx:latest
84+
ports:
85+
- containerPort: 80
8586
- name: Test - Handles namespace correctly based on manifest
8687
uses: ./
8788
with:
8889
images: nginx:1.14.2
8990
manifests: |
90-
test_with_ns.yaml
91+
test/integration/manifests/test_with_ns.yaml
9192
test/integration/manifests/test_no_ns.yaml
9293
action: deploy
9394

9495
- name: Verify deployment in namespace1
9596
run: |
96-
python test/integration/k8s-deploy-test.py namespace=${{ env.NAMESPACE1 }} kind=Deployment name=test-deployment containerName=nginx:1.14.2 labels=app:test-app selectorLabels=app:test-app
97+
python test/integration/k8s-deploy-test.py namespace=test-namespace kind=Deployment name=test-deployment containerName=nginx:1.14.2 labels=app:test-app selectorLabels=app:test-app
9798
9899
- name: Verify deployment in default namespace
99100
run: |
@@ -102,7 +103,7 @@ jobs:
102103
- name: Test - Deploys the same resource to two different namespaces without conflict
103104
uses: ./
104105
with:
105-
namespace: ${{ env.NAMESPACE1 }},${{ env.NAMESPACE2 }}
106+
namespace: ${{ env.NAMESPACE1 }},${{ env.NAMESPACE2 }}
106107
images: nginx:1.14.2
107108
manifests: |
108109
test/integration/manifests/test_no_ns.yaml
@@ -123,5 +124,4 @@ jobs:
123124
124125
kubectl delete ns ${{ env.NAMESPACE1 }}
125126
kubectl delete ns ${{ env.NAMESPACE2 }}
126-
rm -rf test_with_ns.yaml
127-
127+
rm -rf test_with_ns.yaml test_no_ns.yaml
Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
apiVersion: apps/v1
22
kind: Deployment
33
metadata:
4-
name: test-deployment-no-ns
4+
name: test-deployment-no-ns
55
spec:
6-
replicas: 1
7-
selector:
8-
matchLabels:
9-
app: test-app
10-
template:
11-
metadata:
12-
labels:
13-
app: test-app
14-
spec:
15-
containers:
16-
- name: test-container
17-
image: nginx
18-
ports:
19-
- containerPort: 80
6+
replicas: 1
7+
selector:
8+
matchLabels:
9+
app: test-app
10+
template:
11+
metadata:
12+
labels:
13+
app: test-app
14+
spec:
15+
containers:
16+
- name: test-container
17+
image: nginx
18+
ports:
19+
- containerPort: 80
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: test-deployment
5+
namespace: test-namespace
6+
spec:
7+
replicas: 1
8+
selector:
9+
matchLabels:
10+
app: test-app
11+
template:
12+
metadata:
13+
labels:
14+
app: test-app
15+
spec:
16+
containers:
17+
- name: test-container
18+
image: nginx
19+
ports:
20+
- containerPort: 80

0 commit comments

Comments
 (0)