-
Notifications
You must be signed in to change notification settings - Fork 25
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
Fix unit tests for /apis, /internal, /pkg #63
Conversation
…ator artifacts. Run go mod tidy
@@ -67,14 +67,6 @@ rules: | |||
- patch | |||
- update | |||
- watch | |||
- apiGroups: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this section is unneeded as it is duplicated from line 107
@@ -82,10 +84,10 @@ ci: test | |||
# Run tests | |||
# setup-envtest uses KUBEBUILDER_ASSETS which points to a directory with binaries (api-server, etcd and kubectl) | |||
.PHONY: test | |||
test: generate fmt vet ensure-generate-is-noop envtest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ensure-generate-is-noop
doesn't exist in the Makefile, we don't use it
@@ -51,6 +51,8 @@ CONTROLLER_TOOLS_VERSION ?= v0.12.0 | |||
ALL_SRC := $(shell find . -name '*.go' -type f | sort) | |||
CW_AGENT_OPERATOR_IMPORT_PATH = "github.com/aws/amazon-cloudwatch-agent-operator" | |||
|
|||
GOTEST_OPTS := $(shell go list ./... | grep -v integration-tests) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can ignore the integration-tests as part of make test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Could add an integration-test
build tag to the integration tests, so they're skipped normally.
//go:build integration-test
newName: aws/amazon-cloudwatch-agent-operator | ||
newTag: latest | ||
newName: aws/cloudwatch-agent-operator | ||
newTag: 1.0.2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was made to be consistent with the image produced in the Makefile by make container
Thanks for fixing the unit tests! Can you summarize the major changes you had to make? |
@@ -51,7 +51,7 @@ func paramsWithMode(mode v1alpha1.Mode) manifests.Params { | |||
UID: instanceUID, | |||
}, | |||
Spec: v1alpha1.AmazonCloudWatchAgentSpec{ | |||
Image: "ghcr.io/aws/amazon-cloudwatch-agent-operator/amazon-cloudwatch-agent-operator:0.47.0", | |||
Image: "public.ecr.aws/cloudwatch-agent/cloudwatch-agent:1.300031.1b317", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason we're using this specific image?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's to be consistent with this line in configmap_test.go
:
expectedLables["app.kubernetes.io/version"] = "1.300031.1b317"
I can change it to something more generic like 0.0.0
@@ -51,6 +51,8 @@ CONTROLLER_TOOLS_VERSION ?= v0.12.0 | |||
ALL_SRC := $(shell find . -name '*.go' -type f | sort) | |||
CW_AGENT_OPERATOR_IMPORT_PATH = "github.com/aws/amazon-cloudwatch-agent-operator" | |||
|
|||
GOTEST_OPTS := $(shell go list ./... | grep -v integration-tests) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Could add an integration-test
build tag to the integration tests, so they're skipped normally.
//go:build integration-test
// +kubebuilder:webhook:path=/mutate-cloudwatch-aws-amazon-com-v1alpha1-amazoncloudwatchagent,mutating=true,failurePolicy=fail,groups=cloudwatch.aws.amazon.co,resources=amazoncloudwatchagents,verbs=create;update,versions=v1alpha1,name=mamazoncloudwatchagent.kb.io,sideEffects=none,admissionReviewVersions=v1 | ||
// +kubebuilder:webhook:verbs=create;update,path=/validate-cloudwatch-aws-amazon-com-v1alpha1-amazoncloudwatchagent,mutating=false,failurePolicy=fail,groups=cloudwatch.aws.amazon.co,resources=amazoncloudwatchagents,versions=v1alpha1,name=vamazoncloudwatchagentcreateupdate.kb.io,sideEffects=none,admissionReviewVersions=v1 | ||
// +kubebuilder:webhook:verbs=delete,path=/validate-cloudwatch-aws-amazon-com-v1alpha1-amazoncloudwatchagent,mutating=false,failurePolicy=ignore,groups=cloudwatch.aws.amazon.co,resources=amazoncloudwatchagents,versions=v1alpha1,name=vamazoncloudwatchagentdelete.kb.io,sideEffects=none,admissionReviewVersions=v1 | ||
// +kubebuilder:webhook:path=/mutate-cloudwatch-aws-amazon-com-v1alpha1-amazoncloudwatchagent,mutating=true,failurePolicy=fail,groups=cloudwatch.aws.amazon.com,resources=amazoncloudwatchagents,verbs=create;update,versions=v1alpha1,name=mamazoncloudwatchagent.kb.io,sideEffects=none,admissionReviewVersions=v1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for fixing this
Description of changes:
Unit test fixes, can run full suite of unit tests with
make test
.make test
to ignore the integration testCode snippet of tests passing in packages
More failing tests will need to be addressed in the future
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.