Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add e2e test for OpenSSL #152

Merged
merged 3 commits into from
Feb 23, 2024
Merged

ci: add e2e test for OpenSSL #152

merged 3 commits into from
Feb 23, 2024

Conversation

msanft
Copy link
Contributor

@msanft msanft commented Feb 9, 2024

This adds a tentative E2E test for the OpenSSL deployment. It tries to set up the Nunki cluster in the same way a user would do it, using kubectl to deploy. The actual test's logic is then packed into a Go test, exec'ing into the pods of the deployment and running the actual openssl commands. This does not give much value for this test, as the assertions and orchestration of the execs is very simple, but may take some of the boilerplate away for other, more complicated tests.

Run of the test: https://github.com/edgelesssys/nunki/actions/runs/7875034691

@msanft msanft requested a review from 3u13r February 9, 2024 17:24
@msanft msanft requested a review from katexochen as a code owner February 9, 2024 17:24
@msanft msanft force-pushed the feat/ci/e2e-openssl branch from 93ab112 to 2fd4a05 Compare February 12, 2024 16:43
@msanft msanft marked this pull request as draft February 13, 2024 07:09
@msanft
Copy link
Contributor Author

msanft commented Feb 13, 2024

Marking this as a draft while I try to find out what the issue is. Locally, the test works. Kubectl exec also seems quite brittle in a failing case like this, as it doesn't report the output reliably. Working on a fix

Copy link
Contributor

@burgerdev burgerdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I simplified the PR a bit - the idea is to keep things until nunki set in the justfile, because it's the same logic for all, and then do tests on top - like the openssl tests here.

.github/workflows/e2e_openssl.yml Outdated Show resolved Hide resolved
Comment on lines +31 to +54
- name: Log in to ghcr.io Container registry
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Azure
uses: azure/login@cb79c773a3cfa27f31f25eb3f677781210c9ce3d # v1.6.1
with:
creds: ${{ secrets.NUNKI_CI_INFRA_AZURE }}
- uses: nicknovitski/nix-develop@a2060d116a50b36dfab02280af558e73ab52427d # v1.1.0
- name: Generate namespace suffix
id: ns
run: |
uuid=$(cat /proc/sys/kernel/random/uuid)
uid=${uuid##*-}
echo "namespace_suffix=$uid" >> "$GITHUB_OUTPUT"
- name: Create justfile.env
run: |
cat <<EOF > justfile.env
container_registry=${{ env.container_registry }}
azure_resource_group=${{ env.azure_resource_group }}
namespace_suffix=-${{ steps.ns.outputs.namespace_suffix }}
EOF
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The common steps should maybe go into an action someday.

// namespace the tests are executed in.
const namespaceEnv = "K8S_NAMESPACE"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be part of the library.

e2e/openssl/openssl_test.go Outdated Show resolved Hide resolved
msanft and others added 2 commits February 23, 2024 11:08
@burgerdev burgerdev marked this pull request as ready for review February 23, 2024 10:18
Copy link
Member

@katexochen katexochen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tested this locally and saw the CI job is passing, too.
Looks like a good start. Thanks to both of you! :shipit:

@katexochen katexochen merged commit 3689636 into main Feb 23, 2024
6 checks passed
@katexochen katexochen deleted the feat/ci/e2e-openssl branch February 23, 2024 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants