Skip to content

Commit

Permalink
Add tests for workload update and install affecting rollback install …
Browse files Browse the repository at this point in the history
…state
  • Loading branch information
dsplaisted committed May 3, 2024
1 parent e8a3353 commit effb24f
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 12 deletions.
11 changes: 11 additions & 0 deletions src/Tests/dotnet-MsiInstallation.Tests/Framework/VMTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -179,5 +179,16 @@ protected WorkloadSet ParseRollbackOutput(string output)

return WorkloadSet.FromJson(filteredOutput, defaultFeatureBand: new SdkFeatureBand(SdkInstallerVersion));
}

protected string GetWorkloadVersion()
{
var result = VM.CreateRunCommand("dotnet", "workload", "--version")
.WithIsReadOnly(true)
.Execute();

result.Should().Pass();

return result.StdOut;
}
}
}
29 changes: 28 additions & 1 deletion src/Tests/dotnet-MsiInstallation.Tests/MsiInstallerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ public void UpdateWithRollback()
InstallSdk();
InstallWorkload("wasm-tools");
ApplyRC1Manifests();

TestWasmWorkload();

// Second time applying same rollback file shouldn't do anything
Expand All @@ -220,6 +220,33 @@ public void InstallWithRollback()
TestWasmWorkload();
}

[Fact]
public void InstallShouldNotUpdatePinnedRollback()
{
InstallSdk();
ApplyRC1Manifests();
var workloadVersion = GetWorkloadVersion();

InstallWorkload("aspire");

GetWorkloadVersion().Should().Be(workloadVersion);
}

[Fact]
public void UpdateShouldUndoPinnedRollback()
{
InstallSdk();
ApplyRC1Manifests();
var workloadVersion = GetWorkloadVersion();

VM.CreateRunCommand("dotnet", "workload", "update")
.Execute()
.Should().Pass();

GetWorkloadVersion().Should().NotBe(workloadVersion);

}

[Fact]
public void ShouldNotShowRebootMessage()
{
Expand Down
11 changes: 0 additions & 11 deletions src/Tests/dotnet-MsiInstallation.Tests/WorkloadSetTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -213,17 +213,6 @@ public void UpdateToWorkloadSetVersionWithManifestsNotAvailable()
GetWorkloadVersion().Should().Be(workloadVersionBeforeUpdate);
}

string GetWorkloadVersion()
{
var result = VM.CreateRunCommand("dotnet", "workload", "--version")
.WithIsReadOnly(true)
.Execute();

result.Should().Pass();

return result.StdOut;
}

string GetUpdateMode()
{
var result = VM.CreateRunCommand("dotnet", "workload", "config", "--update-mode")
Expand Down

0 comments on commit effb24f

Please sign in to comment.