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

e2e tests for Agones integration #510

Closed
markmandel opened this issue Apr 5, 2022 · 10 comments
Closed

e2e tests for Agones integration #510

markmandel opened this issue Apr 5, 2022 · 10 comments
Assignees
Labels
area/tests Unit tests, integration tests, anything to make sure things don't break help wanted Extra attention is needed kind/feature New feature or request

Comments

@markmandel
Copy link
Contributor

Is your feature request related to a problem? Please describe.

Once we have the Agones integration from #506, we don't currently have a way to automatically test the integration end to end (which is not a good thing).

Describe the solution you'd like

So we need a way to run the e2e tests both locally and also in Cloud Build CI. We can probably break this down into a few steps/built in tools into our Makefile.

The only tricky part with local testing is that connectivity to something like Minikube on Agones can be tricky, because of the layers of virtualisation (see guide)

I believe we can mimic what we did in Agones to do a similar thing in Rust as we did with Go (sacrificial draft):

  • We'll need a make target to install the latest version of Agones on the current authorised cluster (it's a helm install - pretty easy). (be good to have a terraform script that sets up the cluster too).
  • All the e2e tests in Agones are standard Go tests, that use the local .kube credentials to run. It looks like Rust's kube client will happily do the same. This has two benefits - you can run individual tests in your IDE, and also run the whole suite with standard Rust tooling.
  • For CI Agones has a custom build step that does the installation and running of tests - we could do similar things. The fun part here is that we need to use a shared lock to make sure no two tests are running at the same time (unless there is a way to make it so that it doesn't matter 🤔). In Agones we use consul to do the distributed lock, although I have debated implementing something using gcslock or similar.

Describe alternatives you've considered

None. We'll need automated testing for this.

Additional context

I would probably suggest starting with getting tests running locally in a Rust context, and then build out the CI platform from there.

@markmandel markmandel added kind/feature New feature or request area/tests Unit tests, integration tests, anything to make sure things don't break labels Apr 5, 2022
@XAMPPRocky XAMPPRocky added the help wanted Extra attention is needed label May 10, 2022
@markmandel markmandel self-assigned this Jun 15, 2022
@markmandel
Copy link
Contributor Author

markmandel commented Jun 15, 2022

Starting work on this - starting with creating a simple terraform script for creating a agones powered GKE cluster, and creating a module that will create some kind of simple test we can expand on.

Will probably add some of the tooling (terraform, helm, gcloud etc) into the build image as well for convenience if they are not installed locally.

@XAMPPRocky it would handy if you could split out the Agones k8s client work in https://github.com/googleforgames/quilkin/blob/edf6d0d4fba93d5771b993af48f670563724cb6a/src/xds/provider/agones.rs into its own PR? Then I should be able to start building out more e2e tests.

No rush though, I'll get a PR with a Pod created first, and swing back around.

@markmandel
Copy link
Contributor Author

Got this in a happy place locally:

  • Setup the build image to have gcloud, kubectl and terraform in it, so that if you don't have it locally and want a quick fix, you can use make shell create and work with your K8s cluster
  • Small terraform scripts to create a GKE cluster with Agones installed and appropriate Agones firewall rules (we may want these since creating Services can be slow.
  • Small framework for running tests in it's own module, that creates a temporary namespace on startup for all resources to go in. Also removes all other testing namespaces each time it starts up.
  • A singular test that creates Quilkin in a pod and makes sure it moves to a running state.
  • Some make targets for integration with CI when ready.

Splitting out into PR's and submitting shortly 👍🏻 Just wanted to give you a headsup, since I know you've been waiting on this for xDS testing.

markmandel added a commit to markmandel/quilkin that referenced this issue Jun 17, 2022
Provides a suite of tools for setting up and running e2e integration
tests of Quilkin on Agones.

This includes:
* `agones` module with setup functionality and a simple e2e test
* Convenience terraform script for Agones GKE cluster
* Documentation of setup and usage
* Update build image to include convenience tooling (which is also
eventually needed for integration with CI)
* Make target for running Agones integration tests through the build
image.

Work on googleforgames#510
markmandel added a commit to markmandel/quilkin that referenced this issue Jun 17, 2022
Provides a suite of tools for setting up and running e2e integration
tests of Quilkin on Agones.

This includes:
* `agones` module with setup functionality and a simple e2e test
* Convenience terraform script for Agones GKE cluster
* Documentation of setup and usage
* Update build image to include convenience tooling (which is also
eventually needed for integration with CI)
* Make target for running Agones integration tests through the build
image.

Work on googleforgames#510
markmandel added a commit to markmandel/quilkin that referenced this issue Jun 22, 2022
Provides a suite of tools for setting up and running e2e integration
tests of Quilkin on Agones.

This includes:
* `agones` module with setup functionality and a simple e2e test
* Convenience terraform script for Agones GKE cluster
* Documentation of setup and usage
* Update build image to include convenience tooling (which is also
eventually needed for integration with CI)
* Make target for running Agones integration tests through the build
image.

Work on googleforgames#510
@markmandel
Copy link
Contributor Author

markmandel commented Jun 28, 2022

Writing this down, so I remember (and commentary welcome) what to work on once #545 is merged:

  • Write tooling to manage build, push and test (probably make targets, since that is the easiest) flow
  • Do the same thing, but for minukube (likely do this in conjunction with above)
  • Build out CI tooling so tests can be run for each PR (Also realised we don't need a global lock, and test can be run in parallel as long as we handle test Namespace cleanup appropriately)
  • Document the development flow in build/README.md

Once xDS PRs have been merged:

  • Write some tests that using GameServer, and expand framework (sidecar integration seems like the best starting point)
  • Work out load balancer testing strategy that will both (a) work on GKE and Minukube and (b) be fast too test (spinning up external LBs in GKE can take minutes)
  • Write an xDS test

I think at that point, we can close this ticket!

@XAMPPRocky
Copy link
Collaborator

I can write the xDS test once merged, I want to get more familiar with agones.

markmandel added a commit that referenced this issue Jun 29, 2022
* Tools for Agones e2e testing

Provides a suite of tools for setting up and running e2e integration
tests of Quilkin on Agones.

This includes:
* `agones` module with setup functionality and a simple e2e test
* Convenience terraform script for Agones GKE cluster
* Documentation of setup and usage
* Update build image to include convenience tooling (which is also
eventually needed for integration with CI)
* Make target for running Agones integration tests through the build
image.

Work on #510

* Review updates.
@markmandel
Copy link
Contributor Author

Just adding a note I'm starting on "Write tooling to manage build, push and test (probably make targets, since that is the easiest) flow", and will move into "Do the same thing, but for minukube (likely do this in conjunction with above)" as well.

markmandel added a commit to markmandel/quilkin that referenced this issue Jul 21, 2022
This builds out the `build/Makefile` tooling such that you can build,
push and test the Quilkin Agones integration against either Minikube or
a hosted Kubernetes cluster (tested against GKE + Artifact Registry) in
one operation.

Also includes:

* Refactoring such that variable naming across `cargo test` and
`make` targets all lined to up to be consistent.
* If `IMAGE_TAG` is not present in `cargo test`, panic.
* Upgrade Agones version in Terraform script.
* Update release cloudbuild.yaml - include an update to changelog
generator, as I found a bug in the version we were using.
* More aggressive .dockerignore. Got the build context down from >3GB to
 ~900M, which was a big improvement in image creation speed.

Work on googleforgames#510
markmandel added a commit that referenced this issue Jul 21, 2022
* Dev: Build, Push and Test Agones Integrations

This builds out the `build/Makefile` tooling such that you can build,
push and test the Quilkin Agones integration against either Minikube or
a hosted Kubernetes cluster (tested against GKE + Artifact Registry) in
one operation.

Also includes:

* Refactoring such that variable naming across `cargo test` and
`make` targets all lined to up to be consistent.
* If `IMAGE_TAG` is not present in `cargo test`, panic.
* Upgrade Agones version in Terraform script.
* Update release cloudbuild.yaml - include an update to changelog
generator, as I found a bug in the version we were using.
* More aggressive .dockerignore. Got the build context down from >3GB to
 ~900M, which was a big improvement in image creation speed.

Work on #510

* Allow "Unicode-DFS-2016" licence.
@markmandel
Copy link
Contributor Author

😅 took some documentation hunting, but locally I've got the Agones integration tests working with the Cloud Build setup.

Going to optimise it to remove some duplication of work that is happening, but hoping to have this in before you all return back from vacation.

markmandel added a commit to markmandel/quilkin that referenced this issue Jul 27, 2022
This makes it such that on each PR, the Agones integration tests are run
against the GKE + Agones cluster specified in ./agones/main.tf

This includes:
* Fix for main.tf to align release branch with Agones version.
* Configure how long to wait before cleaning up past test namespaces.
* Cleanup and optimisation of cloudbuild.yaml.

Work on googleforgames#510
markmandel added a commit to markmandel/quilkin that referenced this issue Jul 27, 2022
This makes it such that on each PR, the Agones integration tests are run
against the GKE + Agones cluster specified in ./agones/main.tf

This includes:
* Fix for main.tf to align release branch with Agones version.
* Configure how long to wait before cleaning up past test namespaces.
* Cleanup and optimisation of cloudbuild.yaml.

Work on googleforgames#510
markmandel added a commit to markmandel/quilkin that referenced this issue Jul 28, 2022
This makes it such that on each PR, the Agones integration tests are run
against the GKE + Agones cluster specified in ./agones/main.tf

This includes:
* Fix for main.tf to align release branch with Agones version.
* Configure how long to wait before cleaning up past test namespaces.
* Cleanup and optimisation of cloudbuild.yaml.

Work on googleforgames#510
markmandel added a commit to markmandel/quilkin that referenced this issue Jul 28, 2022
This makes it such that on each PR, the Agones integration tests are run
against the GKE + Agones cluster specified in ./agones/main.tf

This includes:
* Fix for main.tf to align release branch with Agones version.
* Configure how long to wait before cleaning up past test namespaces.
* Cleanup and optimisation of cloudbuild.yaml.

Work on googleforgames#510
markmandel added a commit that referenced this issue Jul 29, 2022
* Run Agones tests in CI

This makes it such that on each PR, the Agones integration tests are run
against the GKE + Agones cluster specified in ./agones/main.tf

This includes:
* Fix for main.tf to align release branch with Agones version.
* Configure how long to wait before cleaning up past test namespaces.
* Cleanup and optimisation of cloudbuild.yaml.

Work on #510

* Review updates.

* Fix issue with long build times.
@markmandel
Copy link
Contributor Author

Working on an integration test to spin up a single Agones GameServer and connect to it. Most of the way there, PR incoming shortly.

markmandel added a commit to markmandel/quilkin that referenced this issue Aug 27, 2022
This integration test only tests that we can create a GameServer in an
Agones cluster and connect to it, providing baseline functionality for
further integration tests.

This includes making the Agones CRD values public such that they can be
accessed from the integration tests.

Work on googleforgames#510
markmandel added a commit to markmandel/quilkin that referenced this issue Aug 27, 2022
This integration test only tests that we can create a GameServer in an
Agones cluster and connect to it, providing baseline functionality for
further integration tests.

This includes making the Agones CRD values public such that they can be
accessed from the integration tests.

Work on googleforgames#510
markmandel added a commit to markmandel/quilkin that referenced this issue Aug 28, 2022
This integration test only tests that we can create a GameServer in an
Agones cluster and connect to it, providing baseline functionality for
further integration tests.

This includes making the Agones CRD values public such that they can be
accessed from the integration tests.

Work on googleforgames#510
markmandel added a commit that referenced this issue Aug 29, 2022
This integration test only tests that we can create a GameServer in an
Agones cluster and connect to it, providing baseline functionality for
further integration tests.

This includes making the Agones CRD values public such that they can be
accessed from the integration tests.

Work on #510
markmandel added a commit to markmandel/quilkin that referenced this issue Aug 29, 2022
Implements an integration test wherein we use Quilkin as a sidecar to an
Agones GameServer container.

Also includes some updates to the test harnesses:
* Function to create a common Quilkin container
* Fixed odd (?) bug where k8s client would sometimes close at the end of
  tests, failing subsequent other tests.
* Convenience function for grabbing the address of a GameServer so you
  can send packets to it.

Work on googleforgames#510
markmandel added a commit to markmandel/quilkin that referenced this issue Aug 29, 2022
Implements an integration test wherein we use Quilkin as a sidecar to an
Agones GameServer container.

Also includes some updates to the test harnesses:
* Function to create a common Quilkin container
* Fixed odd (?) bug where k8s client would sometimes close at the end of
  tests, failing subsequent other tests.
* Convenience function for grabbing the address of a GameServer so you
  can send packets to it.

Work on googleforgames#510
@markmandel
Copy link
Contributor Author

Assuming #582 is merged 😄 I'd love to get started on setting up the some preliminary xDS integration tests. Also will give me an opportunity to get hands on with the feature, which will help doing some examples, probably a quickstart and other onboarding improvements I'd like to do.

markmandel added a commit to markmandel/quilkin that referenced this issue Aug 29, 2022
Implements an integration test wherein we use Quilkin as a sidecar to an
Agones GameServer container.

Also includes some updates to the test harnesses:
* Function to create a common Quilkin container
* Fixed odd (?) bug where k8s client would sometimes close at the end of
  tests, failing subsequent other tests.
* Convenience function for grabbing the address of a GameServer so you
  can send packets to it.

Work on googleforgames#510
@markmandel
Copy link
Contributor Author

XAMPPRocky pushed a commit that referenced this issue Aug 30, 2022
Implements an integration test wherein we use Quilkin as a sidecar to an
Agones GameServer container.

Also includes some updates to the test harnesses:
* Function to create a common Quilkin container
* Fixed odd (?) bug where k8s client would sometimes close at the end of
  tests, failing subsequent other tests.
* Convenience function for grabbing the address of a GameServer so you
  can send packets to it.

Work on #510
markmandel added a commit to markmandel/quilkin that referenced this issue Sep 8, 2022
* Fleet implementation, and updated to GameServer CRD
* xDS + Agones integration test.
* General API reuse/cleanup

Work on googleforgames#510
markmandel added a commit to markmandel/quilkin that referenced this issue Sep 8, 2022
This tests Quilkin running in an Agones provider as a xDS server, and a
Quilkin proxy connecting to it.

This test includes routing udp packets via a token specified on a
GameServer and a filter configuration applied through a ConfigMap.

To implement this, it also includes:
* Fleet implementation, and updated to GameServer CRD
* Some general API reuse/cleanup

Work on googleforgames#510
markmandel added a commit to markmandel/quilkin that referenced this issue Sep 8, 2022
This tests Quilkin running in an Agones provider as a xDS server, and a
Quilkin proxy connecting to it.

This test includes routing udp packets via a token specified on a
GameServer and a filter configuration applied through a ConfigMap.

To implement this, it also includes:
* Fleet implementation, and updated to GameServer CRD
* Some general API reuse/cleanup

Work on googleforgames#510
XAMPPRocky pushed a commit that referenced this issue Sep 9, 2022
This tests Quilkin running in an Agones provider as a xDS server, and a
Quilkin proxy connecting to it.

This test includes routing udp packets via a token specified on a
GameServer and a filter configuration applied through a ConfigMap.

To implement this, it also includes:
* Fleet implementation, and updated to GameServer CRD
* Some general API reuse/cleanup

Work on #510
@XAMPPRocky
Copy link
Collaborator

Closing as complete, we can open up new issues for specific tests.

XAMPPRocky pushed a commit that referenced this issue Oct 10, 2022
This tests Quilkin running in an Agones provider as a xDS server, and a
Quilkin proxy connecting to it.

This test includes routing udp packets via a token specified on a
GameServer and a filter configuration applied through a ConfigMap.

To implement this, it also includes:
* Fleet implementation, and updated to GameServer CRD
* Some general API reuse/cleanup

Work on #510
XAMPPRocky pushed a commit that referenced this issue Oct 10, 2022
This tests Quilkin running in an Agones provider as a xDS server, and a
Quilkin proxy connecting to it.

This test includes routing udp packets via a token specified on a
GameServer and a filter configuration applied through a ConfigMap.

To implement this, it also includes:
* Fleet implementation, and updated to GameServer CRD
* Some general API reuse/cleanup

Work on #510
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/tests Unit tests, integration tests, anything to make sure things don't break help wanted Extra attention is needed kind/feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants