Skip to content

Commit

Permalink
feat: Automate manual E2E testing
Browse files Browse the repository at this point in the history
  • Loading branch information
juanjjaramillo committed Nov 23, 2023
1 parent aa593af commit 12c8bba
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 6 deletions.
49 changes: 43 additions & 6 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,26 @@ jobs:


integration:
name: Integration and e2e tests
name: Integration and E2E tests
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
k8sVersion: [ "v1.28.3", "v1.27.5", "v1.26.8", "v1.25.13", "v1.24.17"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'
- uses: helm/[email protected]

- name: Kind action
uses: helm/[email protected]
with:
kubectl_version: ${{ matrix.k8sVersion }}

- name: Create k8s Kind Cluster
run: make kind-up
Expand Down Expand Up @@ -158,9 +169,35 @@ jobs:
--values values-dev.yaml --values values-local.yaml \
--wait --timeout 240s
- name: Run e2e tests
run: make test-e2e
- name: Confirm external.metrics.k8s.io API implementation details
env:
ENDPOINT: '/apis/external.metrics.k8s.io/v1beta1/namespaces/*/e2e/'
KUBECONFIG: ./kubeconfig # Generated by `make kind-up`
run: |
sleep 30
KIND=$(kubectl get --raw "${ENDPOINT}" | jq '.kind')
API_VERSION=$(kubectl get --raw "${ENDPOINT}" | jq '.apiVersion')
METRIC_NAME=$(kubectl get --raw "${ENDPOINT}" | jq '.items[0].metricName')
VALUE=$(kubectl get --raw "${ENDPOINT}" | jq '.items[0].value')
if [[ ${KIND} != '"ExternalMetricValueList"' ]]; then
echo "KIND: found '${KIND}' != expected '\"ExternalMetricValueList\"'"
exit 1
fi
if [[ ${API_VERSION} != '"external.metrics.k8s.io/v1beta1"' ]]; then
echo "API_VERSION: found '${API_VERSION}' != expected '\"external.metrics.k8s.io/v1beta1\"'"
exit 1
fi
if [[ ${METRIC_NAME} != '"e2e"' ]]; then
echo "METRIC_NAME: found '${METRIC_NAME}' != expected '\"e2e\"'"
exit 1
fi
if [[ ${VALUE} != '"123m"' ]]; then
echo "VALUE: found '${VALUE}' != expected '\"123m\"'"
exit 1
fi
- name: Run E2E tests
run: make test-e2e

static-analysis:
name: Static analysis and linting
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## Unreleased
### enhancement
- E2E testing: use `autoscaling/v2` instead of `autoscaling/v2beta2` by @juanjjaramillo in [#252](https://github.com/newrelic/newrelic-k8s-metrics-adapter/pull/252)
- Make E2E testing run for all supported K8s versions by @juanjjaramillo in [#253](https://github.com/newrelic/newrelic-k8s-metrics-adapter/pull/253)

## v0.8.0 - 2023-11-13

Expand Down

0 comments on commit 12c8bba

Please sign in to comment.