azure-functions-core-tools
azure-functions-core-tools copied to clipboard
Migrate unit tests from Azure.Functions.Cli.Tests to Func.Unit.Tests
This PR migrates pure unit tests from the test/Azure.Functions.Cli.Tests project to the dedicated test/Cli/Func.Unit.Tests project. The goal is to separate unit tests (which test individual components in isolation) from integration/E2E tests (which use CliTester or run the full CLI).
Changes Made
Migrated Unit Tests (20 files total)
- Helper utilities:
TestUtils.cs,Extensions.cs - Core functionality tests:
KubernetesHelperUnitTests.cs- Kubernetes name validation and YAML serializationUtilitiesTests.cs- Configuration and logging utility methodsAzureHelperTests.cs- Azure function key retrieval (with mocked HTTP)RequirementsTxtParserTests.cs- Python requirements.txt parsing logicGitIgnoreParserTests.cs- Git ignore pattern matchingCommandCheckerFacts.cs- Command existence validationColoredConsoleLoggerTests.cs- Console logging functionalityLoggingFilterHelperTests.cs- Log filtering logicKedaHelperUnitTests.cs- KEDA metadata population for v1/v2HostHelperTests.cs- Custom handler executable detection
- Extension method tests:
StringExtensionsTests.cs- String sanitization methodsUriExtensionsTests.cs- URI server status checkingTaskExtensionsTests.cs- Task failure handling extensionsGenericExtensionsTests.cs- Generic object merging extensionsProcessExtensionsTests.cs- Process wait extensions
- Action tests:
ResolveActionTests.cs- Command line argument parsing and action resolution
Project Updates
- Updated
Azure.Functions.Cli.Unit.Tests.csprojwith required NuGet package references:- Added
Newtonsoft.Json,NSubstitute,RichardSzalay.MockHttp,SuaveServerWrapper,Xunit.SkippableFact
- Added
- Updated all migrated tests to use the
Azure.Functions.Cli.Unit.Testsnamespace
Verification
- All migrated tests are true unit tests that don't depend on CliTester or external CLI execution
- No E2E or integration tests were accidentally moved
- Tests remain functionally identical, only the project location and namespace changed
- Removed migrated files from the original test project to avoid duplication
The remaining tests in Azure.Functions.Cli.Tests are primarily E2E tests that use CliTester or require running the full CLI, which is appropriate for that project.
Fixes #4474.
[!WARNING]
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
azfunc.pkgs.visualstudio.com
- Triggering command:
dotnet build --verbosity quiet(dns block)- Triggering command:
/home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js(dns block)If you need me to access, download, or install something from one of these locations, you can either:
- Configure Actions setup steps to set up my environment, which run before the firewall is enabled
- Add the appropriate URLs or hosts to my firewall allow list
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.
/azp run
Azure Pipelines successfully started running 1 pipeline(s).
/azp run
Azure Pipelines successfully started running 1 pipeline(s).
/azp run
Azure Pipelines successfully started running 1 pipeline(s).