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

feat: allocation response with counters and lists data #3681

Merged
merged 3 commits into from
Mar 11, 2024

Conversation

katsew
Copy link
Contributor

@katsew katsew commented Mar 6, 2024

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
/kind release

What this PR does / Why we need it:

Currently the CountsAndLists feature does not return the status of counters and lists for GameServer Allocation requests.
This makes it difficult to know how the counters and lists in the GameServer changed before and after the request.
This PR modifies the response to return those data.

Which issue(s) this PR fixes:

Closes #3661

Special notes for your reviewer:

NA

@github-actions github-actions bot added kind/feature New features for Agones size/XL labels Mar 6, 2024
Copy link

github-actions bot commented Mar 6, 2024

This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size.

@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: ce442ff8-0d5a-4fc6-ae41-3037a697beef

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

@katsew katsew force-pushed the return-counts-and-lists-data branch from 5d54199 to 66cf2cb Compare March 6, 2024 12:05
Copy link

github-actions bot commented Mar 6, 2024

This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size.

@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: 2e525cfd-5707-4dd3-9806-dad09a2b8a17

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/3681/head:pr_3681 && git checkout pr_3681
  • helm install agones ./install/helm/agones --namespace agones-system --set agones.image.registry=us-docker.pkg.dev/agones-images/ci --set agones.image.tag=1.39.0-dev-66cf2cb-amd64

@markmandel markmandel requested a review from igooch March 7, 2024 03:35
Copy link
Member

@markmandel markmandel left a comment

Choose a reason for hiding this comment

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

This looks amazing! A few of additional things I think we need to finish this off:

Let's add some e2e integration tests:

