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

Improve controller test #44

Merged
merged 15 commits into from
Oct 2, 2024
Merged

Improve controller test #44

merged 15 commits into from
Oct 2, 2024

Conversation

toshipp
Copy link
Contributor

@toshipp toshipp commented Sep 27, 2024

see commit messages.

Because they are used by tests for controllers, move them under the
controller directory.

Signed-off-by: Toshikuni Fukaya <toshikuni-fukaya@cybozu.co.jp>
Signed-off-by: Toshikuni Fukaya <toshikuni-fukaya@cybozu.co.jp>
All tests can use the common SC, use it to make them simple.

Signed-off-by: Toshikuni Fukaya <toshikuni-fukaya@cybozu.co.jp>
Signed-off-by: Toshikuni Fukaya <toshikuni-fukaya@cybozu.co.jp>
All tests should use unique PVs and PVCs, so generate unique names in
the new helper function. The old helper may use in the future, it
remains but becomes private.

Signed-off-by: Toshikuni Fukaya <toshikuni-fukaya@cybozu.co.jp>
Signed-off-by: Toshikuni Fukaya <toshikuni-fukaya@cybozu.co.jp>
All tests should use unique names to ensure independence.

Signed-off-by: Toshikuni Fukaya <toshikuni-fukaya@cybozu.co.jp>
Signed-off-by: Toshikuni Fukaya <toshikuni-fukaya@cybozu.co.jp>
Signed-off-by: Toshikuni Fukaya <toshikuni-fukaya@cybozu.co.jp>
Signed-off-by: Toshikuni Fukaya <toshikuni-fukaya@cybozu.co.jp>
@toshipp toshipp marked this pull request as ready for review September 30, 2024 01:12
@toshipp
Copy link
Contributor Author

toshipp commented Oct 1, 2024

I'll rebase it after the review.

Copy link
Contributor

@satoru-takeuchi satoru-takeuchi left a comment

Choose a reason for hiding this comment

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

LGTM. Could you squash commits?

Signed-off-by: Toshikuni Fukaya <toshikuni-fukaya@cybozu.co.jp>
Ginkgo provides contexts for its containers. Using it, we can handle
test termination gracefully. Note that NewManagerUtil requires a context
not bounded to a container, so use context.Background.

Signed-off-by: Toshikuni Fukaya <toshikuni-fukaya@cybozu.co.jp>
Because the reconciler uses FieldIndexer, it should use a cache client.
If not, List method fails, it finally causes no Reconcile method
invocation when CronJob is deleted.

Signed-off-by: Toshikuni Fukaya <toshikuni-fukaya@cybozu.co.jp>
The real environment, reconcilers use the cache client from the manager.
Being closer, use it on tests.

Signed-off-by: Toshikuni Fukaya <toshikuni-fukaya@cybozu.co.jp>
deleteRestoringPVC and deleteRestoringPV returns an error if the PV or
PVC still exists, we should retry them until they succeed.

Signed-off-by: Toshikuni Fukaya <toshikuni-fukaya@cybozu.co.jp>
@satoru-takeuchi satoru-takeuchi merged commit 892d292 into main Oct 2, 2024
3 checks passed
@satoru-takeuchi satoru-takeuchi deleted the improve-controller-test branch October 2, 2024 10:38
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.

2 participants