-
Notifications
You must be signed in to change notification settings - Fork 376
Support custom commands in Android XHarness SDK #7582
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
Conversation
|
@fanyang-mono this PR introduces the proper way how we will need to create XHarness Helix jobs in Android/Apple (Apple is ready for some time). The reason for that is that it will enable us to react to infrastructural issues, do retries and log build telemetry correctly. I can assist with introducing this for the runtime tests. The README describes how it's intended to be used: |
|
@imhameed @fanyang-mono @SamMonoRT this PR also adds a new capability - we can now re-use 1 application for multiple work items and have each work item for example call the app with different commands (but in parallel on multiple machines) so just an FYI in case this would help you in some scenarios where for example some tests take a long time and you want to split them. |
|
Nice improvement! However, I am not sure how the current runtime tests infrastructure would be able to leverage this. For runtime tests, the xunit tests themselves are running on host. The tests then calls to bash or powershell scripts. Inside the bash or powershell script, the xharness test command gets invoked. If I understand this feature correctly, the runtime test infrastructure would need to be rewrite like how the library tests are, in order to adopt this feature. |
|
@fanyang-mono it's sort of also not a choice to use it. We will require it so that the Helix mobile device infrastructure is actually maintainable for us. We already spoke about this with Imran and Sam. And all these are inside of the XHarness SDK wrapper which changes quite often as we find new way to improve stability. Also please consider that we have to maintain a good state of all devices so that a bad runtime test won't affect other customers of mobile devices. However, it can be as simple as not creating the |
|
@premun Yes, I understand that we need to make it better and easier to monitor and maintain the devices. If the change is simple as you said, we could give it a try to see what happens. When are you targeting for us to adopt this feature? |
src/Microsoft.DotNet.Helix/Sdk/tools/xharness-runner/xharness-helix-job.android.ps1
Outdated
Show resolved
Hide resolved
src/Microsoft.DotNet.Helix/Sdk/tools/xharness-runner/xharness-helix-job.android.ps1
Outdated
Show resolved
Hide resolved
src/Microsoft.DotNet.Helix/Sdk/tools/xharness-runner/xharness-helix-job.android.ps1
Outdated
Show resolved
Hide resolved
src/Microsoft.DotNet.Helix/Sdk/tools/xharness-runner/xharness-helix-job.android.ps1
Outdated
Show resolved
Hide resolved
|
@MattGal could you have a look at this PR please? Thanks! |
Do you plan to update the existing runtime and runtime staging lanes for devices too ? |
MattGal
left a comment
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.
Seems reasonable, I'd like to chat about the work item payload construction (mostly the recreation of zips over and over) before this merges.
| <AndroidInstrumentationName>net.dot.MonoRunner</AndroidInstrumentationName> | ||
| </XHarnessApkToTest> | ||
|
|
||
| <XHarnessApkToTest Include="System.Text.Json-with-custom-commands"> |
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.
Now that I've read this far, I think it's likely this will delete and re-zip the same APK payload over and over.
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.
It will create new archive for each work item and each archive will contain the APK plus the custom payload scripts created for the work item.
For example in this example, the command.sh file will differ in the archives.
I don't think this is such a big problem, considering we're doing this in parallel. It would be a bit more difficult to synchronize this between processes and create one base archive and then clone it and inject the command.sh so I am not sure it is worth the effort?
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.
I still think it is worth the effort to upload once and reuse work item payloads with this feature. The biggest costs we're seeing lately are from storage (@ulisesh was just showing me this) and the XHarness on-prem testing seems correlated to the biggest increases in spending.
Since you're using these as work item payloads, the bandwidth costs should be roughly the same making N payloads for 1 app, but the storage will rise because users are fully within their rights to use 1 APK for 400 tests now. Additionally, the time sink of uploading the same thing potentially hundreds of times will also be noticeable when prepping the payloads in these scenarios. I'm not blocking the PR, just noting this for future consideration.
src/Microsoft.DotNet.Helix/Sdk/tools/xharness-runner/xharness-helix-job.android.ps1
Show resolved
Hide resolved
I am not sure what you mean? |
Is there any followup work needed for individual device CI lanes or will this change in SDK just flow down without required changes in yaml scripts ? |
We need to check this in, let Maestro bump Arcade in runtime and then this is the state we're in I believe:
|
Thanks for detailing the changes required. For iOS we are targetting getting this in by next Tuesday (Preview 7 cutoff). Will this land prior to that so iOS can leverage this goodness of smaller workitems. |
|
@SamMonoRT I only need this reviewed but seems like @MattGal is off. If you need this in, I could check it in and work through his potential feedback in retrospective |
Let's wait for the right approvals. Hopefully we have it in early next week. |
src/Microsoft.DotNet.Helix/Sdk/tools/xharness-runner/xharness-helix-job.android.sh
Show resolved
Hide resolved
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
...DotNet.Helix/Sdk.Tests/Microsoft.DotNet.Helix.Sdk.Tests/CreateXHarnessAppleWorkItemsTests.cs
Show resolved
Hide resolved
MattGal
left a comment
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.
Changes look good to me. I have some misgivings about making distinct work item payloads for the same app package but it's really hard to grasp the final cost until it's in use and working correctly.
src/Microsoft.DotNet.Helix/Sdk/CreateXHarnessAndroidWorkItems.cs
Outdated
Show resolved
Hide resolved
| ITaskItem appBundleItem) | ||
| { | ||
| string appFolderPath = appBundleItem.ItemSpec.TrimEnd(Path.DirectorySeparatorChar); | ||
| // The user can re-use the same .apk for 2 work items so the name of the work item will come from ItemSpec and path from metadata |
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.
Can't tell, does this make use of the payload reuse behavior (so upload once, download multiple times)?
| "--xcode \"$xcode_path\" " + | ||
| "-v " + | ||
| (includesTestRunner | ||
| ? $"--launch-timeout \"$launch_timeout\" " |
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.
Another place where an interpolated string can prevent errors in future changes.
| <AndroidInstrumentationName>net.dot.MonoRunner</AndroidInstrumentationName> | ||
| </XHarnessApkToTest> | ||
|
|
||
| <XHarnessApkToTest Include="System.Text.Json-with-custom-commands"> |
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.
I still think it is worth the effort to upload once and reuse work item payloads with this feature. The biggest costs we're seeing lately are from storage (@ulisesh was just showing me this) and the XHarness on-prem testing seems correlated to the biggest increases in spending.
Since you're using these as work item payloads, the bandwidth costs should be roughly the same making N payloads for 1 app, but the storage will rise because users are fully within their rights to use 1 APK for 400 tests now. Additionally, the time sink of uploading the same thing potentially hundreds of times will also be noticeable when prepping the payloads in these scenarios. I'm not blocking the PR, just noting this for future consideration.
<CustomCommands>in Android flows.batto.ps1Resolves dotnet/xharness#590