Skip to content

Commit 21b685c

Browse files
authored
Allow suppressing configuration output on test (microsoft#5794)
This PR adds the `--suppress-initial-details` argument to the `winget configure test` subcommand. In addition, it makes it so the output can be suppressed independent of accepting the agreements. Since the agreement states that the user is responsible for knowing the configuration they are applying, if they've decided to suppress those details, they should be able to without having to also pass the switch to accept the agreement. I've validated the agreement still appears
1 parent 3cb22d9 commit 21b685c

File tree

4 files changed

+19
-1
lines changed

4 files changed

+19
-1
lines changed

doc/ReleaseNotes.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
## New in v1.28
22

33
<!-- Nothing yet! -->
4+
5+
## Bug Fixes
6+
* `--suppress-initial-details` now works with `winget configure test`
7+
* `--suppress-initial-details` no longer requires `--accept-configuration-agreements`

src/AppInstallerCLICore/Commands/ConfigureTestCommand.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ namespace AppInstaller::CLI
1717
Argument{ Execution::Args::Type::ConfigurationModulePath, Resource::String::ConfigurationModulePath, ArgumentType::Positional },
1818
Argument{ Execution::Args::Type::ConfigurationProcessorPath, Resource::String::ConfigurationProcessorPath, ArgumentType::Standard, Argument::Visibility::Help },
1919
Argument{ Execution::Args::Type::ConfigurationHistoryItem, Resource::String::ConfigurationHistoryItemArgumentDescription, ArgumentType::Standard, Argument::Visibility::Help },
20+
Argument{ Execution::Args::Type::ConfigurationSuppressPrologue, Resource::String::ConfigurationSuppressPrologueArgumentDescription, ArgumentType::Flag, Argument::Visibility::Help },
2021
Argument{ Execution::Args::Type::ConfigurationAcceptWarning, Resource::String::ConfigurationAcceptWarningArgumentDescription, ArgumentType::Flag },
2122
};
2223
}

src/AppInstallerCLICore/Workflows/ConfigurationFlow.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2057,7 +2057,7 @@ namespace AppInstaller::CLI::Workflow
20572057
auto getDetailsOperation = configContext.Processor().GetSetDetailsAsync(configContext.Set(), ConfigurationUnitDetailFlags::ReadOnly);
20582058
auto unification = anon::CreateProgressCancellationUnification(std::move(progressScope), getDetailsOperation);
20592059

2060-
bool suppressDetailsOutput = context.Args.Contains(Args::Type::ConfigurationAcceptWarning) && context.Args.Contains(Args::Type::ConfigurationSuppressPrologue);
2060+
bool suppressDetailsOutput = context.Args.Contains(Args::Type::ConfigurationSuppressPrologue);
20612061
anon::OutputHelper outputHelper{ context };
20622062
uint32_t unitsShown = 0;
20632063

src/AppInstallerCLIE2ETests/ConfigureTestCommand.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ public void ConfigureTest_NotInDesiredState()
4949
var result = TestCommon.RunAICLICommand(CommandAndAgreements, TestCommon.GetTestDataFile("Configuration\\Configure_TestRepo.yml"));
5050
Assert.AreEqual(Constants.ErrorCode.S_FALSE, result.ExitCode);
5151
Assert.True(result.StdOut.Contains("System is not in the described configuration state."));
52+
Assert.True(result.StdOut.Contains("Module: xE2ETestResource")); // Details from the resource should appear if the initial details are shown
5253
}
5354

5455
/// <summary>
@@ -66,6 +67,7 @@ public void ConfigureTest_InDesiredState()
6667
var result = TestCommon.RunAICLICommand(CommandAndAgreements, TestCommon.GetTestDataFile("Configuration\\Configure_TestRepo.yml"));
6768
Assert.AreEqual(Constants.ErrorCode.S_OK, result.ExitCode);
6869
Assert.True(result.StdOut.Contains("System is in the described configuration state."));
70+
Assert.True(result.StdOut.Contains("Module: xE2ETestResource")); // Details from the resource should appear if the initial details are shown
6971
}
7072

7173
/// <summary>
@@ -126,6 +128,17 @@ public void ConfigureTest_DSCv3()
126128
Assert.True(result.StdOut.Contains("System is not in the described configuration state."));
127129
}
128130

131+
/// <summary>
132+
/// Tests that --suppress-initial-details will suppress the initial details output.
133+
/// </summary>
134+
[Test]
135+
public void ConfigureTest_SuppressInitialDetails()
136+
{
137+
var result = TestCommon.RunAICLICommand("configure --accept-configuration-agreements --suppress-initial-details", TestCommon.GetTestDataFile("Configuration\\Configure_TestRepo.yml"));
138+
Assert.AreEqual(0, result.ExitCode);
139+
Assert.False(result.StdOut.Contains("Module: xE2ETestResource")); // Details from the resource should not appear if the initial details are suppressed
140+
}
141+
129142
private void DeleteResourceArtifacts()
130143
{
131144
// Delete all .txt files in the test directory; they are placed there by the tests

0 commit comments

Comments
 (0)