Skip to content

Commit

Permalink
Add test for advertising workload updates for VS-installed workloads
Browse files Browse the repository at this point in the history
  • Loading branch information
dsplaisted committed May 6, 2024
1 parent c830887 commit 33709c5
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -198,5 +198,14 @@ protected string GetWorkloadVersion()

return result.StdOut;
}

protected void AddNuGetSource(string source)
{
VM.CreateRunCommand("dotnet", "nuget", "add", "source", source)
.WithDescription($"Add {source} to NuGet.config")
.Execute()
.Should()
.Pass();
}
}
}
60 changes: 60 additions & 0 deletions src/Tests/dotnet-MsiInstallation.Tests/VSWorkloadTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.DotNet.MsiInstallerTests.Framework;

namespace Microsoft.DotNet.MsiInstallerTests
{
public class VSWorkloadTests : VMTestBase
{
public VSWorkloadTests(ITestOutputHelper log) : base(log)
{
VM.SetCurrentState("Install VS 17.10 Preview 6");
DeployStage2Sdk();
}

[Fact]
public void WorkloadListShowsVSInstalledWorkloads()
{
var result = VM.CreateRunCommand("dotnet", "workload", "list")
.WithIsReadOnly(true)
.Execute();

result.Should().Pass();

result.Should().HaveStdOutContaining("aspire");
}

[Fact]
public void UpdatesAreAdvertisedForVSInstalledWorkloads()
{
AddNuGetSource("https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet8/nuget/v3/index.json");

VM.CreateRunCommand("dotnet", "new", "classlib", "-o", "LibraryTest")
.WithWorkingDirectory(@"C:\SdkTesting")
.Execute()
.Should()
.Pass();

// build (or any restoring) command should check for and notify of updates
VM.CreateRunCommand("dotnet", "build")
.WithWorkingDirectory(@"C:\SdkTesting\LibraryTest")
.Execute().Should().Pass()
.And.HaveStdOutContaining("Workload updates are available");

// Workload list should list the specific workloads that have updates
VM.CreateRunCommand("dotnet", "workload", "list")
.WithIsReadOnly(true)
.Execute()
.Should()
.Pass()
.And
.HaveStdOutContaining("Updates are available for the following workload(s): aspire");
}
}
}
9 changes: 0 additions & 9 deletions src/Tests/dotnet-MsiInstallation.Tests/WorkloadSetTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -223,14 +223,5 @@ string GetUpdateMode()

return result.StdOut;
}

void AddNuGetSource(string source)
{
VM.CreateRunCommand("dotnet", "nuget", "add", "source", source)
.WithDescription($"Add {source} to NuGet.config")
.Execute()
.Should()
.Pass();
}
}
}

0 comments on commit 33709c5

Please sign in to comment.