Skip to content

Commit a7ab0ec

Browse files
authored
Add smoke tests to partner (#246)
1 parent 790d1ee commit a7ab0ec

File tree

1 file changed

+92
-0
lines changed

1 file changed

+92
-0
lines changed

.github/workflows/pre-main.yml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,24 @@ name: Test Incoming Changes
66
pull_request:
77
branches: [main]
88
workflow_dispatch:
9+
env:
10+
REGISTRY: quay.io
11+
REGISTRY_LOCAL: localhost
12+
TNF_IMAGE_NAME: testnetworkfunction/cnf-certification-test
13+
TNF_IMAGE_TAG: unstable
14+
OCT_IMAGE_NAME: testnetworkfunction/oct
15+
OCT_IMAGE_TAG: latest
16+
TNF_CONTAINER_CLIENT: docker
17+
TNF_NON_INTRUSIVE_ONLY: false
18+
TNF_ALLOW_PREFLIGHT_INSECURE: false
19+
TNF_DISABLE_CONFIG_AUTODISCOVER: false
20+
TNF_CONFIG_DIR: /tmp/tnf/config
21+
TNF_OUTPUT_DIR: /tmp/tnf/output
22+
TNF_SRC_URL: 'https://github.com/${{ github.repository }}'
23+
TESTING_CMD_PARAMS: '-n host -i ${REGISTRY_LOCAL}/${TNF_IMAGE_NAME}:${TNF_IMAGE_TAG} -t ${TNF_CONFIG_DIR} -o ${TNF_OUTPUT_DIR}'
24+
TNF_SMOKE_TESTS_LOG_LEVEL: trace
25+
ON_DEMAND_DEBUG_PODS: false
26+
TERM: xterm-color
927
jobs:
1028
linters:
1129
runs-on: ubuntu-22.04
@@ -35,3 +53,77 @@ jobs:
3553
level: warning
3654
braces:
3755
level: warning
56+
smoke-tests:
57+
name: Run Smoke Tests
58+
runs-on: ubuntu-22.04
59+
env:
60+
SHELL: /bin/bash
61+
KUBECONFIG: '/home/runner/.kube/config'
62+
PFLT_DOCKERCONFIG: '/home/runner/.docker/config'
63+
64+
steps:
65+
- name: Set up Go 1.20
66+
uses: actions/setup-go@v3
67+
with:
68+
go-version: 1.20.2
69+
70+
- name: Disable default go problem matcher
71+
run: echo "::remove-matcher owner=go::"
72+
73+
- name: Write temporary docker file
74+
run: |
75+
mkdir -p /home/runner/.docker
76+
touch ${PFLT_DOCKERCONFIG}
77+
echo '{ "auths": {} }' >> ${PFLT_DOCKERCONFIG}
78+
79+
- name: Check out `cnf-certification-test-partner`
80+
uses: actions/checkout@v3
81+
with:
82+
ref: ${{ github.sha }}
83+
84+
- name: Start the k8s cluster
85+
uses: ./.github/actions/start-k8s-cluster
86+
87+
- name: Create `local-test-infra` OpenShift resources
88+
uses: ./.github/actions/create-local-test-infra-resources
89+
90+
- name: Check out `cnf-certification-test`
91+
uses: actions/checkout@v3
92+
with:
93+
repository: test-network-function/cnf-certification-test
94+
path: cnf-certification-test
95+
96+
# Clone and run the cnf-certification-test repo as a container
97+
- name: Build the `cnf-certification-test` image
98+
run: |
99+
make build-image-local
100+
env:
101+
IMAGE_TAG: ${TNF_IMAGE_TAG}
102+
working-directory: cnf-certification-test
103+
104+
- name: Create required TNF config files and directories
105+
run: |
106+
mkdir -p $TNF_CONFIG_DIR $TNF_OUTPUT_DIR
107+
cp cnf-certification-test/*.yml $TNF_CONFIG_DIR
108+
shell: bash
109+
working-directory: cnf-certification-test
110+
111+
- name: 'Test: Run without any TS, just get diagnostic information'
112+
run: TNF_LOG_LEVEL=${TNF_SMOKE_TESTS_LOG_LEVEL} ./run-tnf-container.sh ${{ env.TESTING_CMD_PARAMS }}
113+
working-directory: cnf-certification-test
114+
115+
- name: 'Test: Run Smoke Tests in a TNF container'
116+
run: TNF_LOG_LEVEL=${TNF_SMOKE_TESTS_LOG_LEVEL} ./run-tnf-container.sh ${{ env.TESTING_CMD_PARAMS }} -l "common"
117+
working-directory: cnf-certification-test
118+
119+
- name: Upload container test results as an artifact
120+
uses: actions/upload-artifact@v3
121+
if: always()
122+
with:
123+
name: smoke-tests-container
124+
path: |
125+
${{ env.TNF_OUTPUT_DIR }}/*.xml
126+
${{ env.TNF_OUTPUT_DIR }}/claim.json
127+
${{ env.TNF_OUTPUT_DIR }}/claimjson.js
128+
${{ env.TNF_OUTPUT_DIR }}/results.html
129+
${{ env.TNF_OUTPUT_DIR }}/tnf-execution.log

0 commit comments

Comments
 (0)