Skip to content

Commit

Permalink
Don't run SharedFxTests.BaselineTest(...) in some cases
Browse files Browse the repository at this point in the history
- when `!$(ValidateBaseline)`, previous runtimes do not exist
  • Loading branch information
dougbu committed Mar 11, 2021
1 parent bb003c4 commit 64b7204
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
4 changes: 4 additions & 0 deletions test/SharedFx.UnitTests/SharedFx.UnitTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
<_Parameter1>PreviousAspNetCoreReleaseVersion</_Parameter1>
<_Parameter2>$(PreviousAspNetCoreReleaseVersion)</_Parameter2>
</AssemblyAttribute>
<AssemblyAttribute Include="Microsoft.AspNetCore.TestData">
<_Parameter1>ValidateBaseline</_Parameter1>
<_Parameter2>$(ValidateBaseline)</_Parameter2>
</AssemblyAttribute>
</ItemGroup>

<ItemGroup>
Expand Down
7 changes: 6 additions & 1 deletion test/SharedFx.UnitTests/SharedFxTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,16 @@ namespace Microsoft.AspNetCore
{
public class SharedFxTests
{

[Theory]
[MemberData(nameof(GetSharedFxConfig))]
public async Task BaselineTest(SharedFxConfig config)
{
if (!TestData.GetValidateBaseline())
{
// Inability to validate the package baselines indicates dotnetcli is not up-to-date.
return;
}

var previousVersion = TestData.GetPreviousAspNetCoreReleaseVersion();
var url = new Uri($"https://dotnetcli.blob.core.windows.net/dotnet/aspnetcore/Runtime/" + previousVersion + "/aspnetcore-runtime-internal-" + previousVersion + "-win-x64.zip");
var zipName = "assemblies.zip";
Expand Down
4 changes: 4 additions & 0 deletions test/SharedFx.UnitTests/TestData.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using System.Linq;
using System.Reflection;

Expand All @@ -20,6 +21,9 @@ public class TestData

public static string GetSharedFxRuntimeIdentifier() => GetTestDataValue("SharedFxRuntimeIdentifier");

public static bool GetValidateBaseline() =>
string.Equals(GetTestDataValue("ValidateBaseline"), "true", StringComparison.OrdinalIgnoreCase);

private static string GetTestDataValue(string key)
=> typeof(TestData).Assembly.GetCustomAttributes<TestDataAttribute>().Single(d => d.Key == key).Value;
}
Expand Down

0 comments on commit 64b7204

Please sign in to comment.