Skip to content

Commit 56d6d9b

Browse files
authored
add environment for e2e tests (linode#311)
* add environment for e2e tests * checkout pull request head * fix test failing due to service getting deleted and retry failing
1 parent d2d1c76 commit 56d6d9b

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ jobs:
2222
paths: ${{ steps.filter.outputs.changes }}
2323
steps:
2424
- uses: actions/[email protected]
25+
with:
26+
ref: ${{ github.event.pull_request.head.sha }}
2527
- name: Harden Runner
2628
uses: step-security/harden-runner@v2
2729
with:
@@ -38,6 +40,7 @@ jobs:
3840

3941
build-test:
4042
runs-on: ubuntu-latest
43+
environment: ${{ github.event.pull_request.head.repo.fork == true && 'prod-external' || 'prod' }}
4144
needs: changes
4245
if: ${{ contains(fromJSON(needs.changes.outputs.paths), 'src') }}
4346
steps:
@@ -62,7 +65,7 @@ jobs:
6265
6366
- uses: actions/[email protected]
6467
with:
65-
fetch-depth: 0
68+
ref: ${{ github.event.pull_request.head.sha }}
6669
- uses: actions/setup-go@v5
6770
with:
6871
go-version-file: go.mod
@@ -95,6 +98,7 @@ jobs:
9598

9699
docker-build:
97100
runs-on: ubuntu-latest
101+
environment: ${{ github.event.pull_request.head.repo.fork == true && 'prod-external' || 'prod' }}
98102
steps:
99103
- uses: actions/[email protected]
100104
with:
@@ -120,6 +124,7 @@ jobs:
120124
121125
e2e-tests:
122126
runs-on: ubuntu-latest
127+
environment: ${{ github.event.pull_request.head.repo.fork == true && 'prod-external' || 'prod' }}
123128
needs: changes
124129
if: ${{ contains(fromJSON(needs.changes.outputs.paths), 'src') }}
125130
env:
@@ -133,7 +138,7 @@ jobs:
133138
steps:
134139
- uses: actions/[email protected]
135140
with:
136-
fetch-depth: 0
141+
ref: ${{ github.event.pull_request.head.sha }}
137142

138143
- name: Set up Go
139144
uses: actions/setup-go@v5

e2e/test/lb-fw-delete-acl/chainsaw-test.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@ spec:
117117
content: |
118118
set -e
119119
120+
nbid=0
121+
fwid=0
122+
120123
for i in {1..10}; do
121124
nbid=$(KUBECONFIG=$KUBECONFIG NAMESPACE=$NAMESPACE LINODE_TOKEN=$LINODE_TOKEN ../scripts/get-nb-id.sh)
122125
@@ -128,6 +131,18 @@ spec:
128131
129132
fwid=$(echo $fw | jq -r '.data[].id')
130133
134+
if [[ $nbid -ne 0 && $fwid -ne 0 ]]; then
135+
break
136+
fi
137+
sleep 2
138+
done
139+
140+
if [[ $nbid -eq 0 || $fwid -eq 0 ]]; then
141+
echo "nb or fw not found"
142+
exit 1
143+
fi
144+
145+
for i in {1..10}; do
131146
# Remove service
132147
kubectl delete service svc-test -n $NAMESPACE --ignore-not-found
133148
sleep 5
@@ -145,6 +160,7 @@ spec:
145160
-H "Authorization: Bearer $LINODE_TOKEN" \
146161
-H "accept: application/json" \
147162
"https://api.linode.com/v4/networking/firewalls/${fwid}" || true)
163+
148164
if [[ $nbRespCode == "404" && $fwRespCode == "404" ]]; then
149165
echo "nb and fw deleted"
150166
break

0 commit comments

Comments
 (0)