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

Testing with operator-sdk ?? #1336

Closed
mjshariati98 opened this issue Jan 28, 2020 · 8 comments
Closed

Testing with operator-sdk ?? #1336

mjshariati98 opened this issue Jan 28, 2020 · 8 comments
Assignees
Labels
lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.

Comments

@mjshariati98
Copy link

Is it possible to test an operator that weitten with kubebuilder, with oeprator-sdk framework for e2e testing ?

@hasbro17
Copy link

hasbro17 commented Feb 2, 2020

@mjshariati98 Not yet.

Besides the fact that SDK and Kubebuilder have different layouts for operator manifests, a Kubebuilder project's config directory has Kustomize bases and patches, unlike the SDK's deployment directory which has complete manifests scaffolded.
https://github.com/operator-framework/operator-sdk/blob/master/doc/test-framework/writing-e2e-tests.md#running-the-tests

So while it might be possible, it would be troublesome to pass the operator-sdk test cmd the complete operator manifests output from kustomize build. And even then there might be issues.

However we are currently working to integrate Kubebuilder's scaffolding into the SDK so in the future it should be possible for operator-sdk test to work on Kubebuilder projects since SDK projects would have the same layout and workflow as Kubebuilder's.
See:

In the meanwhile you can try to use envtest for integration tests in your Kubebuilder project.

And as for using the Operator SDK test-framework for non-SDK layouts, it's probably better if you can follow up by opening an issue on the SDK repo.

@hasbro17
Copy link

hasbro17 commented Feb 6, 2020

@mjshariati98 If that answers your question feel free to close the issue. If not, you can follow up on the SDK repo if it's more specifically about the test-framework.

@mjshariati98
Copy link
Author

@hasbro17 thanks for your answer.
Is there a good example or documentation for e2e test for an operator ?

@hasbro17
Copy link

hasbro17 commented Feb 6, 2020

@mjshariati98 The envtest package might be a good place to start for operators using controller-runtime.
https://book.kubebuilder.io/reference/testing/envtest.html
Just be aware of the last section at the end that mentions that you're not testing against an actual cluster with envtest so there are some caveats.

And if it's a project scaffolded with the Operator SDK then you can take a look through the test-framework docs which walks through an example for writing e2e tests that will run against an actual cluster.
https://github.com/operator-framework/operator-sdk/blob/master/doc/test-framework/writing-e2e-tests.md

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label May 6, 2020
@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Jun 5, 2020
@hasbro17
Copy link

hasbro17 commented Jun 8, 2020

Closing this issue since after the SDK integrates Kubebuilder CLI, we're dropping support for test-framework in favor of envtest as the recommended way to write integration tests.

(Not sure I have permissions to close the issue though)

/close

@k8s-ci-robot
Copy link
Contributor

@hasbro17: Closing this issue.

In response to this:

Closing this issue since after the SDK integrates Kubebuilder CLI, we're dropping support for test-framework in favor of envtest as the recommended way to write integration tests.

(Not sure I have permissions to close the issue though)

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.
Projects
None yet
Development

No branches or pull requests

4 participants