-
Notifications
You must be signed in to change notification settings - Fork 831
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
Agones Unity SDK development setup instructions + Agones Unity SDK Ready test #3887
Agones Unity SDK development setup instructions + Agones Unity SDK Ready test #3887
Conversation
Build Succeeded 👏 Build Id: 5078706a-0651-4905-aa15-cae53be14e47 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 Succeeded 👏 Build Id: 9ff063dc-f993-481a-a6dd-a505f55b3f6a 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:
|
Noob question -- what are the steps to run the tests? Are we able to run the tests similar to vanilla csharp (csharp SDK tests have the non-obvious steps of 1. navigating to |
For the tests setup I added in #3883, I added a README that might help answer this for you. It's at the very bottom of the PR. My understanding is that it's basically impossible to run these tests without the unity editor. Even the common CI setups for Unity are just running a dockerized editor. |
Would it makes sense to open up a new issue for creating some sort of pipeline for running the Unity tests? Possibly CloudBuild could take in a Unity license as a Secret and run the tests in the dockerized editor mode? |
@igooch You're definitely right that developing unity packages is not intuitive. I wrote documentation in this PR (#3886) for how to set up a testing environment that's common. I've used this setup when contributing to other unity open source projects like Mirror. You can follow the instructions in that PR to set up to then develop a unity package. Should I merge that PR into this one, so documentation exists along with this test? |
@igooch I can help with using game CI's docker container to run tests. I've used that container image before to cross platform test & build in parallel since I didn't like serially builds in unity editor. There's a little setup to do but I've scripted its use out before. Would need to review this project's CI more to understand how to introduce a new testing step (guidance is welcome and appreciated!) Unity docker usage seems outside the scope of this PR, maybe, since it's a test suite agnostic enhancement? WDYT? |
231e3c4
to
48eaee5
Compare
Build Succeeded 👏 Build Id: b324d10c-f98c-4b56-ac8d-e0ab706f6e3c 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:
|
48eaee5
to
59d85ff
Compare
Build Succeeded 👏 Build Id: a2c8734d-c23a-468c-9cd5-b2d57fa26499 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:
|
… contributing to agones unity sdk
Co-authored-by: igooch <igooch@google.com>
Co-authored-by: igooch <igooch@google.com>
af604a3
to
0ddf6f2
Compare
@zmerlynn @igooch @markmandel tagging for some review. Thank you in advance! |
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 doing this! Mostly nit comments.
|
||
namespace Agones | ||
{ | ||
public interface IRequestSender |
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.
oooh, what's this do? 😄 👀
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.
This is a way of being able to stub out the HTTP request that ultimately gets sent by the Agones Unity component. There are implications on code (a protected method is now public, a new public property exists on AgonesSdk
component) but it was as minimally invasive to the production code as I could come up with. You can see in sdks/unity/AgonesSdk.cs
that the component implements IRequestSender
and also assigns itself to the component property IRequestSender requestSender
on component start.
Check out sdks/unity/Tests/Runtime/PlayMode/AgonesSdkComplianceTests.cs
and sdks/unity/Tests/TestingEnvironment/SpyRequestSender.cs
to see how a London style test is then used to ensure when an Agones method is called an HTTP request should get sent. This test overrides the new public property.
Other things I had tried:
- A previous version of code (4e8caa0) spins up a generic HTTP server that allows the test code to specify an HTTP response. Felt too clever.
- Use reflection to override some
UnityWebRequest
functionality. I got somewhere with this butUnityWebRequest
is hard to override functionality (no virtual methods, no interfaces, etc). - Install a dev package dependency to
sdks/unity/package.json
; I learned that although a Unity Custom Package manifest does allow one to specifydependencies
property it won't allow one to spell outscopedRegistries
to be able to use openupm ornpm
to gain access to non-Unity registry libraries (see "Optional Properties" in Unity Custom Package: Package Manifest Unity docs). _Even if I could install anything onopenupm
I can't use a library like NSubstitute onUnityWebRequest
for aforementioned reasons.
I'm open to suggestions/thoughts!
Co-authored-by: Mark Mandel <markmandel@google.com>
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. |
Build Succeeded 👏 Build Id: a8a38947-9a0f-40c2-835e-164b4f2dd94a 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:
|
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. |
@markmandel I added an apache header to all added C# code in this PR. I also added it to I debated if I should mark the year 2019 or 2024; I opted for 2024. |
Build Succeeded 👏 Build Id: d103deee-ec55-427d-8f3a-09e9f2f2cbd6 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:
|
Happy to update my PR #3883 to use this project if that's what we go for. The tests in my project run against a local SDK server rather than a mock. That seems complimentary to what you have here, so I figure we will want to keep it around rather than replace it. |
@ZeroParticle Thanks for weighing in! Yes I think adding tests in the style of this PR is better than in the style of your PR. The style of this PR has the tests contained within the package files which is more expected for a custom unity package. I'm hoping @markmandel (and/or other(s)) review/merge this PR soon which will enable both of us to evolve this base code. |
@zmerlynn @igooch @markmandel tagging for another round of review. Thank you again in advance! |
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. |
Build Succeeded 👏 Build Id: 236d2f3a-47a4-4f8d-b91e-3f44b53c18f2 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 Succeeded 👏 Build Id: 368d740a-cdb0-4269-bcb7-864b648876e7 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:
|
@ZeroParticle @aallbrig - @markmandel and I were chatting. We don't have a great way to test this right now, unfortunately. @ZeroParticle, if I review this, would you be up for ad hoc testing and seeing if it looks reasonable? @aallbrig - same question for other Unity PRs as they come in. Basically, if y'all are willing, we're happy to review and then gradually let y'all be the Unity maintainers, but we may need help on the testing front. |
Build Succeeded 👏 Build Id: 9617c1de-a0d0-4f9b-aecb-8f12a1a9e185 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:
|
@zmerlynn I would be happy to help with the Agones Unity SDK maintenance and development. I think @ZeroParticle and I can help with testing and other project needs. I think we both agree this PR will serve as a good base PR to build more tests for the Agones Unity SDK. Once merged, @ZeroParticle's AgonesSDK additions (+tests) can move under the Agones Custom Unity Package and I can help by code review + checking out the branch code on my machine. I'll try to think up a way to make testing an easier to prove out for a broader audience. |
Was trying to get gameci docker container working but got stuck. They changed how licenses work in Unity, and a license is required to be able to use the Unity editor app. Gameci is based on Ubuntu; a hub generated license is tied to the hardware/OS -- so using my M2 license won't work for an Ubuntu container. Unity changed the process of obtaining a license. It's generated through Unity Hub app now. I was reverse engineering what gameci does. There's plenty of JS that obfuscates so I just need to keep reading and experimenting. There is a way of generating docker commands to run tests (I've done it before), just need to work out the license limitations. The reason I bring up gameci is because it could help make running tests something that can run in a container, which may decrease the burden of contributing to Agones Unity SDK. Imagine recommending a user run a few commands instead of downloading/installing Unity Hub, mucking with a GUI, then opening the project in Unity Editor to then run some tests. Just posting some updates. I'm still hoping that this PR is deemed mergeable even without the gameci docker commands. Getting the initial Unity project set up and configured to pull in the local copy of Agones Unity SDK is foundational to further development. Even though it would be better to have shareable docker commands, we still have a way of developing/testing the Agones Unity SDK as documented in this PR. |
I'm happy to take this as a base PR to build on. Thanks @aallbrig and @ZeroParticle ! |
Woohoo! Cc: @ZeroParticle it's been merged! Let me know if you need/want any help on your Agones Unity SDK additions/tests. |
This PR contains the following updates: | Package | Update | Change | |---|---|---| | [agones](https://agones.dev) ([source](https://redirect.github.com/googleforgames/agones)) | minor | `1.42.0` -> `1.43.0` | --- > [!WARNING] > Some dependencies could not be looked up. Check the Dependency Dashboard for more information. --- ### Release Notes <details> <summary>googleforgames/agones (agones)</summary> ### [`v1.43.0`](https://redirect.github.com/googleforgames/agones/releases/tag/v1.43.0) [Compare Source](https://redirect.github.com/googleforgames/agones/compare/v1.42.0...v1.43.0) This is the 1.43.0 release of Agones. In this release, we updated the supported Kubernetes version, added a new scheduled autoscaler, as well as Unity support for Counters and Lists.. - **Kubernetes 1.30 Support** With this release, the Kubernetes support matrix for Agones is now 1.28, 1.29 and 1.30. - **Alpha support for ScheduledAutoscaler** This provides the ability to have Fleet autoscaler scheduling with the feature flag `ScheduledAutoscaler`, to allow you to schedule what level of autoscaling you would like on a schedule or between dates, giving you more control over your autoscaling needs. - **Unity SDK: Counters and Lists** We now have support for `GameServer` [Counters and Lists](https://agones.dev/site/docs/guides/counters-and-lists/) with our Unity SDK! - **New Helm Installation Configuration Options** Two new installation options! We made the parameters that control how fast we scale up and down `GameServers` configurable, so you can see how fast your Kubernetes control plane really is when spinning up lots of `GameServer` instances. We also have new Helm configuration options that allow the use of the host network for the Agones controller and extensions for AWS EKS when using Cilium. - **Beta support for Passthrough PortPolicy on GKE Autopilot** We’ve graduated Passthrough Port Policy support from Alpha to Beta on GKE Autopilot, which you can now enable using the feature flag `AutopilotPassthroughPort`. <!-- Release notes generated using configuration in .github/release.yml at main --> #### What's Changed ##### Breaking changes - Revert "Update Supported Kubernetes to 1.28, 1.29, 1.30 ([#​3933](https://redirect.github.com/googleforgames/agones/issues/3933))" by [@​gongmax](https://redirect.github.com/gongmax) in [https://github.com/googleforgames/agones/pull/3952](https://redirect.github.com/googleforgames/agones/pull/3952) ##### Implemented enhancements - Add Option to Use Host Network and Configure Ports by [@​Orza](https://redirect.github.com/Orza) in [https://github.com/googleforgames/agones/pull/3895](https://redirect.github.com/googleforgames/agones/pull/3895) - Graduate Passthrough Port Policy to Beta on Autopilot by [@​vicentefb](https://redirect.github.com/vicentefb) in [https://github.com/googleforgames/agones/pull/3916](https://redirect.github.com/googleforgames/agones/pull/3916) - Agones Unity SDK development setup instructions + Agones Unity SDK Ready test by [@​aallbrig](https://redirect.github.com/aallbrig) in [https://github.com/googleforgames/agones/pull/3887](https://redirect.github.com/googleforgames/agones/pull/3887) - feat: Add API Changes and Validation for FleetAutoscaler Schedule/Chain Policy by [@​indexjoseph](https://redirect.github.com/indexjoseph) in [https://github.com/googleforgames/agones/pull/3893](https://redirect.github.com/googleforgames/agones/pull/3893) - feat: Adds autoscaling logic for new Chain and Schedule policies by [@​indexjoseph](https://redirect.github.com/indexjoseph) in [https://github.com/googleforgames/agones/pull/3929](https://redirect.github.com/googleforgames/agones/pull/3929) - Adds basic framework for the in place Agones upgrades test controller by [@​igooch](https://redirect.github.com/igooch) in [https://github.com/googleforgames/agones/pull/3956](https://redirect.github.com/googleforgames/agones/pull/3956) - \[Performance] - Added a new metric inside the allocator to track the success retry rate inside the retry loop by [@​vicentefb](https://redirect.github.com/vicentefb) in [https://github.com/googleforgames/agones/pull/3927](https://redirect.github.com/googleforgames/agones/pull/3927) - Make the parameters that limits the number of GameServers to add configurable by [@​vicentefb](https://redirect.github.com/vicentefb) in [https://github.com/googleforgames/agones/pull/3950](https://redirect.github.com/googleforgames/agones/pull/3950) - feat: Adds e2e tests for chain/schedule policy and bump ScheduledAutoscaler to Alpha by [@​indexjoseph](https://redirect.github.com/indexjoseph) in [https://github.com/googleforgames/agones/pull/3946](https://redirect.github.com/googleforgames/agones/pull/3946) - Implement CountsAndLists for Unity SDK + Tests by [@​ZeroParticle](https://redirect.github.com/ZeroParticle) in [https://github.com/googleforgames/agones/pull/3883](https://redirect.github.com/googleforgames/agones/pull/3883) ##### Fixed bugs - Resolves `make site-server` issue [#​3885](https://redirect.github.com/googleforgames/agones/issues/3885) by [@​aallbrig](https://redirect.github.com/aallbrig) in [https://github.com/googleforgames/agones/pull/3914](https://redirect.github.com/googleforgames/agones/pull/3914) ##### Other - Preparation for Release v1.43.0 by [@​kamaljeeti](https://redirect.github.com/kamaljeeti) in [https://github.com/googleforgames/agones/pull/3910](https://redirect.github.com/googleforgames/agones/pull/3910) - Introduce external resource(s) on multiplayer game programming to docs by [@​aallbrig](https://redirect.github.com/aallbrig) in [https://github.com/googleforgames/agones/pull/3884](https://redirect.github.com/googleforgames/agones/pull/3884) - Added line of code to update failure count details inside runscenario by [@​vicentefb](https://redirect.github.com/vicentefb) in [https://github.com/googleforgames/agones/pull/3915](https://redirect.github.com/googleforgames/agones/pull/3915) - updated golang upgrade template by [@​ashutosji](https://redirect.github.com/ashutosji) in [https://github.com/googleforgames/agones/pull/3902](https://redirect.github.com/googleforgames/agones/pull/3902) - Changes for GitHub/Cloud Build app integration by [@​zmerlynn](https://redirect.github.com/zmerlynn) in [https://github.com/googleforgames/agones/pull/3918](https://redirect.github.com/googleforgames/agones/pull/3918) - Meta: Contributor role by [@​markmandel](https://redirect.github.com/markmandel) in [https://github.com/googleforgames/agones/pull/3922](https://redirect.github.com/googleforgames/agones/pull/3922) - Fix allocator metrics endpoint by [@​vicentefb](https://redirect.github.com/vicentefb) in [https://github.com/googleforgames/agones/pull/3921](https://redirect.github.com/googleforgames/agones/pull/3921) - Meta: Contributor => Collaborator by [@​markmandel](https://redirect.github.com/markmandel) in [https://github.com/googleforgames/agones/pull/3928](https://redirect.github.com/googleforgames/agones/pull/3928) - Rewrite agones-bot, commit to Agones repo by [@​zmerlynn](https://redirect.github.com/zmerlynn) in [https://github.com/googleforgames/agones/pull/3923](https://redirect.github.com/googleforgames/agones/pull/3923) - Small cleanup of incorrect comment in features.go file by [@​igooch](https://redirect.github.com/igooch) in [https://github.com/googleforgames/agones/pull/3944](https://redirect.github.com/googleforgames/agones/pull/3944) - Update Supported Kubernetes to 1.28, 1.29, 1.30 by [@​ashutosji](https://redirect.github.com/ashutosji) in [https://github.com/googleforgames/agones/pull/3933](https://redirect.github.com/googleforgames/agones/pull/3933) - remove ctx within the condition func by [@​peterzhongyi](https://redirect.github.com/peterzhongyi) in [https://github.com/googleforgames/agones/pull/3959](https://redirect.github.com/googleforgames/agones/pull/3959) - Reapply "Update Supported Kubernetes to 1.28, 1.29, 1.30 ([#​3933](https://redirect.github.com/googleforgames/agones/issues/3933))" ([#​3](https://redirect.github.com/googleforgames/agones/issues/3)… by [@​gongmax](https://redirect.github.com/gongmax) in [https://github.com/googleforgames/agones/pull/3961](https://redirect.github.com/googleforgames/agones/pull/3961) - change kubernetes API version to fix broken CI by [@​peterzhongyi](https://redirect.github.com/peterzhongyi) in [https://github.com/googleforgames/agones/pull/3962](https://redirect.github.com/googleforgames/agones/pull/3962) - docs(godot): add Agones x Godot third party example by [@​andresromerodev](https://redirect.github.com/andresromerodev) in [https://github.com/googleforgames/agones/pull/3938](https://redirect.github.com/googleforgames/agones/pull/3938) - Link Unity Netcode for Gameobjects example in documentation by [@​mbychkowski](https://redirect.github.com/mbychkowski) in [https://github.com/googleforgames/agones/pull/3937](https://redirect.github.com/googleforgames/agones/pull/3937) - Docs: Use k8s-api-version for links by [@​markmandel](https://redirect.github.com/markmandel) in [https://github.com/googleforgames/agones/pull/3963](https://redirect.github.com/googleforgames/agones/pull/3963) #### New Contributors - [@​Orza](https://redirect.github.com/Orza) made their first contribution in [https://github.com/googleforgames/agones/pull/3895](https://redirect.github.com/googleforgames/agones/pull/3895) **Full Changelog**: googleforgames/agones@v1.42.0...v1.43.0 Images available with this release: - [us-docker.pkg.dev/agones-images/release/agones-controller:1.43.0](https://us-docker.pkg.dev/agones-images/release/agones-controller:1.43.0) - [us-docker.pkg.dev/agones-images/release/agones-sdk:1.43.0](https://us-docker.pkg.dev/agones-images/release/agones-sdk:1.43.0) - [us-docker.pkg.dev/agones-images/release/agones-ping:1.43.0](https://us-docker.pkg.dev/agones-images/release/agones-ping:1.43.0) - [us-docker.pkg.dev/agones-images/release/agones-allocator:1.43.0](https://us-docker.pkg.dev/agones-images/release/agones-allocator:1.43.0) - [us-docker.pkg.dev/agones-images/examples/allocation-endpoint-proxy:0.9](https://us-docker.pkg.dev/agones-images/examples/allocation-endpoint-proxy:0.9) - [us-docker.pkg.dev/agones-images/examples/autoscaler-webhook:0.14](https://us-docker.pkg.dev/agones-images/examples/autoscaler-webhook:0.14) - [us-docker.pkg.dev/agones-images/examples/cpp-simple-server:0.18](https://us-docker.pkg.dev/agones-images/examples/cpp-simple-server:0.18) - [us-docker.pkg.dev/agones-images/examples/crd-client:0.17](https://us-docker.pkg.dev/agones-images/examples/crd-client:0.17) - [us-docker.pkg.dev/agones-images/examples/nodejs-simple-server:0.10](https://us-docker.pkg.dev/agones-images/examples/nodejs-simple-server:0.10) - [us-docker.pkg.dev/agones-images/examples/rust-simple-server:0.13](https://us-docker.pkg.dev/agones-images/examples/rust-simple-server:0.13) - [us-docker.pkg.dev/agones-images/examples/simple-game-server:0.34](https://us-docker.pkg.dev/agones-images/examples/simple-game-server:0.34) - [us-docker.pkg.dev/agones-images/examples/supertuxkart-example:0.14](https://us-docker.pkg.dev/agones-images/examples/supertuxkart-example:0.14) - [us-docker.pkg.dev/agones-images/examples/unity-simple-server:0.3](https://us-docker.pkg.dev/agones-images/examples/unity-simple-server:0.3) - [us-docker.pkg.dev/agones-images/examples/xonotic-example:2.0](https://us-docker.pkg.dev/agones-images/examples/xonotic-example:2.0) Helm chart available with this release: - <a href="https://agones.dev/chart/stable/agones-1.43.0.tgz" data-proofer-ignore> <code>helm install agones agones/agones --version 1.43.0</code></a> > Make sure to add our stable helm repository using `helm repo add agones https://agones.dev/chart/stable` </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://redirect.github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC41Ny4xIiwidXBkYXRlZEluVmVyIjoiMzguNTcuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsicmVub3ZhdGUvaGVsbSIsInR5cGUvbWlub3IiXX0=-->
What type of PR is this?
What this PR does / Why we need it:
Following instructions proposed in #3886 I set up a local environment to contribute to agones unity client sdk.
I noticed there wasn't a test. This adds a first test. I don't think it's a good test so please offer up what might make for a better first test.
Which issue(s) this PR fixes:
Closes #
Special notes for your reviewer: