aws / aws/eks-anywhere

make unit-test should not run integration tests

Open
#5,364 3 comments 2 reactions 0 assignees View on GitHub
area/cli area/testing
Dominant language
Go
Stars
2.1k
Forks
328
Avg merge
1d 4h
Merged PRs (30d)
9

Description

**What happened**:
The make target `unit-test` runs the integration test tool [envtest](https://book.kubebuilder.io/reference/envtest.html). `envtest` clearly says that they are an integration test framework. `make unit-test` should not use `envtest`. This will require refactoring of our Go unit tests.
Here are just 2 examples of us using `envtest` in unit tests. There are plenty more.
https://github.com/aws/eks-anywhere/blob/1f2ebecec032881d78001e107e065cb140a7f652/controllers/main_test.go#L13
https://github.com/aws/eks-anywhere/blob/1f2ebecec032881d78001e107e065cb140a7f652/pkg/api/v1alpha1/nutanixdatacenterconfig_webhook_test.go#L122

CC @chrisdoherty4 , @TerryHowe

**What you expected to happen**:
I expect that `make unit-test` only runs unit test. Ideally, I should be able to run `go test ./...` or `make unit-test` and have them function pretty much the same way. `go test ./...` should not be complaining with `Failed setting up envtest` errors.

**How to reproduce it (as minimally and precisely as possible)**:

**Anything else we need to know?**:

**Environment**:
- EKS Anywhere Release:
- EKS Distro Release:

Contributor guide

Open the contributing guide

Research direction

Start with the make unit-test target and compare its behavior with go test ./.... Review the envtest usage in controllers/main_test.go and pkg/api/v1alpha1/nutanixdatacenterconfig_webhook_test.go, then identify the remaining examples mentioned in the issue. Done means unit-test and go test ./... no longer require envtest or report Failed setting up envtest errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
build-system, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.