-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding the client code for supporting experiments #5034
base: master
Are you sure you want to change the base?
Changes from 10 commits
20d1d66
3e66324
e9d77e9
f95c26c
1d7fcd0
1720e20
2072721
9a41fff
ff0ac7b
9dbc7d4
bdf8c90
dee65a9
f26ae41
0de0174
e1bafb4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,12 @@ If you disable this setting, users will not be able to change settings for the W | |
If you enable or do not configure this setting, users will be able to enable experimental features for the Windows Package Manager. | ||
|
||
If you disable this setting, users will not be able to enable experimental features for the Windows Package Manager.</string> | ||
<string id="EnableExperiments">Enable Windows Package Manager Experiments</string> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adding @RDMacLachlan to help with the strings to be used in the adml file There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would suggest the policy be called "Allow" instead of "Enable" even if it is not consistent with the other policies. It probably should also mention that they are Microsoft-run experiments for new features/changes |
||
<string id="EnableExperimentsExplanation">This policy controls whether users can enable experiments in the Windows Package Manager. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We may need to expand on what an experiment is, and how it differs from an experimental feature, so that IT admins can make the decision There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1 this is a placeholder text I added and will be replaced by PM's suggestion 😊 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would use "Experimentation" rather than "Experiments" The policy controls whether users can have experiments run in WinGet on their device. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does the policy control:
This string seems to indicate only 3, but my expectation would be either 1 or 2. |
||
|
||
If you enable or do not configure this setting, users will be able to enable experiments for the Windows Package Manager. | ||
|
||
If you disable this setting, users will not be able to enable experiments for the Windows Package Manager.</string> | ||
<string id="EnableLocalManifestFiles">Enable Windows Package Manager Local Manifest Files</string> | ||
<string id="EnableLocalManifestFilesExplanation">This policy controls whether users can install packages with local manifest files. | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
|
||
AmelBawa-msft marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
#include "pch.h" | ||
#include "TestCommon.h" | ||
#include "TestSettings.h" | ||
#include <winget/Experiment.h> | ||
#include <AppInstallerStrings.h> | ||
|
||
using namespace TestCommon; | ||
using namespace AppInstaller::Settings; | ||
|
||
#define SET_POLICY_STATE(_policy_, _state_) \ | ||
GroupPolicyTestOverride policies; \ | ||
policies.SetState(_policy_, _state_); | ||
|
||
#define SET_USER_SETTINGS(_value_) \ | ||
TestUserSettings settings; \ | ||
settings.Set<Setting::Experiments>({ \ | ||
{"TestExperiment", _value_} \ | ||
}); | ||
|
||
#define ASSERT_EXPERIMENT(_isEnabled_, _toggleSource_) \ | ||
auto testExperimentState = Experiment::GetState(Experiment::Key::TestExperiment); \ | ||
REQUIRE(_isEnabled_ == testExperimentState.IsEnabled()); \ | ||
REQUIRE(_toggleSource_ == testExperimentState.ToggleSource()); | ||
|
||
TEST_CASE("Experiment_GroupPolicyControl", "[experiment]") | ||
{ | ||
SECTION("Not configured") | ||
{ | ||
SET_POLICY_STATE(TogglePolicy::Policy::Experiments, PolicyState::NotConfigured); | ||
ASSERT_EXPERIMENT(true, ExperimentToggleSource::Default); | ||
} | ||
|
||
SECTION("Enabled") | ||
{ | ||
SET_POLICY_STATE(TogglePolicy::Policy::Experiments, PolicyState::Enabled); | ||
ASSERT_EXPERIMENT(true, ExperimentToggleSource::Default); | ||
} | ||
|
||
SECTION("Disabled") | ||
{ | ||
SET_POLICY_STATE(TogglePolicy::Policy::Experiments, PolicyState::Disabled); | ||
ASSERT_EXPERIMENT(false, ExperimentToggleSource::Policy); | ||
} | ||
} | ||
|
||
TEST_CASE("Experiment_GroupPolicyDisabled_ReturnFalse", "[experiment]") | ||
{ | ||
// If the policy is disabled, then also the user settings should be ignored. | ||
SET_POLICY_STATE(TogglePolicy::Policy::Experiments, PolicyState::Disabled); | ||
SET_USER_SETTINGS(true); | ||
ASSERT_EXPERIMENT(false, ExperimentToggleSource::Policy); | ||
} | ||
|
||
TEST_CASE("Experiment_UserSettingsControl", "[experiment]") | ||
{ | ||
SECTION("Experiments not configured in user settings") | ||
{ | ||
// Default value are used | ||
ASSERT_EXPERIMENT(true, ExperimentToggleSource::Default); | ||
} | ||
|
||
SECTION("Experiments enabled in user settings") | ||
{ | ||
SET_USER_SETTINGS(true); | ||
ASSERT_EXPERIMENT(true, ExperimentToggleSource::UserSetting); | ||
} | ||
|
||
SECTION("Experiments disabled in user settings") | ||
{ | ||
SET_USER_SETTINGS(false); | ||
ASSERT_EXPERIMENT(false, ExperimentToggleSource::UserSetting); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I imagine there is already a policy to disable experimentation across Windows as a whole. I found AllowExperimentation but I'm not sure if it does what I think.
If there is such a policy, I think we would be better off not having our own and just pointing people to that one. If somebody disables it system-wide, then our policy won't do anything because the infrastructure we use will be disabled. The only case where it would be useful to have both is if somebody wants to have experimentation in Windows as a whole, but not on winget specifically, which I don't think is a common scenario