-
Notifications
You must be signed in to change notification settings - Fork 459
test: remote config support for multiprocesstestscene #1931
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
Merged
NoelStephensUnity
merged 20 commits into
develop
from
test/remote_config_support_for_multiprocesstestscene
May 25, 2022
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
1e5c487
integrate multi-machine testing code
zain-mecklai d3f2a1a
Reconfigure how host/client ip/port is set
zain-mecklai 017e2ec
PR feedback
zain-mecklai 4e649b0
Undetected compilation error
zain-mecklai 0d8ff21
update to use async await
zain-mecklai 698420c
use async await
zain-mecklai 4370869
Use async/await and avoid call to Wait()
zain-mecklai 9b7bda6
Clean up whitespace as well as remove calls to Wait()
zain-mecklai 5eb6c6f
only whitespace
zain-mecklai c2db7bf
attempt to move setting up StartClient to support async config
zain-mecklai 6c28094
Continued experiments
zain-mecklai 5b74d53
Start client after the configuration has been set
zain-mecklai 3f56741
Use notifications and callbacks instead of waits to enable TestCoordi…
zain-mecklai dfd9055
Make startclient call explicit
zain-mecklai 16f3199
Test Coordinator cleanup for INotifyPropertyChanged
zain-mecklai 9fd9aa5
Fix whitespace
zain-mecklai 39e091c
Fix whitespace, simplify
zain-mecklai 69a0c4c
Merge branch 'develop' into test/remote_config_support_for_multiproce…
zain-mecklai c644ef2
Merge branch 'develop' into test/remote_config_support_for_multiproce…
zain-mecklai 239f39c
Merge branch 'develop' into test/remote_config_support_for_multiproce…
NoelStephensUnity 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
69 changes: 69 additions & 0 deletions
69
testproject/Assets/Tests/Runtime/MultiprocessRuntime/Helpers/ConfigurationTools.cs
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,69 @@ | ||
| using UnityEngine; | ||
| using System; | ||
| using System.Net.Http; | ||
| using System.Threading; | ||
| using System.Collections.Generic; | ||
| using System.Text; | ||
| using System.Threading.Tasks; | ||
|
|
||
| namespace Unity.Netcode.MultiprocessRuntimeTests | ||
| { | ||
| public class ConfigurationTools | ||
| { | ||
| public static async Task<JobQueueItemArray> GetRemoteConfig() | ||
| { | ||
| var theList = new JobQueueItemArray(); | ||
| using var client = new HttpClient(); | ||
| var cancelAfterDelay = new CancellationTokenSource(TimeSpan.FromSeconds(10)); | ||
| var response = await client.GetAsync("https://multiprocess-log-event-manager.cds.internal.unity3d.com/api/JobWithFile", | ||
| HttpCompletionOption.ResponseHeadersRead, cancelAfterDelay.Token).ConfigureAwait(false); | ||
| var content = await response.Content.ReadAsStringAsync(); | ||
| JsonUtility.FromJsonOverwrite(content, theList); | ||
| return theList; | ||
| } | ||
|
|
||
| public static async void CompleteJobQueueItem(JobQueueItem item) | ||
| { | ||
| await PostJobQueueItem(item, "/complete"); | ||
| } | ||
|
|
||
| public static async void ClaimJobQueueItem(JobQueueItem item) | ||
| { | ||
| await PostJobQueueItem(item, "/claim"); | ||
| } | ||
|
|
||
| public static async Task PostJobQueueItem(JobQueueItem item, string path = "") | ||
| { | ||
| using var client = new HttpClient(); | ||
| using var request = new HttpRequestMessage(HttpMethod.Post, "https://multiprocess-log-event-manager.cds.internal.unity3d.com/api/JobWithFile" + path); | ||
| var json = JsonUtility.ToJson(item); | ||
| using var stringContent = new StringContent(json, Encoding.UTF8, "application/json"); | ||
| request.Content = stringContent; | ||
| MultiprocessLogger.Log($"Posting remoteConfig to server {json}"); | ||
| var cancelAfterDelay = new CancellationTokenSource(TimeSpan.FromSeconds(20)); | ||
| var response = await client | ||
| .SendAsync(request, HttpCompletionOption.ResponseHeadersRead, cancelAfterDelay.Token).ConfigureAwait(false); | ||
| MultiprocessLogger.Log($"remoteConfig posted, checking response {response.StatusCode}"); | ||
| } | ||
| } | ||
|
|
||
| [Serializable] | ||
| public class JobQueueItemArray | ||
| { | ||
| public List<JobQueueItem> JobQueueItems; | ||
| } | ||
|
|
||
| [Serializable] | ||
| public class JobQueueItem | ||
| { | ||
| public int Id; | ||
| public long JobId; | ||
| public string GitHash; | ||
| public string HostIp; | ||
| public int PlatformId; | ||
| public int JobStateId; | ||
| public string CreatedBy; | ||
| public string UpdatedBy; | ||
| public string TransportName; | ||
| } | ||
| } |
11 changes: 11 additions & 0 deletions
11
testproject/Assets/Tests/Runtime/MultiprocessRuntime/Helpers/ConfigurationTools.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
9 changes: 9 additions & 0 deletions
9
testproject/Assets/Tests/Runtime/MultiprocessRuntime/Helpers/ConfigurationType.cs
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,9 @@ | ||
|
|
||
| public enum ConfigurationType | ||
| { | ||
| Unknown, | ||
| Remote, | ||
| CommandLine, | ||
| ResourceFile, | ||
| Host | ||
| } |
11 changes: 11 additions & 0 deletions
11
testproject/Assets/Tests/Runtime/MultiprocessRuntime/Helpers/ConfigurationType.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
😻
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.
Job ID will be helpful indeed! (just catching up to this PR)