Skip to content

Update version tests to use the new test framework #4443

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented May 27, 2025

This PR updates the func --version tests to use the new testing framework, as requested in issue #4337.

Changes Made

  • Created a new FuncVersionCommand class in test/Cli/TestFramework/Commands/ directory that extends the base FuncCommand class to handle version-related command execution
  • Updated the VersionTests class to use the new command-based testing approach instead of the older CliTester.Run method
  • Renamed the test method from version to Version_DisplaysVersionNumber to better follow naming conventions
  • Maintained the existing unit tests for IsRunningAnOlderVersion since they are focused on testing the internal version comparison logic rather than CLI commands

Implementation Details

The original test was running the CLI and checking for version output containing "4.". The new implementation:

  1. Uses the FuncVersionCommand to execute the version command
  2. Checks the command result's standard output for the expected version string
  3. Verifies the exit code is 0 (indicating success)

The two unit tests that verify version comparison functionality (IsRunningAnOlderVersion_ShouldReturnTrue_WhenVersionIsOlder and IsRunningAnOlderVersion_ShouldReturnFalse_WhenVersionIsUpToDate) were kept as-is since they're not testing CLI functionality directly.

Fixes #4337.

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 test/Azure.Functions.Cli.Tests/Azure.Functions.Cli.Tests.csproj (dns block)
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js (dns block)
    • Triggering command: dotnet build test/Cli/TestFramework/Azure.Functions.Cli.TestFramework.csproj (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@Copilot Copilot AI changed the title [WIP] Update version tests to use new test framework Update version tests to use the new test framework May 27, 2025
@Copilot Copilot AI requested a review from aishwaryabh May 27, 2025 22:43
Copilot finished work on behalf of aishwaryabh May 27, 2025 22:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update version tests to use new test framework
2 participants