Skip to content

Commit db0141e

Browse files
committed
fix: stop copying test tool static assets manually
1 parent ddd2a6d commit db0141e

File tree

3 files changed

+69
-6
lines changed

3 files changed

+69
-6
lines changed

Tools/LambdaTestTool-v2/src/Amazon.Lambda.TestTool/Amazon.Lambda.TestTool.csproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@
2121
<PackageReadmeFile>README.md</PackageReadmeFile>
2222
</PropertyGroup>
2323

24-
<ItemGroup Condition="$(Configuration) == 'Release'">
25-
<None Include="$(OutputPath)\publish\wwwroot\" Pack="true" PackagePath="tools\net8.0\any\wwwroot" Visible="false" />
26-
</ItemGroup>
27-
2824
<ItemGroup>
2925
<PackageReference Include="Amazon.Lambda.SQSEvents" Version="2.2.0" />
3026
<PackageReference Include="AWSSDK.Extensions.NETCore.Setup" Version="4.0.0" />

Tools/LambdaTestTool-v2/tests/Amazon.Lambda.TestTool.UnitTests/PackagingTests.cs

Lines changed: 68 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,78 @@ public PackagingTests(ITestOutputHelper output)
1818
_workingDirectory = DirectoryHelpers.GetTempTestAppDirectory(solutionRoot);
1919
}
2020

21+
[Fact]
22+
public void VerifyPackageContentsHasStaticAssets()
23+
{
24+
var projectPath = Path.Combine(_workingDirectory, "Tools", "LambdaTestTool-v2", "src", "Amazon.Lambda.TestTool", "Amazon.Lambda.TestTool.csproj");
25+
_output.WriteLine("Packing TestTool...");
26+
var packProcess = new Process
27+
{
28+
StartInfo = new ProcessStartInfo
29+
{
30+
FileName = "dotnet",
31+
Arguments = $"pack -c Release --no-build --no-restore {projectPath}",
32+
RedirectStandardOutput = true,
33+
RedirectStandardError = true,
34+
UseShellExecute = false,
35+
CreateNoWindow = true,
36+
}
37+
};
38+
39+
packProcess.Start();
40+
string packOutput = packProcess.StandardOutput.ReadToEnd();
41+
string packError = packProcess.StandardError.ReadToEnd();
42+
packProcess.WaitForExit(int.MaxValue);
43+
44+
_output.WriteLine("Pack Output:");
45+
_output.WriteLine(packOutput);
46+
if (!string.IsNullOrEmpty(packError))
47+
{
48+
_output.WriteLine("Pack Errors:");
49+
_output.WriteLine(packError);
50+
}
51+
52+
Assert.Equal(0, packProcess.ExitCode);
53+
54+
var packageDir = Path.Combine(Path.GetDirectoryName(projectPath)!, "bin", "Release");
55+
_output.WriteLine($"Looking for package in: {packageDir}");
56+
57+
var packageFiles = Directory.GetFiles(packageDir, "*.nupkg", SearchOption.AllDirectories);
58+
Assert.True(packageFiles.Length > 0, $"No .nupkg files found in {packageDir}");
59+
60+
var packagePath = packageFiles[0];
61+
_output.WriteLine($"Found package: {packagePath}");
62+
63+
using var archive = ZipFile.OpenRead(packagePath);
64+
65+
// Get all files for this framework
66+
var frameworkFiles = archive.Entries
67+
.Where(e => e.FullName.StartsWith($"tools/net8.0/any/wwwroot"))
68+
.Select(e => e.FullName)
69+
.ToList();
70+
71+
// Verify essential files exist
72+
var essentialFiles = new[]
73+
{
74+
$"tools/net8.0/any/wwwroot/bootstrap-icons/",
75+
$"tools/net8.0/any/wwwroot/bootstrap/",
76+
$"tools/net8.0/any/wwwroot/_content/BlazorMonaco/"
77+
};
78+
79+
var missingFiles = essentialFiles.Where(f => !frameworkFiles.Any(x => x.StartsWith(f))).ToList();
80+
81+
if (missingFiles.Any())
82+
{
83+
Assert.Fail($"The following static assets are missing:\n" +
84+
string.Join("\n", missingFiles));
85+
}
86+
}
87+
2188
[Fact]
2289
public void VerifyPackageContentsHasRuntimeSupport()
2390
{
2491
var projectPath = Path.Combine(_workingDirectory, "Tools", "LambdaTestTool-v2", "src", "Amazon.Lambda.TestTool", "Amazon.Lambda.TestTool.csproj");
25-
var expectedFrameworks = new string[] { "net6.0", "net8.0", "net9.0" };
92+
var expectedFrameworks = new string[] { "net6.0", "net8.0", "net9.0", "net10.0" };
2693
_output.WriteLine("Packing TestTool...");
2794
var packProcess = new Process
2895
{

Tools/LambdaTestTool-v2/tests/Amazon.Lambda.TestTool.UnitTests/Utilities/DirectoryHelpers.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ private static void CopyDirectory(DirectoryInfo dir, string destDirName)
6363
File.SetAttributes(tempPath, FileAttributes.Normal);
6464
}
6565

66-
foreach (var subdir in dirs.Where(x => !x.Name.Equals(".git")))
66+
foreach (var subdir in dirs.Where(x => !x.Name.Equals(".git") && !x.Name.Equals(".vs")))
6767
{
6868
var tempPath = Path.Combine(destDirName, subdir.Name);
6969
var subDir = new DirectoryInfo(subdir.FullName);

0 commit comments

Comments
 (0)