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

Centralise utilities for testing controllers #172

Merged

Conversation

markmandel
Copy link
Collaborator

Found myself repeating the same test setup when I started doing the Fleet controllers, so moved this
into a single location (pkg/testing) to make it easier to reuse.

Found myself repeating the same test setup when
I started doing the Fleet controllers, so moved this
into a single location to make it easier to reuse.
@markmandel markmandel added the kind/cleanup Refactoring code, fixing up documentation, etc label Apr 10, 2018
@markmandel markmandel added this to the 0.2 milestone Apr 10, 2018
@markmandel markmandel requested a review from enocom April 10, 2018 22:41
@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: 18e412d7-ede2-46f0-8d0d-81d68bdeae5e

The following development artifacts have been built, and will exist for the next 30 days:

Copy link
Contributor

@enocom enocom left a comment

Choose a reason for hiding this comment

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

It's nice to avoid duplicating the testing setup across packages. 👍

One downside is that goimports will be confused by testing -- is it Agones testing or stdlib testing? Should we change the name before merging? WDYT?

@markmandel
Copy link
Collaborator Author

So this is an interesting question - I followed what Kubernetes does (and is that the best thing?), and then use package aliases to manage things.

https://godoc.org/k8s.io/client-go/testing
https://godoc.org/k8s.io/client-go/tools/cache/testing
https://godoc.org/k8s.io/client-go/util/testing
https://godoc.org/k8s.io/kubernetes/pkg/api/testing
(And so on)

I'm not aware of any other patterns, but I'm open!
WDYT?

Copy link
Contributor

@enocom enocom left a comment

Choose a reason for hiding this comment

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

Looks good to me. The aliasing is nice, too.

@enocom enocom merged commit 4a6e774 into googleforgames:master Apr 11, 2018
@markmandel markmandel deleted the refactor/controller-testing branch April 11, 2018 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/cleanup Refactoring code, fixing up documentation, etc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants