-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Add a system for testing correlation E2E #2071
Add a system for testing correlation E2E #2071
Conversation
@check-spelling-bot ReportUnrecognized words, please review:
Previously acknowledged words that are now absentactivatable amd Archs dsc Globals hackathon mytool Packagedx parametermap UWP whatifTo accept these unrecognized words as correct (and remove the previously acknowledged and now absent words), run the following commands... in a clone of the [email protected]:JohnMcPMS/winget-cli.git repository
|
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 you add a README or something like that for how to use the scripts?
Remove-Item -Recurse $ResultsPath -Force | ||
} | ||
|
||
New-Item -ItemType Directory $ResultsPath > $nul |
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.
Nit 1: Did you mean $null
?
Nit 2: You are using both > $nul
and | Out-Null
. Should it be consistent?
$devVCLibsPathInSandbox = Join-Path -Path $desktopInSandbox -ChildPath (Join-Path -Path $tempFolderName -ChildPath $devVCLibsFileName) | ||
} | ||
else | ||
{ |
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.
Is something missing here?
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.
No, I just didn't indent the entire existing block at the time.
--> Starting Windows Sandbox, and: | ||
- Mounting the following directories: | ||
- $tempFolder as read-only | ||
- $outPath as read-write |
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.
Nit: Missing Dev Package and Reg File folders
@@ -270,6 +270,8 @@ namespace Microsoft.Management.Deployment | |||
{ | |||
/// Checks if this package version has at least one applicable installer. | |||
Boolean HasApplicableInstaller { get; }; | |||
|
|||
String Publisher { get; }; |
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.
Do we need to do any review for these API changes?
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.
Not for these simple ones, no.
@@ -134,6 +134,7 @@ namespace AppInstaller::Repository | |||
RelativePath, | |||
// Returned in hexadecimal format | |||
ManifestSHA256Hash, | |||
Publisher, |
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.
Looks like something I'll need to use in my change for matching heuristics. 🤔
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.
Yes, although it just makes getting the value easier since you don't have to get all of the metadata, so it isn't really critical to move to it.
src/AppInstallerRepositoryCore/Public/winget/RepositorySearch.h
Outdated
Show resolved
Hide resolved
Why did all my comments show up twice... |
|
||
$outputFileBlockerPath = Join-Path $outPath "done.txt" | ||
|
||
while (-not (Test-Path $outputFileBlockerPath)) |
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 would add a timeout here. When I tried doing something similar, I saw many cases where the app would still require interaction and it would block the script until I went to click something.
I think that shouldn't happen, but it seems the msstore source doesn't always gives us the right arguments for the installers :(
<ReadOnly>true</ReadOnly> | ||
</MappedFolder> | ||
<MappedFolder> | ||
<HostFolder>$ExePath</HostFolder> |
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 like these need to be expanded to absolute paths for it to work.
|
||
$arpCompared | Select-Object -Property * -ExcludeProperty SideIndicator | Format-Table | Out-File (Join-Path $OutputPath "ARPCompare.txt") | ||
|
||
"Done" | Out-File (Join-Path $OutputPath "done.txt") |
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 won't happen if there is any error during the script, so the main one will just hang waiting for this. I don't know if that is good or bad
Remove-Variable sandbox | ||
} | ||
|
||
Close-WindowsSandbox |
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 you do this before line 85 where you remove the results folder?
If the script fails and the sandbox stays open, it will hold on to the results files and block removing the folder so we have to manually close the sandbox before running again.
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.
@@ -16,7 +16,6 @@ | |||
<Dependencies> | |||
<!-- Minimum supported version is 1809 (October 2018 Update, aka RS5) --> | |||
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.17763.0" MaxVersionTested="10.0.19033.0" /> | |||
<PackageDependency Name="Microsoft.VCLibs.140.00.UWPDesktop" MinVersion="14.0.25426.0" Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US" /> |
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.
Yes, it is being injected by VS anyway. This one was leading to debug needing the release package (as VS left this and injected the debug on as well).
@@ -48,7 +48,8 @@ namespace AppInstaller::Repository::Microsoft | |||
return LocIndString{ GetReferenceSource()->GetDetails().Name }; | |||
default: | |||
// Values coming from the index will always be localized/independent. | |||
return LocIndString{ GetReferenceSource()->GetIndex().GetPropertyByManifestId(m_manifestId, property).value() }; | |||
std::optional<std::string> optValue = GetReferenceSource()->GetIndex().GetPropertyByManifestId(m_manifestId, property); | |||
return LocIndString{ optValue ? optValue.value() :std::string{} }; |
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.
This change adds a few scripts, a test project, and one small product change, all around enabling end-to-end validation of our correlation between system artifacts and packages in external sources.
Change
The product change is to expose publisher on the
PackageVersion
COM object. This enables the test system to collect that data for further use, as well as allowing human verification of the correlation (if one is made).The test project uses the COM API to first install a package, then attempts to check for correlation in two ways (directions):
The primary script,
Test-CorrelationInSandbox.ps1
, is based off of the sandbox test script in winget-pkgs (thanks to many people). It sets up the sandbox and initial script to run there for each package to test, then waits for a sentinel file to be created in the output location. The results of all of running the test project exe, as well as the ARP differences and winget logs are put in that output location, then the sandbox is destroyed for the next package to run.Once testing is done,
Process-CorrelationResults.ps1
will take all of the results JSON files and put them intoresults.csv
in the directory. If any tests failed to run, they will be infailed.csv
. There are correlation columns in the CSV that can be averaged in Excel to get the correlation percentage.Microsoft Reviewers: Open in CodeFlow