-
Notifications
You must be signed in to change notification settings - Fork 490
Sync Dev and Master #2116
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
Sync Dev and Master #2116
Changes from all commits
Commits
Show all changes
2 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
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
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 | ||||
---|---|---|---|---|---|---|
|
@@ -18,11 +18,78 @@ public PackagingTests(ITestOutputHelper output) | |||||
_workingDirectory = DirectoryHelpers.GetTempTestAppDirectory(solutionRoot); | ||||||
} | ||||||
|
||||||
[Fact] | ||||||
public void VerifyPackageContentsHasStaticAssets() | ||||||
{ | ||||||
var projectPath = Path.Combine(_workingDirectory, "Tools", "LambdaTestTool-v2", "src", "Amazon.Lambda.TestTool", "Amazon.Lambda.TestTool.csproj"); | ||||||
_output.WriteLine("Packing TestTool..."); | ||||||
var packProcess = new Process | ||||||
{ | ||||||
StartInfo = new ProcessStartInfo | ||||||
{ | ||||||
FileName = "dotnet", | ||||||
Arguments = $"pack -c Release --no-build --no-restore {projectPath}", | ||||||
RedirectStandardOutput = true, | ||||||
RedirectStandardError = true, | ||||||
UseShellExecute = false, | ||||||
CreateNoWindow = true, | ||||||
} | ||||||
}; | ||||||
|
||||||
packProcess.Start(); | ||||||
string packOutput = packProcess.StandardOutput.ReadToEnd(); | ||||||
string packError = packProcess.StandardError.ReadToEnd(); | ||||||
packProcess.WaitForExit(int.MaxValue); | ||||||
|
||||||
_output.WriteLine("Pack Output:"); | ||||||
_output.WriteLine(packOutput); | ||||||
if (!string.IsNullOrEmpty(packError)) | ||||||
{ | ||||||
_output.WriteLine("Pack Errors:"); | ||||||
_output.WriteLine(packError); | ||||||
} | ||||||
|
||||||
Assert.Equal(0, packProcess.ExitCode); | ||||||
|
||||||
var packageDir = Path.Combine(Path.GetDirectoryName(projectPath)!, "bin", "Release"); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [nitpick] The hardcoded 'Release' configuration string should be consistent with the configuration used in the pack command. Consider extracting this as a constant or variable.
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||
_output.WriteLine($"Looking for package in: {packageDir}"); | ||||||
|
||||||
var packageFiles = Directory.GetFiles(packageDir, "*.nupkg", SearchOption.AllDirectories); | ||||||
Assert.True(packageFiles.Length > 0, $"No .nupkg files found in {packageDir}"); | ||||||
|
||||||
var packagePath = packageFiles[0]; | ||||||
_output.WriteLine($"Found package: {packagePath}"); | ||||||
|
||||||
using var archive = ZipFile.OpenRead(packagePath); | ||||||
|
||||||
// Get all files for this framework | ||||||
var frameworkFiles = archive.Entries | ||||||
.Where(e => e.FullName.StartsWith($"tools/net8.0/any/wwwroot")) | ||||||
.Select(e => e.FullName) | ||||||
.ToList(); | ||||||
|
||||||
// Verify essential files exist | ||||||
var essentialFiles = new[] | ||||||
{ | ||||||
$"tools/net8.0/any/wwwroot/bootstrap-icons/", | ||||||
$"tools/net8.0/any/wwwroot/bootstrap/", | ||||||
$"tools/net8.0/any/wwwroot/_content/BlazorMonaco/" | ||||||
}; | ||||||
|
||||||
var missingFiles = essentialFiles.Where(f => !frameworkFiles.Any(x => x.StartsWith(f))).ToList(); | ||||||
|
||||||
if (missingFiles.Any()) | ||||||
{ | ||||||
Assert.Fail($"The following static assets are missing:\n" + | ||||||
string.Join("\n", missingFiles)); | ||||||
} | ||||||
} | ||||||
|
||||||
[Fact] | ||||||
public void VerifyPackageContentsHasRuntimeSupport() | ||||||
{ | ||||||
var projectPath = Path.Combine(_workingDirectory, "Tools", "LambdaTestTool-v2", "src", "Amazon.Lambda.TestTool", "Amazon.Lambda.TestTool.csproj"); | ||||||
var expectedFrameworks = new string[] { "net6.0", "net8.0", "net9.0" }; | ||||||
var expectedFrameworks = new string[] { "net6.0", "net8.0", "net9.0", "net10.0" }; | ||||||
_output.WriteLine("Packing TestTool..."); | ||||||
var packProcess = new Process | ||||||
{ | ||||||
|
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.
Using int.MaxValue as timeout could cause the test to hang indefinitely if the pack process fails. Consider using a reasonable timeout value like 30000ms (30 seconds).
Copilot uses AI. Check for mistakes.