Skip to content

Comments

fix: config set circular dependency - allow config commands without default account#799

Draft
natalie-o-perret wants to merge 22 commits intomasterfrom
fix/config-set-no-default-account
Draft

fix: config set circular dependency - allow config commands without default account#799
natalie-o-perret wants to merge 22 commits intomasterfrom
fix/config-set-no-default-account

Conversation

@natalie-o-perret
Copy link
Contributor

@natalie-o-perret natalie-o-perret commented Feb 20, 2026

This pull request improves the CLI's configuration command handling, especially in scenarios where no default account is set or the config file is missing. It ensures that config commands like set, list, and show work gracefully without a default account, fixes circular dependencies, and provides more helpful error messages for users. The CI workflows are also refactored for better structure and coverage. Integration and E2E tests are updated and expanded to cover these behaviors.

Config command robustness and user experience:

  • Allows config management commands (set, list, show) to run even when no default account is set, fixing the circular dependency where setting a default account previously required a default to exist. Provides clear, actionable error messages and guidance for users in these scenarios. [1] [2] [3] [4] [5] [6] [7] [8]
  • Improves error messages when no config file or accounts exist, guiding users to run exo config or exo config add with appropriate instructions. [1] [2] [3] [4]

Testing improvements:

  • Adds and updates E2E test scripts to verify the new config command behaviors, including scenarios with missing default accounts and missing config files. Removes outdated or redundant tests. [1] [2] [3] [4] [5]
  • Refactors integration tests by splitting them into local (no API required) and api (real API required) directories, adds documentation for running them, and updates package naming for clarity. [1] [2] [3] [4] [5]

CI/CD workflow refactoring:

  • Refactors GitHub Actions workflows for clearer job names, better structure, and explicit build/test steps. Consolidates and replaces the E2E testscript workflow with new jobs in main.yml. [1] [2] [3] [4] [5]

These changes make the CLI more robust and user-friendly, especially for first-time users and those with non-standard configurations.

Description

Checklist

(For exoscale contributors)

  • Changelog updated (under Unreleased block)
  • Testing

Testing

  • Integration Testing
  • E2E Testing

…efault account

Fixes circular dependency where 'exo config set' required a default account
to exist in order to set one. Now config management commands (list, set, show)
can run without a default account being configured.

Changes:
- Allow config list/set/show to run without default account
- Improve error messages with helpful guidance and available accounts
- Split test scenarios into focused test files for better clarity

Tests:
- set_without_default_account: Tests the core circular dependency fix
- commands_require_default_or_flag: Tests error handling and workarounds
- no_config_file: Tests first-time user experience

All e2e tests passing.
Organize integration tests into:
- tests/integ/local/ - Tests that don't require API credentials
- tests/integ/api/ - Tests requiring real API (with integration_api build tag)

Changes:
- Move config_panic_test.go to local/ (no API needed)
- Move blockstorage_test.go to api/ (requires API)
- Add build tag to API tests to prevent accidental execution
- Update package names and imports for new structure
- Add comprehensive README documenting the test organization

Benefits:
- Local tests can run in CI/CD without credentials
- API tests clearly marked and require explicit opt-in via build tag
- Better separation of concerns
- Prevents accidental execution of tests that create real resources
Add tests/integ/local to the build workflow. These tests don't require
API credentials and verify CLI behavior like config command handling.

This ensures that integration tests that can run without credentials
are automatically validated in CI/CD.
Split test execution into focused workflows:

1. main.yml (CI) - Build + Unit tests
   - Fast feedback on code quality
   - Runs on all branches

2. integration.yml (NEW) - Integration tests
   - tests/integ/local (no API credentials)
   - Placeholder for tests/integ/api (with credentials, commented out)
   - Runs on all branches and PRs

3. testscript.yml - E2E testscript tests
   - tests/e2e local scenarios
   - Runs on master and PRs

Benefits:
- Clear separation of test types
- Parallel execution for faster CI
- Easy to identify which test suite failed
- Integration tests no longer mixed with unit tests
- Change 'Add an account with: exo config add' to 'Run: exo config'
- More concise and directs users to the interactive config flow
- Update all e2e and integration tests to match new messages
- Remove debug logging from root.go
User feedback: show both 'exo config' and 'exo config add' options
Error message now: 'Run: exo config (or exo config add)'
- integration.yml -> test-integration.yml
- testscript.yml -> test-e2e-testscript.yml

Makes it clear these are test workflows alongside main.yml
- 'E2E Testscript Tests' -> 'Tests - E2E - Testscript'
- 'Integration Tests' -> 'Tests - Integration'

Makes all test workflows easier to identify in GitHub UI
Added 'Build And Test' name to match other workflows
- Run on all branches (not just master)
- Add paths-ignore for markdown and bucket
- Add tags-ignore for version tags
- Matches integration test pattern
Push to all branches already covers PR branches, so pull_request
trigger is unnecessary. Matches main CI build pattern.
- Renamed 'Build And Test' job to separate Build and Tests - Unit
- Added Tests - Integration job (from test-integration.yml)
- Added Tests - E2E job (from test-e2e-testscript.yml)
- Removed separate test workflow files
- All test jobs now run in parallel under one CI status check
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.

1 participant