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

Add e2e test for Extensions #2947

Merged
merged 1 commit into from
Feb 6, 2023
Merged

Add e2e test for Extensions #2947

merged 1 commit into from
Feb 6, 2023

Conversation

chiayi
Copy link
Contributor

@chiayi chiayi commented Feb 2, 2023

Adds an E2E test for testing high availability extensions.

What type of PR is this?

Uncomment only one /kind <> line, press enter to put that in a new line, and remove leading whitespace from that line:

/kind breaking
/kind bug
/kind cleanup
/kind documentation

/kind feature

/kind hotfix

What this PR does / Why we need it:
Part of HA Agones. Adds an e2e test that will test high availability by deleting one of the extensions pod and creating a gameserver.

Which issue(s) this PR fixes:
Work on #2797

Special notes for your reviewer:

@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: 7f2d243c-5364-40e7-a80f-200f6b648751

To get permission to view the Cloud Build view, join the agones-discuss Google Group.

@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: de8179f4-e552-4fe6-bff9-01b5c8ccde2b

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

A preview of the website (the last 30 builds are retained):

To install this version:

  • git fetch https://github.com/googleforgames/agones.git pull/2947/head:pr_2947 && git checkout pr_2947
  • helm install agones ./install/helm/agones --namespace agones-system --agones.image.release=us-docker.pkg.dev/agones-images/ci --set agones.image.tag=1.30.0-6a78a3b-amd64

@chiayi chiayi force-pushed the main branch 2 times, most recently from d87b344 to 2d38ee8 Compare February 3, 2023 00:30
@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: 8e65e5ac-3dc5-4339-a362-f6a28bc89ee1

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

A preview of the website (the last 30 builds are retained):

To install this version:

  • git fetch https://github.com/googleforgames/agones.git pull/2947/head:pr_2947 && git checkout pr_2947
  • helm install agones ./install/helm/agones --namespace agones-system --agones.image.release=us-docker.pkg.dev/agones-images/ci --set agones.image.tag=1.30.0-d87b344-amd64

@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: 3016787c-4f6f-459c-a4a5-38c94575da33

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

A preview of the website (the last 30 builds are retained):

To install this version:

  • git fetch https://github.com/googleforgames/agones.git pull/2947/head:pr_2947 && git checkout pr_2947
  • helm install agones ./install/helm/agones --namespace agones-system --agones.image.release=us-docker.pkg.dev/agones-images/ci --set agones.image.tag=1.30.0-2d38ee8-amd64

@chiayi chiayi force-pushed the main branch 2 times, most recently from 6d62674 to f2e91f4 Compare February 3, 2023 18:59
@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: fcab7a59-4821-47cd-b79d-83f7eba4a238

To get permission to view the Cloud Build view, join the agones-discuss Google Group.

@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: b976e379-41bf-43d5-ba66-e7d5621294fd

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

A preview of the website (the last 30 builds are retained):

To install this version:

  • git fetch https://github.com/googleforgames/agones.git pull/2947/head:pr_2947 && git checkout pr_2947
  • helm install agones ./install/helm/agones --namespace agones-system --agones.image.release=us-docker.pkg.dev/agones-images/ci --set agones.image.tag=1.30.0-6d62674-amd64

@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: 1274e469-4b66-45bd-9e34-f72e3770ef64

To get permission to view the Cloud Build view, join the agones-discuss Google Group.

@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: 3437bcd4-2222-4bd3-a54e-afbf146bd2ca

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

A preview of the website (the last 30 builds are retained):

To install this version:

  • git fetch https://github.com/googleforgames/agones.git pull/2947/head:pr_2947 && git checkout pr_2947
  • helm install agones ./install/helm/agones --namespace agones-system --agones.image.release=us-docker.pkg.dev/agones-images/ci --set agones.image.tag=1.30.0-26a361d-amd64

@chiayi chiayi force-pushed the main branch 2 times, most recently from 0837dc4 to 883ee6f Compare February 3, 2023 22:02
@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: 43a885e2-293a-4b9a-9999-33a6a9c0edbd

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

A preview of the website (the last 30 builds are retained):

To install this version:

  • git fetch https://github.com/googleforgames/agones.git pull/2947/head:pr_2947 && git checkout pr_2947
  • helm install agones ./install/helm/agones --namespace agones-system --agones.image.release=us-docker.pkg.dev/agones-images/ci --set agones.image.tag=1.30.0-0837dc4-amd64

@chiayi chiayi marked this pull request as ready for review February 3, 2023 22:25
@chiayi chiayi requested review from zmerlynn and roberthbailey and removed request for cyriltovena and EricFortin February 3, 2023 22:25
@chiayi chiayi requested review from markmandel and removed request for aLekSer and dzlier-gcp February 3, 2023 22:25
@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: feb60f68-9643-48ad-b6cb-b2c81d8e57f3

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

A preview of the website (the last 30 builds are retained):

To install this version:

  • git fetch https://github.com/googleforgames/agones.git pull/2947/head:pr_2947 && git checkout pr_2947
  • helm install agones ./install/helm/agones --namespace agones-system --agones.image.release=us-docker.pkg.dev/agones-images/ci --set agones.image.tag=1.30.0-883ee6f-amd64

@@ -354,6 +355,24 @@ else
endif
echo "Finishing e2e controller failure test!"

test-e2e-ha-extensions: FEATURE_GATES ?= $(ALPHA_FEATURE_GATES)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Non-blocking: I would like us to look at reducing redundancy here since we're repeating ourselves a lot. It's not clear to me that the original split couldn't be done a different way - it might be nice to try folding all of this back into the main e2e package. But certainly this is fine for this PR.

ctx := context.Background()

if !runtime.FeatureEnabled(runtime.FeatureSplitControllerAndExtensions) {
logger.Infof("Skip test. SplitControllerAndExtensions feature is not enabled: flag is %v", runtime.FeatureEnabled(runtime.FeatureSplitControllerAndExtensions))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done!

logger.WithField("gsKey", readyGs.ObjectMeta.Name).Info("GameServer Ready")

gsClient := framework.AgonesClient.AgonesV1().GameServers(defaultNs)
defer gsClient.Delete(ctx, readyGs.ObjectMeta.Name, metav1.DeleteOptions{}) // nolint: errcheck
Copy link
Collaborator

Choose a reason for hiding this comment

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

since it's literally the last thing we do it's a little funny to defer it. Plus you can just collapse the helper variable here, and re-lintcheck it. So:

assert.NoError(t, framework.AgonesClient.AgonesV1().GameServers(defaultNs).Delete(
  ctx, readyGs.ObjectMeta.Name, metav1.DeleteOptions{})

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup it is 😅 combined the lines.

// faking a extensions pod crash.
func deleteAgonesExtensionsPods(ctx context.Context) error {
list, err := getAgoneseExtensionsPods(ctx)
if err != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

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

here and below, I'd be inclined to throw in a t *testing.T parameter and just use assert.NoError(t, err). Keeps it more concise and better tracks the line number of failures.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done! As for the method below waitForAgonesExtensionsRunning, I don't think it makes sense to add t *testing.T as it won't be able to use it since it still needs to return the bool.


list, err := getAgoneseExtensionsPods(ctx)
logger.Infof("Length of pod list is %v", len(list.Items))
if err != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use assert.NoError here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

if err != nil {
t.Fatalf("Could not get list of Extension pods: %v", err)
}
if len(list.Items) <= 1 {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use assert.Greater. The message is nice, though, so you can keep:

assert.Greater(list.Items, 1, "Cluster has zero or one extension pods")

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh thats neat, I did not know this was an option.

logger.Info("Creating default game server")
gs := framework.DefaultGameServer(defaultNs)
readyGs, err := framework.CreateGameServerAndWaitUntilReady(t, defaultNs, gs)
if err != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

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

assert.NoError()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done!

@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: bcd43570-9a7a-4eca-9d62-aa0244e2e301

To get permission to view the Cloud Build view, join the agones-discuss Google Group.

@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: a8c90adb-ad7f-4479-915b-0bad7ee5f014

To get permission to view the Cloud Build view, join the agones-discuss Google Group.

Started e2e test for extensions
@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: 7793eb64-aef5-43a0-a2d9-2592cb4bdf62

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

A preview of the website (the last 30 builds are retained):

To install this version:

  • git fetch https://github.com/googleforgames/agones.git pull/2947/head:pr_2947 && git checkout pr_2947
  • helm install agones ./install/helm/agones --namespace agones-system --agones.image.release=us-docker.pkg.dev/agones-images/ci --set agones.image.tag=1.30.0-def9b4f-amd64

@chiayi chiayi requested a review from zmerlynn February 6, 2023 22:52
@google-oss-prow google-oss-prow bot added the lgtm label Feb 6, 2023
@google-oss-prow
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: chiayi, zmerlynn
Once this PR has been reviewed and has the lgtm label, please assign roberthbailey for approval by writing /assign @roberthbailey in a comment. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@zmerlynn zmerlynn merged commit f7a7472 into googleforgames:main Feb 6, 2023
@Kalaiselvi84 Kalaiselvi84 added this to the 1.30.0 milestone Feb 28, 2023
@Kalaiselvi84 Kalaiselvi84 added the kind/feature New features for Agones label Feb 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature New features for Agones lgtm size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants