Skip to content

Commit

Permalink
SecureComms: Add testing facility for e2e tests
Browse files Browse the repository at this point in the history
Modify the .github/workflow files to enable addting e2e tests for secure
comms.

Signed-off-by: David Hadas <[email protected]>
Signed-off-by: David Hadas <[email protected]>
  • Loading branch information
davidhIBM committed Oct 23, 2024
1 parent b5542aa commit 0c2fb6f
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 8 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/e2e_libvirt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ on:
description: Git ref to checkout the cloud-api-adaptor repository. Defaults to main.
required: false
type: string

secure_comms:
default: 'none'
description: SecureComms configuration. Defaults to none.
required: false
type: string
env:
CLOUD_PROVIDER: libvirt
DEBIAN_FRONTEND: noninteractive
Expand Down Expand Up @@ -84,6 +88,7 @@ jobs:

- name: Config Libvirt
run: |
export TEST_E2E_SECURE_COMMS="${{ inputs.secure_comms }}"
./libvirt/config_libvirt.sh
echo "CAA_IMAGE=\"${{ inputs.caa_image }}\"" >> libvirt.properties
# For debugging
Expand Down Expand Up @@ -125,6 +130,7 @@ jobs:
export TEST_PROVISION_FILE="$PWD/libvirt.properties"
export TEST_PODVM_IMAGE="${{ env.PODVM_QCOW2 }}"
export TEST_E2E_TIMEOUT="75m"
export TEST_E2E_SECURE_COMMS="${{ inputs.secure_comms }}"
make test-e2e
Expand Down
16 changes: 9 additions & 7 deletions .github/workflows/e2e_run_all.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ jobs:
prep_install:
needs: [image]
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.matrix.outputs.matrix }}
env:
PROVIDERS: "libvirt"
steps:
Expand Down Expand Up @@ -148,6 +150,11 @@ jobs:
path: src/cloud-api-adaptor/install/
retention-days: 7

- name: Define Test Matrix
id: matrix
run: |
echo "matrix=$(jq -c . < ./src/cloud-api-adaptor/libvirt/e2e_matrix_libvirt.json)" >> "$GITHUB_OUTPUT"
# Run libvirt e2e tests if pull request labeled 'test_e2e_libvirt'
libvirt:
name: libvirt
Expand All @@ -158,17 +165,12 @@ jobs:
needs: [podvm, image, prep_install]
strategy:
fail-fast: false
matrix:
os:
- ubuntu
provider:
- generic
arch:
- amd64
matrix: ${{ fromJSON(needs.prep_install.outputs.matrix) }}
uses: ./.github/workflows/e2e_libvirt.yaml
with:
caa_image: ${{ inputs.registry }}/cloud-api-adaptor:${{ inputs.caa_image_tag }}-dev
podvm_image: ${{ inputs.registry }}/podvm-${{ matrix.provider }}-${{ matrix.os }}-${{ matrix.arch }}:${{ inputs.podvm_image_tag }}
install_directory_artifact: install_directory
git_ref: ${{ inputs.git_ref }}
secure_comms: ${{ matrix.secure_comms }}
secrets: inherit
12 changes: 12 additions & 0 deletions src/cloud-api-adaptor/libvirt/config_libvirt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ installK8sclis() {
fi
}

TEST_E2E_SECURE_COMMS=${TEST_E2E_SECURE_COMMS:-none}.
echo "SECURE_COMMS is ${TEST_E2E_SECURE_COMMS}"

echo "Installing Go..."
installGolang
echo "Installing Libvirt..."
Expand All @@ -118,3 +121,12 @@ rm -f libvirt.properties
echo "libvirt_uri=\"qemu+ssh://${USER}@${IP}/system?no_verify=1\"" >> libvirt.properties
echo "libvirt_ssh_key_file=\"id_rsa\"" >> libvirt.properties
echo "CLUSTER_NAME=\"peer-pods\"" >> libvirt.properties

# switch to the appropriate e2e test and add configs to libvirt.properties as needed
case $TEST_E2E_SECURE_COMMS in

*)
echo "processing none"
echo "SECURE_COMMS=\"false\"" >> libvirt.properties
;;
esac
6 changes: 6 additions & 0 deletions src/cloud-api-adaptor/libvirt/e2e_matrix_libvirt.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"secure_comms": ["none"],
"os": ["ubuntu"],
"provider": ["generic"],
"arch": ["amd64"]
}

0 comments on commit 0c2fb6f

Please sign in to comment.