-
Notifications
You must be signed in to change notification settings - Fork 908
Adding L0 tests for Legacy NodeHandler logic | Adding 2 Knobs for feature flag & EOL toggle status value #5421
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
base: master
Are you sure you want to change the base?
Conversation
…ed node | L0 tests for node handlers
…quence | Preventing leakage of test specific environment settings for knobs between node handler tests (both new and legacy)
…checks from handlers | Adding string tempalates for errors and warning and removing hard-coded erros and warning from code
…implyfying unit test scenarios to avoid using redundant code | Update NodeHandlerTestBase to reflect the simplified test scenario usage for unning tests
… check inside getnodeLocation function) | Added custom node path L0 tests | Updated test base code to integrate custom node tests
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
| nameof(EnableEOLNodeVersionPolicy), | ||
| "When enabled, automatically upgrades tasks using end-of-life Node.js versions (6, 10, 16) to supported versions (Node 20.1 or Node 24). Throws error if no supported versions are available on the agent.", | ||
| new PipelineFeatureSource("AGENT_ENABLE_EOL_NODE_VERSION_POLICY"), | ||
| new EnvironmentKnobSource("AGENT_ENABLE_EOL_NODE_VERSION_POLICY"), |
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.
Can we please finalize the Knob name here? server side change the Knob name is AGENT_RESTRICT_EOL_NODE_VERSIONS.
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.
Keep you change as is. Will update knob string here in agent code to match: AGENT_RESTRICT_EOL_NODE_VERSIONS
|
|
||
| namespace Microsoft.VisualStudio.Services.Agent.Tests | ||
| { | ||
| [Collection("Unified NodeHandler Tests")] |
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.
Is this intended?
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.
Yes, this is intended.
Reason: For node handler tests, each test requires setting up creatain environment knobs and flags for it. By default, xUnit runs tests in parallel. As a result, the environment settings get leaked from one test to another causing inconsistent test failures. This collection is created to run node handler tests in sequence to prevent this.
sanjuyadav24
left a comment
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.
Please share a table with all cases mentioned in test cases to validate if any case is not missed and expected behavior in each scenario
| ), | ||
|
|
||
| new TestScenario( | ||
| name: "Node6_DefaultBehavior_EOLPolicyDisabled", |
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.
whats the difference between above and this test case?
|
|
||
| new TestScenario( | ||
| name: "Node6_WithGlobalUseNode10Knob", | ||
| description: "Node6 handler with global Node10 knob: legacy uses Node10, unified ignores deprecated knob and uses Node6", |
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.
why node10 doesn't overwrite node6 knob?
Context
This PR introduces comprehensive L0 test specifications for NodeHandler behavior to establish a test-driven development foundation for upcoming EOL (End of Life) Node.js version policy and unified node selection strategy improvements. The test specifications define expected behaviors for both current legacy implementation and future unified strategy implementation.
Also added 2 knobs, one for feature flag usage to switch between legacy and new Node selection process. Another, to read the EOL toggle status value injected by server when user changes task settings from org settings from ADO.
Related Work: This is the first PR in a multi-part effort to modernize Node.js version handling in Azure Pipelines Agent with proper EOL policy enforcement and custom node path support.
Workitems links
Description
Added comprehensive test infrastructure and specifications for NodeHandler with detailed test scenarios covering:
Test Infrastructure:
NodeHandlerTestBase.cs- Clean base class for NodeHandler test execution with environment setup/teardownNodeHandlerL0.TestSpecifications.cs- Comprehensive test scenarios covering all Node.js versions and edge casesNodeHandlerL0.AllSpecs.cs- Unified test runner executing all scenariosNodeHandlerCollections.cs- Test collection configuration for proper isolationTest Coverage Areas:
2. Node6 Scenarios - Legacy Node 6.x behavior and EOL policy interactions
3. Node10 Scenarios - Node 10.x behavior and EOL policy interactions
4. Node16 Scenarios - Node 16.x behavior and EOL policy interactions
5. Node20 Scenarios - Current default Node 20.x behavior
6. Node24 Scenarios - Latest Node 24.x support
7. Container Scenarios - Node selection in containerized environments
8. EOL Policy Scenarios - End-of-life version handling differences between legacy and unified strategies
Test Structure: Each test scenario includes:
Risk Assessment (Low / Medium / High)
Low Risk - This PR contains only test code with no changes to production logic. The tests currently run against existing legacy NodeHandler implementation, with some CustomNode tests intentionally failing to demonstrate implementation gaps for future development.
Unit Tests Added or Updated (Yes / No)
Yes
Additional Testing Performed
List manual or automated tests performed beyond unit tests (e.g., integration, scenario, regression).
Change Behind Feature Flag (Yes / No)
Not applicable - This PR contains only test code with no production changes requiring feature flags.
Tech Design / Approach
Documentation Changes Required (Yes/No)
Test-First Development Approach:
Logging Added/Updated (Yes/No)
Telemetry Added/Updated (Yes/No)
Rollback Scenario and Process (Yes/No)
Dependency Impact Assessed and Regression Tested (Yes/No)