Skip to content

[BOP-177] Implement e2e test framework for BOP #21

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

Merged
merged 10 commits into from
Dec 7, 2023
Merged

Conversation

sakshisharma84
Copy link
Contributor

@sakshisharma84 sakshisharma84 commented Dec 5, 2023

JIRA Ticket: https://mirantis.jira.com/browse/BOP-177

This PR adds support for the following.

  • Adds a new GitHub action to run e2e tests.
  • A kind cluster is deployed to run the tests.
  • A simple e2e test that installs the boundless operator and validates the deployment.
  • A separate e2e test workflow make e2e in Makefile. Segregated from make test

We can add more feature specific tests on top of this.

Output

  1. go test -v ./test/e2e/bopinstall

=== RUN   TestBOPInstall
=== RUN   TestBOPInstall/Boundless_operator
=== RUN   TestBOPInstall/Boundless_operator/Install_BOP
    bop_install_test.go:43: Installing boundless operator from the manifest located at:/Users/ssharma/boundless-operator/deploy/static
=== RUN   TestBOPInstall/Boundless_operator/Check_BOP_deployment_available
    bop_install_test.go:60: Waiting for deployment : boundless-operator-controller-manager to be ready.
    bop_install_test.go:66: Deployment boundless-operator-controller-manager is available. ReadyReplicas: 1
--- PASS: TestBOPInstall (15.12s)
    --- PASS: TestBOPInstall/Boundless_operator (15.12s)
        --- PASS: TestBOPInstall/Boundless_operator/Install_BOP (0.10s)
        --- PASS: TestBOPInstall/Boundless_operator/Check_BOP_deployment_available (15.02s)
PASS
ok  	github.com/mirantis/boundless-operator/test/e2e/bopinstall	51.221s

  1. make e2e
test -s /Users/ssharma/boundless-operator/bin/controller-gen && /Users/ssharma/boundless-operator/bin/controller-gen --version | grep -q v0.11.1 || \
	GOBIN=/Users/ssharma/boundless-operator/bin go install sigs.k8s.io/controller-tools/cmd/[email protected]
/Users/ssharma/boundless-operator/bin/controller-gen rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases
/Users/ssharma/boundless-operator/bin/controller-gen object:headerFile="hack/boilerplate.go.txt" paths="./..."
go fmt ./...
KUBEBUILDER_ASSETS="/Users/ssharma/boundless-operator/bin/k8s/1.26.0-darwin-arm64" go test -v ./test/e2e/... -coverprofile cover.out
=== RUN   TestBOPInstall
=== RUN   TestBOPInstall/Boundless_operator
=== RUN   TestBOPInstall/Boundless_operator/Install_BOP
    bop_install_test.go:43: Installing boundless operator from the manifest located at:/Users/ssharma/boundless-operator/deploy/static
=== RUN   TestBOPInstall/Boundless_operator/Check_BOP_deployment_available
    bop_install_test.go:60: Waiting for deployment : boundless-operator-controller-manager to be ready.
    bop_install_test.go:66: Deployment boundless-operator-controller-manager is available. ReadyReplicas: 1
--- PASS: TestBOPInstall (15.10s)
    --- PASS: TestBOPInstall/Boundless_operator (15.10s)
        --- PASS: TestBOPInstall/Boundless_operator/Install_BOP (0.08s)
        --- PASS: TestBOPInstall/Boundless_operator/Check_BOP_deployment_available (15.02s)
PASS
coverage: [no statements]
ok  	github.com/mirantis/boundless-operator/test/e2e/bopinstall	50.284s	coverage: [no statements]

@sakshisharma84 sakshisharma84 changed the title <WIP> e2e tests [BOP-177] Implement e2e test framework for BOP Dec 6, 2023
@sakshisharma84 sakshisharma84 marked this pull request as ready for review December 6, 2023 19:22
@ranyodh
Copy link

ranyodh commented Dec 6, 2023

Latest Operator-sdk(v0.16.3) is NOT compatible with k8s.io/kubernetes v1.28.4 package. After the package is upgraded to v0.16.3, we get the following error in main.go

vet: ./main.go:59:3: invalid field name Metrics.BindAddress in struct literal
vet: ./main.g
o:63:3: unknown field Port in struct literal of type manager.Options

This can be fixed. See this (temp) PR here: https://github.com/Mirantis/boundless-operator/pull/23/files
This should enable you to import v1.28.4

@sakshisharma84
Copy link
Contributor Author

https://github.com/Mirantis/boundless-operator/pull/23/files

@ranyodh : Thanks for sharing the PR. I already tried the solution for Metrics.BindAddress. What I was not sure about was the parameterPort i.e. how it is consumed and what will happen if I delete it.

MetricsBindAddress:     metricsAddr,
Port:                   9443,

I see that the PR deletes it. If that is okay, I can upgrade it w/o issues.

@@ -15,5 +15,5 @@ jobs:
uses: ./.github/workflows/build.yml
push-to-ghcr:
if: ${{ always() && contains(join(needs.*.result, ','), 'success') }} # if all `needs` jobs are successful
needs: [vet, unit-test, build]
needs: [vet, unit-test, e2e, build]
Copy link
Contributor

@vikramhh vikramhh Dec 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sakshisharma84 @nwneisen - how does a manual override work with git actions? There may be times when we need to allow certain actions even when certain conditions could not be met(e.g. push to ghcr even though not all e2e tests passed) - without disabling checks totally. Would it work to make needs to be input actions so that these could be edited and the whole workflow re-triggered after removing whatever needs to be (temporarily) overridden.

Asking for long-term, should not hold this PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vikramhh workflow_dispatch can be used to manually trigger an action but that runs the main branch. It doesn't look like there is a way to do it from a PR so we would have to get creative.

Copy link
Contributor

@nwneisen nwneisen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also add to a readme somewhere explaining the different kinds of tests and how to run them. I'd prefer if the root README.me has a test section but adding a README.me to the tests/ folder would also be fine.

@sakshisharma84
Copy link
Contributor Author

We should also add to a readme somewhere explaining the different kinds of tests and how to run them. I'd prefer if the root README.me has a test section but adding a README.me to the tests/ folder would also be fine.

Done!!

Copy link
Contributor

@nwneisen nwneisen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link

@ranyodh ranyodh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a small suggestion. LGTM otherwise.

@sakshisharma84 sakshisharma84 merged commit 9799a35 into main Dec 7, 2023
@ranyodh ranyodh deleted the e2e-test branch February 9, 2024 19:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants