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

Unity Testsuite #176

Closed
wants to merge 14 commits into from

Conversation

jdetter
Copy link
Collaborator

@jdetter jdetter commented Oct 17, 2024

Description of Changes

Describe what has been changed, any new features or bug fixes

  • This PR introduces a testsuite which runs in Unity. I have started with the SpacetimeDBCircleGame but I think we should add more small example games in the future. Right now it just spawns in a circle, eats some food and verifies the decay logic is working correctly. I've also written some reconnection tests but they don't work because reconnections are currently broken. There are also one-off tests but those don't work either because they also require reconnections to be working.

Update: reconnections have been fixed via #168 . In that PR I have enabled all tests!

I've used the built-in unity testsuite framework to achieve this, along with the UnityCI tool from GameCI. The documentation for this docker container can be found here: https://game.ci/docs/github/getting-started/

Rendered README for our testsuite which includes local testing instructions: https://github.com/clockworklabs/com.clockworklabs.spacetimedbsdk/blob/jdetter/unity-testsuite/unity-tests~/README.md

API

  • This is an API breaking change to the SDK

If the API is breaking, please state below what will break

Not breaking

Requires SpacetimeDB PRs

List any PRs here that are required for this SDK change to work

None

Testsuite

SpacetimeDB branch name: 0935b7346b825b8cbb9f36d9ed256136b73b5f0b

Testing

Write instructions for a test that you performed for this PR

  • Describe a test for this PR that you have completed

@jdetter jdetter changed the base branch from master to staging October 17, 2024 06:09
@jdetter jdetter force-pushed the jdetter/unity-testsuite branch from a41ecde to ef84d6b Compare October 17, 2024 07:37
@bfops bfops self-assigned this Oct 21, 2024
@jdetter jdetter force-pushed the jdetter/unity-testsuite branch from 5d47384 to 25a8c1b Compare October 22, 2024 09:53
@jdetter jdetter changed the base branch from staging to jdetter/unity-testsuite-import October 22, 2024 09:53
@jdetter jdetter marked this pull request as ready for review October 22, 2024 11:59
@jdetter jdetter requested review from RReverser, lcodes and bfops October 22, 2024 12:54
@jdetter jdetter force-pushed the jdetter/unity-testsuite branch from 746d728 to 547187e Compare October 22, 2024 13:07
@jdetter
Copy link
Collaborator Author

jdetter commented Oct 24, 2024

Ingvar suggested we add a check which verifies that the client bindings on the branch being tested are up-to-date, I agree with this and I've added the check.

@cloutiertyler
Copy link
Collaborator

cloutiertyler commented Oct 29, 2024

@jdetter I am going to approve this, however, I am also going to schedule a meeting with @RReverser @SteveBoytsun @lcodes @Centril with the purpose of having you explain in person how it works, so that we can hand it off to others with them being able to understand the tricky problems of setting this up.

@cloutiertyler cloutiertyler changed the base branch from jdetter/unity-testsuite-import to staging October 29, 2024 17:55
@cloutiertyler
Copy link
Collaborator

Should merge after this: #177

@Centril Centril changed the base branch from staging to jdetter/unity-testsuite-import October 30, 2024 12:03
John Detter added 3 commits October 30, 2024 13:04
the future

Add testing section to PR description (#164)

v  Below is a render of what the new PR description looks like

*Describe what has been changed, any new features or bug fixes*

 - [ ] This is an API breaking change to the SDK

*If the API is breaking, please state below what will break*

*List any PRs here that are required for this SDK change to work*

*Write instructions for a test that you performed for this PR*

- [ ] Describe a test for this PR that you have completed

Working on a more ergonomic CI workflow

Workflow runs on staging

Small bug fix

Test again

speedup

Use public bindings

Use serial instead of license

Updated default branch to be master

Disable all but one test because we don't support reconnections right
now

Small update

Fixes

Testsuite uses local reference to SDK

Added comma

debugging

One more debug

Small changes

small sed fix

Small fix - newline character was messing up branch name

Added debug

Updated how branch name is populated

We'll give this a try to make the C# SDK happy

C# tests building!

Updated README

Small fix

Move unity-tests to unity-tests~

Use relative path reference

Use relative path reference

Small update to the workflow

Updated README for new functionality
@Centril Centril force-pushed the jdetter/unity-testsuite branch from a39e0a3 to 87fa4fc Compare October 30, 2024 12:05
@Centril
Copy link
Contributor

Centril commented Oct 30, 2024

Rebased this atop of a rebased jdetter/unity-testsuite-import which was rebased atop of staging (#177 (comment)) and changed back the merge-into target branch to clarify the diff for review purposes.

Also changed the test-against stdb commit to 0935b7346b825b8cbb9f36d9ed256136b73b5f0b, currently the HEAD of master.

## Testsuite
*If you would like to run against a specific SpacetimeDB branch in the testsuite, specify that here. This can be a branch name or a link to a PR.*

SpacetimeDB branch name: master
Copy link
Collaborator Author

@jdetter jdetter Oct 30, 2024

Choose a reason for hiding this comment

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

let's call this a ref instead

Library-SpacetimeDBUnityTestsuite-
Library-

- name: Set up Unity
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@Centril Centril force-pushed the jdetter/unity-testsuite branch from b4e05e8 to fc1b649 Compare October 30, 2024 15:52
@lcodes lcodes force-pushed the jdetter/unity-testsuite-import branch from e174841 to 3048408 Compare October 30, 2024 21:42
@jdetter jdetter mentioned this pull request Oct 30, 2024
3 tasks
Centril pushed a commit that referenced this pull request Oct 31, 2024
**Please do not rebase this PR**

## Description of Changes
*Describe what has been changed, any new features or bug fixes*

This is very similar to
#176
except it imports the circle game as a submodule instead of copying the
code over into this repo. This is the SpacetimeDBCircleGame PR that
we're dependent on right now:
clockworklabs/SpacetimeDBCircleGame#3

- This PR introduces a testsuite which runs in Unity. Right now it just
spawns in a circle, eats some food and verifies the decay logic is
working correctly. I've also written some reconnection tests but they
don't work because reconnections are currently broken. There are also
one-off tests but those don't work either because they also require
reconnections to be working.

Update: reconnections have been fixed via
#168.

I've used the built-in unity testsuite framework to achieve this, along
with the UnityCI tool from GameCI. The documentation for this docker
container can be found here:
https://game.ci/docs/github/getting-started/

## API

 - [ ] This is an API breaking change to the SDK

*If the API is breaking, please state below what will break*

Not breaking

## Requires SpacetimeDB PRs
*List any PRs here that are required for this SDK change to work*

None

## Testsuite

SpacetimeDB branch name: 0935b7346b825b8cbb9f36d9ed256136b73b5f0b

## Testing
*Write instructions for a test that you performed for this PR*

- [x] The testsuite is passing:
https://github.com/clockworklabs/com.clockworklabs.spacetimedbsdk/actions/runs/11604456943/job/32313229775

You can follow test instructions here to double check my work:
clockworklabs/SpacetimeDBCircleGame#3

## Follow-up Actions

- [ ] Rebase the reconnection logic PR onto this PR and re-enable the
reconnection tests

---------

Co-authored-by: John Detter <[email protected]>
@jdetter
Copy link
Collaborator Author

jdetter commented Oct 31, 2024

closed in favor of #186

@jdetter jdetter closed this Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants