From 73e17a11bcd93b0a0e17c3e34bff60d9acead3d9 Mon Sep 17 00:00:00 2001 From: "Maksim Petrov (AKVELON INC)" Date: Mon, 26 Aug 2024 01:41:00 +0200 Subject: [PATCH] Add agent knob for EnableAzureTestPlanTaskFlow fix --- src/Agent.Sdk/Knob/AgentKnobs.cs | 7 +++++++ src/Agent.Worker/TestResults/ResultsCommandExtension.cs | 6 +++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Agent.Sdk/Knob/AgentKnobs.cs b/src/Agent.Sdk/Knob/AgentKnobs.cs index a790c35ba0..a8214d4e16 100644 --- a/src/Agent.Sdk/Knob/AgentKnobs.cs +++ b/src/Agent.Sdk/Knob/AgentKnobs.cs @@ -606,6 +606,13 @@ public class AgentKnobs new EnvironmentKnobSource("AZP_ENABLE_RESOURCE_UTILIZATION_WARNINGS"), new BuiltInDefaultKnobSource("false")); + public static readonly Knob EnableAzureTestPlanFeatureState = new Knob( + nameof(EnableAzureTestPlanFeatureState), + "If true, enables manual test point information linkage to automated test results.", + new RuntimeKnobSource("AZP_AGENT_ENABLE_AZURE_TEST_PLAN_FEATURE_STATE"), + new EnvironmentKnobSource("AZP_AGENT_ENABLE_AZURE_TEST_PLAN_FEATURE_STATE"), + new BuiltInDefaultKnobSource("false")); + public static readonly Knob ForceCreateTasksDirectory = new Knob( nameof(ForceCreateTasksDirectory), "Forces the agent to create _tasks folder for tasks.", diff --git a/src/Agent.Worker/TestResults/ResultsCommandExtension.cs b/src/Agent.Worker/TestResults/ResultsCommandExtension.cs index 2aa8e5cfeb..520c4c40ca 100644 --- a/src/Agent.Worker/TestResults/ResultsCommandExtension.cs +++ b/src/Agent.Worker/TestResults/ResultsCommandExtension.cs @@ -18,6 +18,7 @@ using Microsoft.VisualStudio.Services.Agent.Worker.CodeCoverage; using Microsoft.VisualStudio.Services.WebApi; using Microsoft.VisualStudio.Services.WebPlatform; +using Agent.Sdk.Knob; namespace Microsoft.VisualStudio.Services.Agent.Worker.TestResults { @@ -444,7 +445,10 @@ private void LoadFeatureFlagState() var featureFlagService = _executionContext.GetHostContext().GetService(); featureFlagService.InitializeFeatureService(_executionContext, connection); _publishTestResultsLibFeatureState = featureFlagService.GetFeatureFlagState(TestResultsConstants.UsePublishTestResultsLibFeatureFlag, TestResultsConstants.TFSServiceInstanceGuid); - _enableAzureTestPlanFeatureState = featureFlagService.GetFeatureFlagState(TestResultsConstants.EnableAzureTestPlanTaskFeatureFlag, TestResultsConstants.TFSServiceInstanceGuid); + if (AgentKnobs.EnableAzureTestPlanFeatureState.GetValue(_executionContext).AsBoolean()) + { + _enableAzureTestPlanFeatureState = featureFlagService.GetFeatureFlagState(TestResultsConstants.EnableAzureTestPlanTaskFeatureFlag, TestResultsConstants.TFSServiceInstanceGuid); + } _triggerCoverageMergeJobFeatureState = featureFlagService.GetFeatureFlagState(CodeCoverageConstants.TriggerCoverageMergeJobFF, TestResultsConstants.TFSServiceInstanceGuid); } }