-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add basic e2e test to spin up collector * Temp commit * feat: add healthcheck assertion * feat: Add assertion for validation backend logs * feat: make image_tag external input * feat: integrate e2e test into ci * fix: remove unnecessary new line * fix: update chart description * feat: Adding e2e/mock server * chore: Revert back to helm --------- Co-authored-by: kbauer <kbauer@newrelic.com>
- Loading branch information
1 parent
1969a9c
commit 394fd45
Showing
12 changed files
with
805 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
KIND_CLUSTER_NAME ?=e2etest | ||
K8S_CONTEXT_NAME=kind-${KIND_CLUSTER_NAME} | ||
IMAGE_REPO=newrelic/nr-otel-collector | ||
THIS_MAKEFILE_DIR := $(dir $(realpath $(lastword $(MAKEFILE_LIST)))) | ||
|
||
|
||
################ | ||
#### ASSERT #### | ||
################ | ||
REQUIRED_BINS := go kind docker helm kubectl awk | ||
$(foreach bin,$(REQUIRED_BINS),\ | ||
$(if $(shell command -v $(bin) 2> /dev/null),$(info Found required dependency `$(bin)`),$(error Please install `$(bin)`))) | ||
|
||
.PHONY: assert_image-tag-present | ||
assert_image-tag-present: | ||
@[ "${IMAGE_TAG}" ] || ( echo ">> env var IMAGE_TAG is not set"; exit 1 ) | ||
|
||
.PHONY: assert_cluster-exists | ||
assert_cluster-exists: | ||
kind get clusters | grep -q ${KIND_CLUSTER_NAME} || ( echo ">> cluster ${KIND_CLUSTER_NAME} does not exist"; exit 1 ) | ||
|
||
################ | ||
###### CI ###### | ||
################ | ||
.PHONY: ci_load-image | ||
ci_load-image: assert_cluster-exists assert_image-tag-present | ||
kind load docker-image ${IMAGE_REPO}:${IMAGE_TAG} --name ${KIND_CLUSTER_NAME} | ||
|
||
.PHONY: ci_build-load-mocked-otlp-image | ||
ci_build-load-mocked-otlp-image: assert_cluster-exists | ||
docker build -t mocked_otlp:latest -f ${THIS_MAKEFILE_DIR}/mocked_otlp/http/Dockerfile ${THIS_MAKEFILE_DIR}/mocked_otlp/http | ||
kind load docker-image mocked_otlp:latest --name ${KIND_CLUSTER_NAME} | ||
|
||
.PHONY: ci_test | ||
ci_test: ci_load-image ci_build-load-mocked-otlp-image | ||
cd ${THIS_MAKEFILE_DIR}hostmetrics && \ | ||
E2E_TEST__K8S_CONTEXT_NAME=${K8S_CONTEXT_NAME} \ | ||
E2E_TEST__IMAGE_REPO=${IMAGE_REPO} \ | ||
E2E_TEST__IMAGE_TAG=${IMAGE_TAG} \ | ||
go test ./... -count=1 | ||
|
||
################ | ||
#### LOCAL ##### | ||
################ | ||
.PHONY: local_create-cluster-if-not-exists | ||
local_create-cluster-if-not-exists: | ||
kind get clusters | grep -q ${KIND_CLUSTER_NAME} \ | ||
|| kind create cluster --name ${KIND_CLUSTER_NAME} | ||
|
||
.PHONY: local_build-image | ||
local_build-image: | ||
GORELEASER_CURRENT_TAG=0.0.999 goreleaser --snapshot --clean --skip-sign | ||
|
||
.PHONY: local_test | ||
# hardcode an image you build with local_build-image, then run this target to run tests against it | ||
local_test: IMAGE_TAG=insert_locally_available_tag_to_test_here | ||
local_test: local_create-cluster-if-not-exists ci_test | ||
|
||
.PHONY: local_helm-cleanup | ||
local_helm-cleanup: | ||
kubectl config use-context ${K8S_CONTEXT_NAME} && \ | ||
helm list -A --no-headers | awk 'NF {system("helm uninstall -n " $2 " " $1)}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
module test/e2e | ||
|
||
go 1.23.3 | ||
|
||
require github.com/gruntwork-io/terratest v0.47.2 | ||
|
||
require ( | ||
github.com/BurntSushi/toml v1.3.2 // indirect | ||
github.com/aws/aws-sdk-go v1.44.122 // indirect | ||
github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc // indirect | ||
github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect | ||
github.com/davecgh/go-spew v1.1.1 // indirect | ||
github.com/emicklei/go-restful/v3 v3.9.0 // indirect | ||
github.com/ghodss/yaml v1.0.0 // indirect | ||
github.com/go-errors/errors v1.0.2-0.20180813162953-d98b870cc4e0 // indirect | ||
github.com/go-logr/logr v1.2.4 // indirect | ||
github.com/go-openapi/jsonpointer v0.19.6 // indirect | ||
github.com/go-openapi/jsonreference v0.20.2 // indirect | ||
github.com/go-openapi/swag v0.22.3 // indirect | ||
github.com/go-sql-driver/mysql v1.4.1 // indirect | ||
github.com/gogo/protobuf v1.3.2 // indirect | ||
github.com/golang/protobuf v1.5.3 // indirect | ||
github.com/gonvenience/bunt v1.3.5 // indirect | ||
github.com/gonvenience/neat v1.3.12 // indirect | ||
github.com/gonvenience/term v1.0.2 // indirect | ||
github.com/gonvenience/text v1.0.7 // indirect | ||
github.com/gonvenience/wrap v1.1.2 // indirect | ||
github.com/gonvenience/ytbx v1.4.4 // indirect | ||
github.com/google/gnostic-models v0.6.8 // indirect | ||
github.com/google/go-cmp v0.5.9 // indirect | ||
github.com/google/gofuzz v1.2.0 // indirect | ||
github.com/google/uuid v1.3.0 // indirect | ||
github.com/gruntwork-io/go-commons v0.8.0 // indirect | ||
github.com/hashicorp/errwrap v1.0.0 // indirect | ||
github.com/hashicorp/go-multierror v1.1.0 // indirect | ||
github.com/homeport/dyff v1.6.0 // indirect | ||
github.com/imdario/mergo v0.3.11 // indirect | ||
github.com/jmespath/go-jmespath v0.4.0 // indirect | ||
github.com/josharian/intern v1.0.0 // indirect | ||
github.com/json-iterator/go v1.1.12 // indirect | ||
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect | ||
github.com/mailru/easyjson v0.7.7 // indirect | ||
github.com/mattn/go-ciede2000 v0.0.0-20170301095244-782e8c62fec3 // indirect | ||
github.com/mattn/go-isatty v0.0.19 // indirect | ||
github.com/mattn/go-zglob v0.0.2-0.20190814121620-e3c945676326 // indirect | ||
github.com/mitchellh/go-homedir v1.1.0 // indirect | ||
github.com/mitchellh/go-ps v1.0.0 // indirect | ||
github.com/mitchellh/hashstructure v1.1.0 // indirect | ||
github.com/moby/spdystream v0.2.0 // indirect | ||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect | ||
github.com/modern-go/reflect2 v1.0.2 // indirect | ||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect | ||
github.com/pmezard/go-difflib v1.0.0 // indirect | ||
github.com/pquerna/otp v1.2.0 // indirect | ||
github.com/russross/blackfriday/v2 v2.1.0 // indirect | ||
github.com/sergi/go-diff v1.3.1 // indirect | ||
github.com/spf13/pflag v1.0.5 // indirect | ||
github.com/stretchr/testify v1.8.4 // indirect | ||
github.com/texttheater/golang-levenshtein v1.0.1 // indirect | ||
github.com/urfave/cli v1.22.2 // indirect | ||
github.com/virtuald/go-ordered-json v0.0.0-20170621173500-b18e6e673d74 // indirect | ||
golang.org/x/crypto v0.21.0 // indirect | ||
golang.org/x/net v0.23.0 // indirect | ||
golang.org/x/oauth2 v0.8.0 // indirect | ||
golang.org/x/sync v0.4.0 // indirect | ||
golang.org/x/sys v0.18.0 // indirect | ||
golang.org/x/term v0.18.0 // indirect | ||
golang.org/x/text v0.14.0 // indirect | ||
golang.org/x/time v0.3.0 // indirect | ||
google.golang.org/appengine v1.6.7 // indirect | ||
google.golang.org/protobuf v1.33.0 // indirect | ||
gopkg.in/inf.v0 v0.9.1 // indirect | ||
gopkg.in/yaml.v2 v2.4.0 // indirect | ||
gopkg.in/yaml.v3 v3.0.1 // indirect | ||
k8s.io/api v0.28.4 // indirect | ||
k8s.io/apimachinery v0.28.4 // indirect | ||
k8s.io/client-go v0.28.4 // indirect | ||
k8s.io/klog/v2 v2.100.1 // indirect | ||
k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 // indirect | ||
k8s.io/utils v0.0.0-20230406110748-d93618cff8a2 // indirect | ||
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect | ||
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect | ||
sigs.k8s.io/yaml v1.3.0 // indirect | ||
) |
Oops, something went wrong.