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

feat: Create E2E workflow #379

Merged
merged 5 commits into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ jobs:
run: make ci

integration:
name: Integration and e2e
name: Run integration and test-e2e tests
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
Expand Down Expand Up @@ -165,7 +165,7 @@ jobs:
--values ./values-dev.yaml \
--set image.repository=localhost:5000/newrelic-infra-operator

- name: Run e2e tests
- name: Run test-e2e tests
run: make test-e2e

static-analysis:
Expand Down
80 changes: 80 additions & 0 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: E2E over minikube

on:
pull_request:
push:
branches:
- main
- renovate/**

jobs:
e2eTests:
name: Run E2E Tests
# Do not run e2e tests if PR has skip-e2e label
if: ${{ ! contains(github.event.pull_request.labels.*.name, 'ci/skip-e2e') }}
runs-on: ubuntu-latest
strategy:
matrix:
# Latest patch version can be found in https://kubernetes.io/releases/patch-releases/
# Some versions might not be available yet in https://storage.googleapis.com/kubernetes-release/release/v1.X.Y/bin/linux/amd64/kubelet
k8sVersion: [ "v1.28.3", "v1.27.5", "v1.26.8","v1.25.13", "v1.24.17"]
cri: [ containerd ]
steps:
- name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Setup Go
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version-file: 'go.mod'

- name: Setup Minikube
uses: manusa/actions-setup-minikube@3856c6fa039819f1c8e7e248b1fc5a8564e354c9 # v2.9.0
with:
minikube version: v1.32.0
kubernetes version: ${{ matrix.k8sVersion }}
driver: docker
start args: "--container-runtime=${{ matrix.cri }}"

- name: Compile, build and load Images
run: |
GOOS=linux GOARCH=amd64 make compile # Set GOOS and GOARCH explicitly since Dockerfile expects them in the binary name
docker build --tag e2e/newrelic-infra-operator:e2e .
minikube image load e2e/newrelic-infra-operator:e2e

- name: Setup Helm
run: |
helm repo add newrelic-infra-operator https://newrelic.github.io/newrelic-infra-operator
helm repo update

- name: Select metrics exception file
id: exceptions-version
run: |
MINOR=$(echo "${{ matrix.k8sVersion }}"|sed -e 's_v\([0-9]\+\)\.\([0-9]\+\)\.\([0-9]\+\)_\2_')

echo $MINOR

if [ "$MINOR" -eq 24 ]; then
echo "exceptions=1_24" >> $GITHUB_OUTPUT
elif [ "$MINOR" -eq 25 ]; then
echo "exceptions=1_25" >> $GITHUB_OUTPUT
elif [ "$MINOR" -eq 26 ]; then
echo "exceptions=1_26" >> $GITHUB_OUTPUT
elif [ "$MINOR" -eq 27 ]; then
echo "exceptions=1_27" >> $GITHUB_OUTPUT
elif [ "$MINOR" -eq 28 ]; then
echo "exceptions=1_28" >> $GITHUB_OUTPUT
fi

- name: Run E2E test
uses: newrelic/newrelic-integration-e2e-action@a97ced80a4841c8c6261d1f9dca6706b1d89acb1 # v1.11.0
env:
EXCEPTIONS_SOURCE_FILE: ${{ steps.exceptions-version.outputs.exceptions }}-exceptions.yml
with:
retry_seconds: 60
retry_attempts: 5
agent_enabled: false
spec_path: e2e/test-specs.yml
account_id: ${{ secrets.K8S_AGENTS_E2E_ACCOUNT_ID }}
api_key: ${{ secrets.K8S_AGENTS_E2E_API_KEY }}
license_key: ${{ secrets.K8S_AGENTS_E2E_LICENSE_KEY }}
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### enhancement
- Create E2E resources Helm chart by @juanjjaramillo in [#377](https://github.com/newrelic/newrelic-infra-operator/pull/377)
- Create E2E tests by @juanjjaramillo in [#378](https://github.com/newrelic/newrelic-infra-operator/pull/378)
- Create E2E workflow by @juanjjaramillo in [#379](https://github.com/newrelic/newrelic-infra-operator/pull/379)
juanjjaramillo marked this conversation as resolved.
Show resolved Hide resolved

## v0.13.0 - 2023-11-13

Expand Down
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,26 +131,28 @@ Now, when you make changes to the code, the operator binary will be built locall

#### Testing

##### Unit testing
In order to run unit tests run:
```sh
make test
```
In order to run unit tests run:
##### Integration and test-e2e testing
In order to run integration and test-e2e tests run:

```sh
make test-integration
make test-e2e
```

Notice that in order to run both integration tests and E2e, you will need a working environment available with the
Notice that in order to run both integration and test-e2e tests, you will need a working environment available with the
`newrelic-infra-operator` running.
Both installing the `newrelic-infra-operator` chart or spinning up the environment with `make tilt-up` are possible options.

It is also possible to run such tests against any cluster you have access to by setting the environment variable
`TEST_KUBECONFIG=/your/kube/config/path`.

E2E Testing (Metric NRQL queries):
Read the [E2E README](./e2e/README.md) for more details regarding running E2E tests to check for NRQL Metric queries.
##### E2E testing
In order to run E2E tests, read the [E2E README](./e2e/README.md) for more details regarding running E2E tests.

## Support

Expand Down
Loading