-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
072c6f8
commit 1689b41
Showing
1 changed file
with
180 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,180 @@ | ||
# https://developers.redhat.com/content-gateway/rest/mirror/pub/openshift-v4/clients/crc/latest/crc-linux-amd64.tar.xz | ||
|
||
name: CRC Tests | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
workflow_dispatch: | ||
env: | ||
REGISTRY: quay.io | ||
REGISTRY_LOCAL: localhost | ||
TNF_IMAGE_NAME: testnetworkfunction/cnf-certification-test | ||
TNF_IMAGE_TAG: unstable | ||
OCT_IMAGE_NAME: testnetworkfunction/oct | ||
OCT_IMAGE_TAG: latest | ||
TNF_CONTAINER_CLIENT: docker | ||
TNF_NON_INTRUSIVE_ONLY: false | ||
TNF_ALLOW_PREFLIGHT_INSECURE: false | ||
TNF_DISABLE_CONFIG_AUTODISCOVER: false | ||
TNF_CONFIG_DIR: /tmp/tnf/config | ||
TNF_OUTPUT_DIR: /tmp/tnf/output | ||
TNF_SRC_URL: 'https://github.com/${{ github.repository }}' | ||
TESTING_CMD_PARAMS: '-n host -i ${REGISTRY_LOCAL}/${TNF_IMAGE_NAME}:${TNF_IMAGE_TAG} -t ${TNF_CONFIG_DIR} -o ${TNF_OUTPUT_DIR}' | ||
TNF_SMOKE_TESTS_LOG_LEVEL: trace | ||
ON_DEMAND_DEBUG_PODS: false | ||
TERM: xterm-color | ||
|
||
jobs: | ||
smoke-tests: | ||
name: Run Smoke Tests Against OpenShift Local | ||
runs-on: macos-latest | ||
env: | ||
SHELL: /bin/bash | ||
KUBECONFIG: '/Users/runner/.kube/config' | ||
PFLT_DOCKERCONFIG: '/Users/runner/.docker/config' | ||
|
||
steps: | ||
- name: Write temporary docker file | ||
run: | | ||
mkdir -p /Users/runner/.docker | ||
touch ${PFLT_DOCKERCONFIG} | ||
echo '{ "auths": {} }' >> ${PFLT_DOCKERCONFIG} | ||
- name: Set up Go 1.20.2 | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.20.2 | ||
|
||
- name: Download brew | ||
run: | | ||
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | ||
- name: Install the oc binaries | ||
run: | | ||
brew install openshift-cli | ||
- name: Disable default go problem matcher | ||
run: echo "::remove-matcher owner=go::" | ||
|
||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.sha }} | ||
|
||
- name: check if CRC_PULL_SECRET exists | ||
env: | ||
super_secret: ${{ secrets.CRC_PULL_SECRET }} | ||
if: ${{ env.super_secret == '' }} | ||
run: 'echo the secret \"CRC_PULL_SECRET\" has not been made; echo please go to \"settings \> secrets \> actions\" to create it' | ||
|
||
- name: Write the pull secret to json file | ||
run: | | ||
echo $CRC_PULL_SECRET > temp-ps.json | ||
cat temp-ps.json | ||
env: | ||
CRC_PULL_SECRET: ${{ secrets.CRC_PULL_SECRET }} | ||
shell: bash | ||
|
||
# Create a OpenShift Local Cluster for testing | ||
- name: Curl the CRC binary | ||
run: | | ||
wget -O crc-macos-installer.pkg https://developers.redhat.com/content-gateway/rest/mirror/pub/openshift-v4/clients/crc/latest/crc-macos-installer.pkg | ||
- name: Install CRC | ||
run: | | ||
sudo installer -pkg crc-macos-installer.pkg -target / | ||
# - name: Set podman preset as part of config | ||
# run: crc config set preset podman | ||
|
||
# - name: Enable networking | ||
# run: | | ||
# sudo tee -a /etc/sysctl.conf <<< 'net.ipv4.ip_forward=1' | ||
# sudo sysctl -p | ||
|
||
- name: Run CRC Setup | ||
run: | | ||
crc setup; sleep 60 | ||
- name: Set Memory | ||
run: | | ||
crc config set memory 14000; sleep 60 | ||
- name: Run CRC Start | ||
run: | | ||
crc start --pull-secret-file temp-ps.json --log-level debug | ||
- name: Check out `cnf-certification-test-partner` | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: test-network-function/cnf-certification-test-partner | ||
path: cnf-certification-test-partner | ||
|
||
- name: Create `local-test-infra` OpenShift resources | ||
uses: ./cnf-certification-test-partner/.github/actions/create-local-test-infra-resources | ||
with: | ||
working_directory: cnf-certification-test-partner | ||
|
||
# Update the CNF containers, helm charts and operators DB | ||
|
||
- name: Update the CNF DB | ||
run: | | ||
docker pull ${REGISTRY}/${OCT_IMAGE_NAME}:${OCT_IMAGE_TAG} | ||
mkdir -p ${GITHUB_WORKSPACE}/offline-db | ||
docker run -v ${GITHUB_WORKSPACE}/offline-db:/tmp/dump:Z --env OCT_DUMP_ONLY=true ${REGISTRY}/${OCT_IMAGE_NAME}:${OCT_IMAGE_TAG} | ||
- name: Install ginkgo | ||
run: make install-tools | ||
|
||
- name: Execute `make build` | ||
run: make build | ||
|
||
# Perform smoke tests. | ||
- name: 'Test: Run test suites' | ||
run: TNF_LOG_LEVEL=${TNF_SMOKE_TESTS_LOG_LEVEL} ./run-cnf-suites.sh -l "common" | ||
|
||
- name: Upload smoke test results as an artifact | ||
uses: actions/upload-artifact@v3 | ||
if: always() | ||
with: | ||
name: smoke-tests | ||
path: | | ||
cnf-certification-test/*.xml | ||
cnf-certification-test/claim.json | ||
cnf-certification-test/claimjson.js | ||
cnf-certification-test/results.html | ||
cnf-certification-test/tnf-execution.log | ||
# Perform smoke tests using a TNF container. | ||
- name: Build the `cnf-certification-test` image | ||
run: | | ||
make build-image-local | ||
env: | ||
IMAGE_TAG: ${TNF_IMAGE_TAG} | ||
|
||
- name: Create required TNF config files and directories | ||
run: | | ||
mkdir -p $TNF_CONFIG_DIR $TNF_OUTPUT_DIR | ||
cp cnf-certification-test/*.yml $TNF_CONFIG_DIR | ||
- name: 'Test: Run without any TS, just get diagnostic information' | ||
run: TNF_LOG_LEVEL=${TNF_SMOKE_TESTS_LOG_LEVEL} ./run-tnf-container.sh ${{ env.TESTING_CMD_PARAMS }} | ||
|
||
- name: 'Test: Run Smoke Tests in a TNF container' | ||
run: TNF_LOG_LEVEL=${TNF_SMOKE_TESTS_LOG_LEVEL} ./run-tnf-container.sh ${{ env.TESTING_CMD_PARAMS }} -l "common" | ||
|
||
- name: Upload container test results as an artifact | ||
uses: actions/upload-artifact@v3 | ||
if: always() | ||
with: | ||
name: smoke-tests-container | ||
path: | | ||
${{ env.TNF_OUTPUT_DIR }}/*.xml | ||
${{ env.TNF_OUTPUT_DIR }}/claim.json | ||
${{ env.TNF_OUTPUT_DIR }}/claimjson.js | ||
${{ env.TNF_OUTPUT_DIR }}/results.html | ||
${{ env.TNF_OUTPUT_DIR }}/tnf-execution.log |