-
Notifications
You must be signed in to change notification settings - Fork 62
Add latency to lobby listings
#285
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
Open
erikdubbelboer
wants to merge
3
commits into
main
Choose a base branch
from
latency
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,174 @@ | ||
| Feature: Latency | ||
|
|
||
| Background: | ||
| Given the "signaling" backend is running | ||
| And the "testproxy" backend is running | ||
|
|
||
|
|
||
| Scenario: Lobby listings include the latency to the peer | ||
| Given the next peer's latency vector is set to: | ||
| """ | ||
| 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10 | ||
| """ | ||
| And "green" is connected as "1u8fw4aph5ypt" and ready for game "b6f7fc97-8545-4ffd-b714-7cf339048556" | ||
| And "green" creates a lobby with these settings: | ||
| """json | ||
| { | ||
| "public": true | ||
| } | ||
| """ | ||
| And "green" receives the network event "lobby" with the argument "h5yzwyizlwao" | ||
| And the next peer's latency vector is set to: | ||
| """ | ||
| 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 | ||
| """ | ||
| And "blue" is connected as "19yrzmetd2bn7" and ready for game "b6f7fc97-8545-4ffd-b714-7cf339048556" | ||
|
|
||
| When "blue" requests lobbies with: | ||
| """json | ||
| {} | ||
| """ | ||
|
|
||
| Then "blue" should have received only these lobbies: | ||
| | code | latency | | ||
| | h5yzwyizlwao | 24 | | ||
|
|
||
|
|
||
| Scenario: Lobby with multiple peers | ||
| Given the next peer's latency vector is set to: | ||
| """ | ||
| 99, 99, 99, 99, 10, 10, 10, 10, 10, 10, 10 | ||
| """ | ||
| And "blue" is connected as "1u8fw4aph5ypt" and ready for game "4307bd86-e1df-41b8-b9df-e22afcf084bd" | ||
| And the next peer's latency vector is set to: | ||
| """ | ||
| 10, 10, 10, 99, 99, 99, 99, 10, 10, 10, 10 | ||
| """ | ||
| And "yellow" is connected as "h5yzwyizlwao" and ready for game "4307bd86-e1df-41b8-b9df-e22afcf084bd" | ||
| And "blue,yellow" are joined in a public lobby | ||
| And the next peer's latency vector is set to: | ||
| """ | ||
| 10, 10, 10, 10, 10, 10, 99, 99, 99, 99, 10 | ||
| """ | ||
| And "green" is connected as "3t3cfgcqup9e" and ready for game "4307bd86-e1df-41b8-b9df-e22afcf084bd" | ||
|
|
||
| When "green" requests lobbies with: | ||
| """json | ||
| {} | ||
| """ | ||
|
|
||
| Then "green" should have received only these lobbies: | ||
| | code | latency | | ||
| | 19yrzmetd2bn7 | 89 | | ||
|
|
||
|
|
||
| Scenario: Sort lobbies by latency | ||
| Given the next peer's latency vector is set to: | ||
| """ | ||
| 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30 | ||
| """ | ||
| And "blue" is connected as "1u8fw4aph5ypt" and ready for game "4307bd86-e1df-41b8-b9df-e22afcf084bd" | ||
| And "blue" creates a lobby with these settings: | ||
| """json | ||
| { | ||
| "public": true, | ||
| "customData": { | ||
| "map": "de_nuke" | ||
| } | ||
| } | ||
| """ | ||
| And the next peer's latency vector is set to: | ||
| """ | ||
| 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 | ||
| """ | ||
| And "yellow" is connected as "19yrzmetd2bn7" and ready for game "4307bd86-e1df-41b8-b9df-e22afcf084bd" | ||
| And "yellow" creates a lobby with these settings: | ||
| """json | ||
| { | ||
| "public": true, | ||
| "customData": { | ||
| "map": "de_dust" | ||
| } | ||
| } | ||
| """ | ||
| And the next peer's latency vector is set to: | ||
| """ | ||
| 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10 | ||
| """ | ||
| And "green" is connected as "prb67ouj837u" and ready for game "4307bd86-e1df-41b8-b9df-e22afcf084bd" | ||
|
|
||
| When "green" requests lobbies with: | ||
| | filter | {} | | ||
| | sort | { "latency": 1 } | | ||
| | limit | 1 | | ||
|
|
||
| Then "green" should have received only these lobbies: | ||
| | code | latency | customData | | ||
| | h5yzwyizlwao | 34 | {"map":"de_nuke"} | | ||
|
|
||
|
|
||
| Scenario: Latency to your own lobby | ||
| Given the next peer's latency vector is set to: | ||
| """ | ||
| 325, 523, 64, 21, 76, 23, 54, 235, 76, 23, 142 | ||
| """ | ||
| And "green" is connected as "1u8fw4aph5ypt" and ready for game "b6f7fc97-8545-4ffd-b714-7cf339048556" | ||
| And "green" creates a lobby with these settings: | ||
| """json | ||
| { | ||
| "public": true | ||
| } | ||
| """ | ||
| And "green" receives the network event "lobby" with the argument "h5yzwyizlwao" | ||
|
|
||
| When "green" requests lobbies with: | ||
| """json | ||
| {} | ||
| """ | ||
|
|
||
| Then "green" should have received only these lobbies: | ||
| | code | latency | | ||
| | h5yzwyizlwao | 0 | | ||
|
|
||
|
|
||
| Scenario: Peers without latency vectors are not included in the estimate | ||
| Given "green" is connected as "1u8fw4aph5ypt" and ready for game "f666036d-d9e1-4d70-b0c3-4a68b24a9884" | ||
| And these lobbies exist: | ||
| | code | game | peers | public | | ||
| | 1u8fw4aph5ypt | f666036d-d9e1-4d70-b0c3-4a68b24a9884 | {"peer1"} | true | | ||
| | 0qva9vyurwbbl | f666036d-d9e1-4d70-b0c3-4a68b24a9884 | {"peer2", "peer3"} | true | | ||
| And these peers exist: | ||
| | peer | game | latency_vector | | ||
| | peer1 | f666036d-d9e1-4d70-b0c3-4a68b24a9884 | null | | ||
| | peer2 | f666036d-d9e1-4d70-b0c3-4a68b24a9884 | null | | ||
| | peer3 | f666036d-d9e1-4d70-b0c3-4a68b24a9884 | {10,10,10,10,10,10,10,10,10,10,10} | | ||
|
|
||
| When "green" requests lobbies with: | ||
| | filter | {} | | ||
| | sort | { "latency": 1 } | | ||
| Then "green" should have received only these lobbies: | ||
| | code | latency | | ||
| | 0qva9vyurwbbl | 10 | | ||
| | 1u8fw4aph5ypt | undefined | | ||
|
|
||
|
|
||
| Scenario: Client without latency vectors gives null latency estimates | ||
| Given the next peer's latency vector is set to: | ||
| """ | ||
| null | ||
| """ | ||
| Given "green" is connected as "1u8fw4aph5ypt" and ready for game "f666036d-d9e1-4d70-b0c3-4a68b24a9884" | ||
| And these lobbies exist: | ||
| | code | game | peers | public | | ||
| | 0qva9vyurwbbl | f666036d-d9e1-4d70-b0c3-4a68b24a9884 | {"peer1", "peer2"} | true | | ||
| And these peers exist: | ||
| | peer | game | latency_vector | | ||
| | peer1 | f666036d-d9e1-4d70-b0c3-4a68b24a9884 | {10,10,10,10,10,10,10,10,10,10,10} | | ||
|
|
||
| When "green" requests lobbies with: | ||
| """json | ||
| {} | ||
| """ | ||
| Then "green" should have received only these lobbies: | ||
| | code | latency | | ||
| | 0qva9vyurwbbl | undefined | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
nitpick: typo publc -> public