-
Notifications
You must be signed in to change notification settings - Fork 813
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 support for empty ports #2006
Conversation
Build Failed 😱 Build Id: a98e3d35-1c69-4242-88d8-d4259bc66350 To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
Looks like Helm is being grumpy with the change to the CRD 😬 it's been doing that as of late with the new schema changes, I can handhold that one through e2e testing. At first glance, this looks good (I'll do a deeper review at some point) - the only thing I would advocate for - somewhere in https://github.com/googleforgames/agones/blob/main/test/e2e/gameserver_test.go write an e2e test that confirms you can create a GameServer with no ports, and nothing falls over. Thanks for doing this work! |
I'm getting this weird error I get sometimes with Github, and I can't update the branch with So I'll wait for the e2e test to come in and walk it through the e2e tests then. If you run into issues / would like some help, please feel free to drop into #development on Slack, and ask questions as well! |
Gonna write the e2e test tomorrow 👍 |
I've added an e2e test but was not able to test it locally against a Google Cloud cluster. I get the same error while trying to use |
Build Failed 😱 Build Id: d2ee40af-27d9-4774-8401-331a393da848 To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
Build Failed 😱 Build Id: 8e99de69-935f-4304-a8f0-92fc7264e1ce To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
This looks good, looks like you are hitting helm/helm#5806 which won't get fixed until K8s 1.20 😕 We're hitting this in a couple of other places. The workaround locally is to do a full delete of the helm installation before re-installing. I'll hand hold this through e2e test shortly. |
The allow edits by maintainers is not possible for organization repositories. @markmandel I've invited you to write to the repository. If this is not how you handle things I could fork the project with my private account and create a PR again. |
AAAAAAAAAAAAAAAAAAAAAAAAAAAH! That's why I can't update SOME PR's!!! This has been driving me up the wall for eons. Don't give me write permissions on your repo -- that's seems icky. Ping me on Slack when you want to update this PR to master, and I can handhold it through e2e tests 👍 |
Actually, if you are happy, I'll take the write permissions on the repo -- let me know whichever way works best for you. |
Build Failed 😱 Build Id: b35cb2cb-3e9d-41ee-aaee-171e20711ec5 To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
Build Failed 😱 Build Id: 092ac484-0bfd-43d3-8fb3-52593302817f To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
Can you run |
Just a heads up - RC is next Tuesday, but let's see if we can squeeze this in. |
Build Failed 😱 Build Id: ba891ad7-ba8a-4aab-bf7e-01dbf2c94623 To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
Build Failed 😱 Build Id: 5963b5ee-f606-43a4-9f33-3e56b0eb6374 To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
Build Failed 😱 Build Id: 72dc8b53-d10a-43a9-9577-858a7e1376fc To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
Build Succeeded 👏 Build Id: fef7de53-b71c-4e49-ba3a-9e4fa4be5d38 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:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yay we passed!
Just had a couple of minor things that I think could be cleaned up. Would also like a second opinion on CreateGameServerAndWaitUntilReadyWithOptionalPortCheck
🤔
test/e2e/framework/framework.go
Outdated
} | ||
|
||
// CreateGameServerAndWaitUntilReadyWithOptionalPortCheck Creates a GameServer and wait for its state to become ready. | ||
func (f *Framework) CreateGameServerAndWaitUntilReadyWithOptionalPortCheck(ns string, gs *agonesv1.GameServer, portCheck bool) (*agonesv1.GameServer, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm trying to decide if CreateGameServerAndWaitUntilReadyWithOptionalPortCheck
is necessary.
We already cover this by checking on ports in this test for example (I'm sure there are others).
@roberthbailey WDYT?
I get the impetus to check all other tests, but I'm not sure it's required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at your new test code, I'm guessing that you added this because without passing in false, line 227 (in the old file) was returning an error, because there was no port.
But the test should be able to inspect the passed in game server and tell if a port should be created (by seeing if spec.Ports is nil). And then you can modify the check for ports to read something like "if the spec has a port and none was allocated, return an error" instead of what we have currently ("assume that there will always be a port so check to see if one was allocated").
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/googleforgames/agones/blob/main/test/e2e/framework/framework.go#L227 - just for reference 😄
That's a really good point @roberthbailey , that could become:
if len(readyGs.Status.Ports) == len(gsCopy.Spec.Ports) {
return nil, fmt.Errorf("Ready GameServer instance has no port: %v", readyGs.Status)
}
Don't think we need nil checks either, since len(nil)
is 0
Which is far more elegant 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you mean !=
Also, the error message needs to be updated to print the expected number of ports and the observed number of ports:
if len(readyGs.Status.Ports) != len(gsCopy.Spec.Ports) {
return nil, fmt.Errorf("Ready GameServer instance has %d port(s), want %v", readyGs.Status, gsCopy.Spec.Ports)
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes! I did, excellent catch. I like it!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the input. I've updated the PR accordingly. 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to include a check when the port protocol is ProtocolTCPUDP. Hope this is fine.
test/e2e/gameserver_test.go
Outdated
assert.True(t, valid) | ||
|
||
readyGs, err := framework.CreateGameServerAndWaitUntilReadyWithOptionalPortCheck(framework.Namespace, gs, false) | ||
if err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit:
This if err != nil
block can be changed to:
require.NoError(err)
(I know we have the assert.FailNow()
pattern in a bunch of places, but that was before we had access to require
😄 )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
test/e2e/gameserver_test.go
Outdated
assert.FailNow(t, "Could not get a GameServer ready", err.Error()) | ||
} | ||
|
||
assert.Nil(t, readyGs.Spec.Ports) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a thought. This might be better, just because nil vs an empty array are both valid return results. Not a strong opinion.
https://pkg.go.dev/github.com/stretchr/testify/assert#Empty
assert.Nil(t, readyGs.Spec.Ports) | |
assert.Empty(t, readyGs.Spec.Ports) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you are right. assert.Empty itself does a null check.
Done
Build Failed 😱 Build Id: f142efd1-ddbe-407f-9764-6ec8338052bc To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
Build Failed 😱 Build Id: 51581103-5fc9-459f-98c9-8210b64bcb77 To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
…rts between the started game server and input game server are equal
Build Failed 😱 Build Id: 039dc21a-b3f5-4673-87b5-839237a0be75 To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
Build Succeeded 👏 Build Id: 38e323f3-1130-4fe6-9330-9339d9d3fb27 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:
|
Build Failed 😱 Build Id: e27af99f-10d0-4d7f-b96a-b1625cba4c4d To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
Build Succeeded 👏 Build Id: 4074d155-8364-40ca-9429-d9f1755c5b0f 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:
|
The PR got reviewed and is ready to be merged if my changes are accepted. /assign @cyriltovena |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like it! Let's get this merged!
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ItsKev, markmandel The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind feature
What this PR does / Why we need it:
This PR adds support for empty ports.
Which issue(s) this PR fixes:
Closes #749
Special notes for your reviewer:
This is my first time working with GO. If I can improve anything feel free to point me in the right direction.
Somehow the install.yaml shows a lot of changes. Looking through them in GoLand however, does not show me any changes at all on certain lines.