func TestCounterAndListGameServerAllocation(t *testing.T) {

May be a good spot to add in some tests for allocation returns.

https://github.com/googleforgames/agones/blob/main/test/e2e/allocator_test.go

I don't think we have a test in here for Counters and Lists (@igooch did I miss a test in here?), so will have to write one -- probably only needs to be something that just checks that conversation between GameServerAllocation and the proto works.

Also, let's add some docs!

https://agones.dev/site/docs/reference/gameserverallocation/#:~:text=Once%20created%20the%20GameServerAllocation%20will%20have%20a%20status%20field%20consisting%20of%20the%20following in this section.

For the new docs, please wrap them in a feature code for the next release as per https://agones.dev/site/docs/contribute/

Copy link

github-actions bot commented Mar 7, 2024

This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size.

@katsew
Copy link
Contributor Author

katsew commented Mar 7, 2024

@markmandel

Thank you for your review!
I added the doc and tests, but I misread your comment and wrote the test in allocator_test.go ...
I will write a test in gameserverallocation_test.go soon.
If it is better to leave allocator_test.go as well, I will leave it as it is, but what do you think?

@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: 2258167c-bfc1-4a52-bec9-cdcf28aaf437

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/3681/head:pr_3681 && git checkout pr_3681
  • helm install agones ./install/helm/agones --namespace agones-system --set agones.image.registry=us-docker.pkg.dev/agones-images/ci --set agones.image.tag=1.39.0-dev-7c467db-amd64

@markmandel
Copy link
Member

@markmandel

Thank you for your review! I added the doc and tests, but I misread your comment and wrote the test in allocator_test.go ... I will write a test in gameserverallocation_test.go soon. If it is better to leave allocator_test.go as well, I will leave it as it is, but what do you think?

This is awesome!

I'd definitely keep everything in allocator_test.go, my thought would be - for:

func TestCounterAndListGameServerAllocation(t *testing.T) {

Enhance this test to also check expected return values for list and/or counter values for each test case.

I think here would be the right spot:

gsa, err = framework.AgonesClient.AllocationV1().GameServerAllocations(flt.ObjectMeta.Namespace).Create(ctx, gsa.DeepCopy(), metav1.CreateOptions{})
require.NoError(t, err)
assert.Equal(t, string(testCase.wantAllocated), string(gsa.Status.State))
assert.Equal(t, gs1.ObjectMeta.Name, gsa.Status.GameServerName)

And I think this would be good to go - and we can squeeze this in before release next Tuesday!

Very excited to see this get added!

Copy link

github-actions bot commented Mar 8, 2024

This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size.

@@ -589,6 +591,10 @@ func TestCounterAndListGameServerAllocation(t *testing.T) {
}
require.NoError(t, err)
assert.Equal(t, string(testCase.wantAllocated), string(gsa.Status.State))
if gsa.Status.State == allocated {
Copy link
Contributor Author

@katsew katsew Mar 8, 2024

Choose a reason for hiding this comment

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

I thought this test is for counters and lists selector, so I check that the status of counters and lists does not change before/after request.
Since GSA may returns UnAllocated state, check the status only if GSA state is Allocated.
Please correct me if i'm wrong.

Copy link
Member

Choose a reason for hiding this comment

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

This makes sense to me!

@katsew
Copy link
Contributor Author

katsew commented Mar 8, 2024

@markmandel

Thanks for the review.
I have written additional tests in gameserverallocation_test.go.
I commented where I wasn't sure, so please let me know if there are any problems.

Copy link
Member

@markmandel markmandel left a comment

Choose a reason for hiding this comment

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

This LGTM!

@igooch did you wan to take a look and see if I missed anything? Otherwise, i think this is good to merge before release next week.

@@ -589,6 +591,10 @@ func TestCounterAndListGameServerAllocation(t *testing.T) {
}
require.NoError(t, err)
assert.Equal(t, string(testCase.wantAllocated), string(gsa.Status.State))
if gsa.Status.State == allocated {
Copy link
Member

Choose a reason for hiding this comment

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

This makes sense to me!

@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: 3ea62294-ae0d-4a93-9321-18e23ea2ee29

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/3681/head:pr_3681 && git checkout pr_3681
  • helm install agones ./install/helm/agones --namespace agones-system --set agones.image.registry=us-docker.pkg.dev/agones-images/ci --set agones.image.tag=1.39.0-dev-fba6863-amd64

@katsew
Copy link
Contributor Author

katsew commented Mar 8, 2024

Thank you for approval.
I'll rebase my changes into a single commit.
If there are any additional corrections needed, please let me know.

@katsew katsew force-pushed the return-counts-and-lists-data branch from fba6863 to 1db67b4 Compare March 8, 2024 07:38
Copy link

github-actions bot commented Mar 8, 2024

This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size.

@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: ea24dfbf-0e4e-4bdf-ac2b-b04cb3e1914a

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/3681/head:pr_3681 && git checkout pr_3681
  • helm install agones ./install/helm/agones --namespace agones-system --set agones.image.registry=us-docker.pkg.dev/agones-images/ci --set agones.image.tag=1.39.0-dev-1db67b4-amd64

Copy link

This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size.

@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: 68d9ec15-3252-4c6a-aaee-d4cbb1d4d375

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

@markmandel
Copy link
Member

Weird flake with csharp sdk

Could not send ready message. StatusCode=Unavailable, Detail=Error connecting to subchannel.
{"grpcEndpoint":":9005","message":"Starting SDKServer grpc service...","severity":"info","source":"main","time":"2024-03-11T17:00:42.815571669Z"}
{"httpEndpoint":":9105","message":"Starting SDKServer grpc-gateway...","severity":"info","source":"main","time":"2024-03-11T17:00:42.81722091Z"}
make[3]: *** [includes/sdk.mk:91: run-sdk-command] Error 1
{"message":"Shutting down SDK server","severity":"info","source":"main","time":"2024-03-11T17:01:06.038057474Z"}
{"message":"Received requests match expected list. Test run was successful","sdkName":"rust","severity":"info","source":"*sdkserver.LocalSDKServer","time":"2024-03-11T17:01:06.038153154Z"}
{"error":"http: Server closed","message":"http server closed","severity":"info","source":"main","time":"2024-03-11T17:01:06.038219772Z"}

Copy link

This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size.

@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: 1e4a92f2-c846-44dd-b928-6318beac54cf

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/3681/head:pr_3681 && git checkout pr_3681
  • helm install agones ./install/helm/agones --namespace agones-system --set agones.image.registry=us-docker.pkg.dev/agones-images/ci --set agones.image.tag=1.39.0-dev-c9930e2-amd64

Copy link
Collaborator

@igooch igooch left a comment

Choose a reason for hiding this comment

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

LGTM

@markmandel markmandel merged commit 8cf0986 into googleforgames:main Mar 11, 2024
4 checks passed
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 size/XL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Return Counter and List data when Allocating a GameServer
5 participants