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

Simple Game Server: Add \n to Counters and Lists Response #3589

Merged
merged 30 commits into from
Jan 30, 2024

Conversation

Kalaiselvi84
Copy link
Contributor

@Kalaiselvi84 Kalaiselvi84 commented Jan 11, 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:

Which issue(s) this PR fixes:

Closes #3586

Special notes for your reviewer:

@github-actions github-actions bot added kind/cleanup Refactoring code, fixing up documentation, etc size/S labels Jan 11, 2024
@Kalaiselvi84
Copy link
Contributor Author

I only changed GET_COUNTER_COUNT. Could you please confirm if this approach is correct? I'm unable to create a fleet with Counters and List, so I couldn't test it fully, but TestCounters passed with this change on my local.

@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: a16f7069-4ac7-406e-8019-5ea68bc354fa

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

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.

The build will fail until the example simple-game-server image has been updated (otherwise the tests pull from the old image and don't "see" any changes to the simple-game-server/main.go file.) Although we should wait to update the image until all the tests pass locally.

test/e2e/gameserver_test.go Outdated Show resolved Hide resolved
examples/simple-game-server/main.go Outdated Show resolved Hide resolved
@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: b027e7a3-fd45-49e3-883f-195f4c93a437

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

@Kalaiselvi84
Copy link
Contributor Author

Tests TestCounters and TestLists have succeeded. Log details - https://gist.github.com/Kalaiselvi84/72d9950899deb9a00eb087e592ebf515

@Kalaiselvi84 Kalaiselvi84 marked this pull request as ready for review January 17, 2024 22:14
@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: 3ee7fa76-94ab-4e6f-99e6-01a9ac3fd1a0

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

@Kalaiselvi84 Kalaiselvi84 marked this pull request as draft January 19, 2024 19:53
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.

Looks good. The only item that looked off was there appeared to be an empty error message for the GET_LIST_VALUES when the passed List does not exist.

~/agones/examples$ nc -u 34.168.36.96 7477
INCREMENT_COUNTER games 1
SUCCESS: true
GET_COUNTER_COUNT games
COUNTER: 2
DECREMENT_COUNTER sessions 1
SUCCESS: true
GET_COUNTER_COUNT sessions
COUNTER: 0
SET_COUNTER_COUNT sessions 10000
ERROR: false
SET_COUNTER_COUNT sessions 10
SUCCESS: true
GET_COUNTER_COUNT sessions
COUNTER: 10
GET_COUNTER_CAPACITY sessions
CAPACITY: 1000
SET_COUNTER_CAPACITY games 99
SUCCESS: true
GET_COUNTER_CAPACITY games
CAPACITY: 99
GET_LIST_CAPACITY rooms
CAPACITY: 333
SET_LIST_CAPACITY rooms 100
SUCCESS: true
GET_LIST_CAPACITY rooms
CAPACITY: 100
LIST_CONTAINS room1
ERROR: Invalid LIST_CONTAINS, should have 2 arguments
LIST_CONTAINS rooms room1
SUCCESS: true
LIST_CONTAINS rooms room_1
false
ACK: 
GET_LIST_LENGTH rooms
LENGTH: 3
GET_LIST_VALUES rooms
VALUES: room1,room2,room3
APPEND_LIST_VALUE rooms room4
SUCCESS: true
GET_LIST_VALUES abc
ERROR: 

GET_LIST_VALUES rooms
VALUES: room1,room2,room3,room4
DELETE_LIST_VALUE room1
ERROR: Invalid DELETE_LIST_VALUE, should have 2 arguments
DELETE_LIST_VALUE rooms room1
SUCCESS: true

@Kalaiselvi84
Copy link
Contributor Author

Kalaiselvi84 commented Jan 19, 2024

Right, also the response for the LIST_CONTAINS method should be prepended with ERROR: which is missing.

LIST_CONTAINS rooms room_1
Error: false

Will look into it.

@igooch
Copy link
Collaborator

igooch commented Jan 19, 2024

Could you also update some typos in the readme too? They're missing the second "

| "SET_LIST_CAPACITY | Returns if the List was set to a new Capacity successfully (true) or not (false) |
| "LIST_CONTAINS | Returns true if the given value is in the given List, false otherwise |
| "GET_LIST_LENGTH | Returns the length (number of values) of the given List as a string |
| "GET_LIST_VALUES | Return the values in the given List as a comma delineated string |
| "APPEND_LIST_VALUE | Returns if the given value was successfuly added to the List (true) or not (false) |
| "DELETE_LIST_VALUE | Rreturns if the given value was successfuly deleted from the List (true) or not (false) |

@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: 16e003c0-d733-4979-b4d3-cef8765c21ab

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

@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: bb0851ce-a0ee-4b5c-8fd9-ad0465f9998c

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

@Kalaiselvi84
Copy link
Contributor Author

Kalaiselvi84 commented Jan 24, 2024

I have made updates to the getListValues and listContains methods. However, I am unable to test these changes locally, or all the negative scenarios appear to be functioning as expected. However, I'm unsure why none of the methods are returning a success message.

Please review it and share your thoughts.

if len(values) > 0 {
return "VALUES: " + strings.Join(values, ",") + "\n", nil
}
return "Empty List" + strings.Join(values, ",") + "\n", err
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
return "Empty List" + strings.Join(values, ",") + "\n", err
return "VALUES: <none>\n", err

Or something like that? To be consistent with the other responses of having a "DESCRIPTOR:RESULT" format.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The response for the GetListValues empty is "VALUES: <none>\n", and the ERROR: INVALID LIST NAME response is returned for the list name if the given list name is incorrect.

$ nc -u localhost 7654
GET_COUNTER_COUNT rooms
COUNTER: 1
GET_LIST_VALUES players
VALUES: test0,test1,test2
LIST_CONTAINS players test1
FOUND: true
GET_LIST_VALUES abc
ERROR: INVALID LIST NAME
DELETE_LIST_VALUE test0
ERROR: Invalid DELETE_LIST_VALUE, should have 2 arguments
DELETE_LIST_VALUE players test0
SUCCESS: true
DELETE_LIST_VALUE players test1
SUCCESS: true
DELETE_LIST_VALUE players test2
SUCCESS: true
GET_LIST_VALUES players
VALUES:

@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: d3c6ea83-1495-4ffd-843f-2d00759bf8e6

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

@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: a4e6ace8-2853-4797-b7d6-93c6a6ea3635

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

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.

It looks like the updated image reference is missing in a couple places like test/e2e/framework.go.

@Kalaiselvi84
Copy link
Contributor Author

It looks like the updated image reference is missing in a couple places like test/e2e/framework.go.

Will update the new image in the test/e2e directory once the image pushed to prod(doing it now).

@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: 95dd8212-b214-4d84-999f-cff162a0a619

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

@Kalaiselvi84
Copy link
Contributor Author

A new image has been pushed for the simple-game-server in prod, and the necessary files have been updated with this new image.

@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: a5518d8b-eabc-4538-b057-d3a63a9fc32d

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

@Kalaiselvi84
Copy link
Contributor Author

I've pushed a new image to the simple-game-server in production. However, I'm not really sure about the reason for the build failure. Am I missing anything that needs updating? If we can't fix this build issue, should we delete the new tag from the simple-game-server since tomorrow is the release day?

@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: 0472e475-800f-45f1-9bd5-5b9e29b1f174

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/3589/head:pr_3589 && git checkout pr_3589
  • 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.38.0-dev-9af8290-amd64

@Kalaiselvi84
Copy link
Contributor Author

Log for passed tests - https://gist.github.com/Kalaiselvi84/4196d647e4c069bbe3b1237e8033ca66

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.

Congrats on getting this to pass!

I think one of my review comments kept getting lost, so I tried to make it as clear as possible. I think that's about it on review though. Lemme know if that's not clear. Shouldn't need to delete 0.26, since the current release isn't using it.

Since K8s clusters will cache existing image tags for a while, so once the review change has made, we will need to increment the version number and push again, as we can't force remove it from all clusters.

return strconv.FormatBool(ok), err
}
if ok {
return "FOUND: " + strconv.FormatBool(ok) + "\n", nil
Copy link
Member

Choose a reason for hiding this comment

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

I think this review comment got lost somewhere - but this result should be the following.

func listContains(s *sdk.SDK, listName string, value string) (string, error) {
	log.Printf("Getting List %s contains value %s", listName, value)
	ok, err := s.Alpha().ListContains(listName, value)
	if err != nil {
		log.Printf("Error getting List %s contains value %s: %s", listName, value, err)
		return strconv.FormatBool(ok), err
	}	
  return "FOUND: " + strconv.FormatBool(ok) + "\n", nil
}

Not finding a value shouldn't be an error - it's just a search function.

},
"ListContains false": {
msg: "LIST_CONTAINS games game0",
want: "false",
want: "ERROR: false\n",
Copy link
Member

Choose a reason for hiding this comment

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

This test will need to change with the update to the response.

Copy link
Contributor Author

@Kalaiselvi84 Kalaiselvi84 Jan 30, 2024

Choose a reason for hiding this comment

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

Sorry, I thought the response for ListContains false should be ERROR: false. I have now updated it as per your suggestion. The response for the ListContains is FOUND: true and for ListContains false it is FOUND: false. Does this look good to you?

Copy link
Member

Choose a reason for hiding this comment

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

👍🏻 no worries - had a feeling my suggestion wasn't 100% clear. I feel like this will break the e2e test, since a new image.

This all LGTM! We just need it to pass! Probably best bet is to increment the tag again everywhere and push a new image.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will increment the tag now

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've pushed the new image to the agones-images project and updated the necessary files with the new tag.

Copy link
Member

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.

Success! The build has finished without any issues.

@igooch igooch enabled auto-merge (squash) January 30, 2024 04:26
@Kalaiselvi84 Kalaiselvi84 marked this pull request as draft January 30, 2024 04:31
auto-merge was automatically disabled January 30, 2024 04:31

Pull request was converted to draft

@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: 9c0b19fa-d44b-4c1f-a241-ccd35430a178

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

@Kalaiselvi84 Kalaiselvi84 marked this pull request as ready for review January 30, 2024 05:57
@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: 24a044f2-fb30-48cf-b679-0a539b825789

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/3589/head:pr_3589 && git checkout pr_3589
  • 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.38.0-dev-b591f8f-amd64

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.

LGTM! @igooch giving you a last right of refusal, but if you are happy, I'm happy to merge just in time before release 👍🏻

@igooch igooch merged commit 2477589 into googleforgames:main Jan 30, 2024
4 checks passed
@Kalaiselvi84 Kalaiselvi84 deleted the pr-3586 branch March 15, 2024 01:03
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 size/M size/S
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Simple Game Server: add "\n" to responses to Counters and Lists
4 participants