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

[WIP] integration testing setup #320

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
40 changes: 35 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,30 @@
version: 2.1

orbs:
rok8s: fairwinds/rok8s-scripts@11
rok8s: fairwinds/rok8s-scripts@14
oss-docs: fairwinds/oss-docs@0

executors:
golang-exec:
docker:
- image: cimg/go:1.21

references:
e2e_config: &e2e_config
command_runner_image: quay.io/reactiveops/ci-images:v14-bullseye
kind_node_image: "kindest/node:v1.29.4@sha256:3abb816a5b1061fb15c6e9e60856ec40d56b7b52bcea5f5f1350bc6e2320b6f8"
executor: golang-exec
pre_script: e2e/pre.sh
store-test-results: /tmp/test-results/
store-artifacts: /tmp/test-results/
script: e2e/test.sh
requires:
- test
filters:
branches:
only: /.*/
tags:
ignore: /.*/
install_vault: &install_vault
run:
name: install hashicorp vault
Expand All @@ -18,7 +38,7 @@ references:
jobs:
test:
docker:
- image: cimg/go:1.21
- image: cimg/go:1.22
steps:
- checkout
- run:
Expand All @@ -43,11 +63,11 @@ jobs:
working_directory: /go/src/github.com/fairwindsops/nova
resource_class: large
docker:
- image: goreleaser/goreleaser:v1.22.1
- image: goreleaser/goreleaser:v2.0.1
steps:
- checkout
- setup_remote_docker
- run: goreleaser --snapshot
- run: goreleaser --snapshot --skip sign
- store_artifacts:
path: dist
destination: snapshot
Expand All @@ -56,7 +76,7 @@ jobs:
resource_class: large
shell: /bin/bash
docker:
- image: goreleaser/goreleaser:v1.22.1
- image: goreleaser/goreleaser:v2.0.1
steps:
- checkout
- setup_remote_docker
Expand All @@ -82,6 +102,16 @@ workflows:
only: /.*/
tags:
ignore: /.*/
- rok8s/kubernetes_e2e_tests:
requires:
- test
filters:
branches:
only: /.*/
tags:
ignore: /.*/
name: functional tests
<<: *e2e_config
release:
jobs:
- oss-docs/publish-docs:
Expand Down
5 changes: 3 additions & 2 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
version: 2
project_name: nova
release:
prerelease: auto
Expand Down Expand Up @@ -34,10 +35,10 @@ changelog:
- '^test:'
brews:
- name: nova
tap:
repository:
owner: FairwindsOps
name: homebrew-tap
folder: Formula
directory: Formula
description: Check installed Helm charts for updates
test: |
system "#{bin}/nova version"
Expand Down
6 changes: 6 additions & 0 deletions e2e/pre.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

set -e

make build-linux
docker cp ./ e2e-command-runner:/nova
23 changes: 23 additions & 0 deletions e2e/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

set -e


printf "\n\n"
echo "***************************"
echo "** Install and Run Venom **"
echo "***************************"
printf "\n\n"

curl -LO https://github.com/ovh/venom/releases/download/v1.1.0/venom.linux-amd64
mv venom.linux-amd64 /usr/local/bin/venom
chmod +x /usr/local/bin/venom

cp /nova/nova /usr/local/bin/nova

cd /nova/e2e
mkdir -p /tmp/test-results
helm delete -n kube-system hostpath-provisioner || true
venom run -v testsuite.yaml --output-dir=/tmp/test-results
cat /tmp/test-results/venom.log
exit $?
37 changes: 37 additions & 0 deletions e2e/testsuite.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Nova Tests
description: Collection of e2e tests for Nova.
testcases:
- name: install helm charts
steps:
- script: |
helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
helm repo update
helm install ingress-nginx-latest ingress-nginx/ingress-nginx --set controller.ingressClassResource.name=nginx-latest
helm install --version 4.6.0 ingress-nginx-old ingress-nginx/ingress-nginx
assertions:
- result.code ShouldEqual 0

- name: nova_run
steps:
- type: exec
script: |
nova find --output-file output.json
cat ./output.json

- name: validate outdated chart version
steps:
- type: exec
script: |
jq '.helm[] | select(.release == "ingress-nginx-old" and .outdated == true)' ./output.json
assertions:
- result.code ShouldEqual 0
- result.systemoutjson ShouldNotBeEmpty

- name: validate latest chart version
steps:
- type: exec
script: |
jq '.helm[] | select(.release == "ingress-nginx-latest" and .outdated == false)' ./output.json
assertions:
- result.code ShouldEqual 0
- result.systemoutjson ShouldNotBeEmpty