Skip to content

Add tests for local-dev CLI and config utilities #591

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented May 22, 2025

This PR adds comprehensive tests for:

  1. The local_dev CLI command which was added in PR [EAGLE-5987]: make local dev runners super easy to start #568
  2. The config.py utilities, specifically the Context and Config classes

Tests Added

For local_dev CLI:

  • Created test_local_dev_utils.py helper module with functions that test the core functionality without CLI dependencies
  • Added tests for various scenarios:
    • When all resources exist (compute cluster, nodepool, runner)
    • When compute cluster exists but runner doesn't exist
    • When compute cluster exists but nodepool doesn't exist
    • When compute cluster doesn't exist

For config.py:

  • Created tests/test_config.py with comprehensive tests for:
    • Context class:
      • Initialization with env parameter and kwargs
      • Get/set/delete attributes
      • Environment variable handling
      • Serialization to dict
      • Setting environment variables
    • Config class:
      • Loading from YAML
      • Serialization to dict and YAML
      • Current context property
      • Post-initialization processing

Implementation Approach

For the local_dev CLI tests, I avoided directly using the Click command infrastructure which would require significantly more mocking and complexity. Instead, I created utility functions that test the core logic directly, ensuring we verify that the function's behavior is correct for various scenarios.

The config.py tests are traditional unit tests that verify the functionality of the various methods and properties of the Context and Config classes.

Fixes #590.

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:

  • api.test.com
    • Triggering command: python -m pytest tests/cli/test_compute_orchestration.py::TestLocalDevCLI -v (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] Add test for the local-dev CLI Add tests for local-dev CLI and config utilities May 22, 2025
@Copilot Copilot AI requested a review from zeiler May 22, 2025 02:09
Copilot finished work on behalf of zeiler May 22, 2025 02:09
@zeiler zeiler marked this pull request as ready for review May 22, 2025 04:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Add test for the local-dev CLI
2 participants