Skip to content

feat(test): add testscript integration test framework#796

Merged
natalie-o-perret merged 6 commits intomasterfrom
feat/testscript-integration-tests
Feb 19, 2026
Merged

feat(test): add testscript integration test framework#796
natalie-o-perret merged 6 commits intomasterfrom
feat/testscript-integration-tests

Conversation

@natalie-o-perret
Copy link
Contributor

  • Add testscript library for declarative CLI testing
  • Create test runner with config isolation per test
  • Add example test scenarios for basic CLI commands
  • Configure GitHub Actions workflow for CI
  • Use scenarios/ directory for test files

This provides a more maintainable and readable alternative to the existing Go-based integration tests, with automatic config isolation and better support for both local and CI environments.

Scenarios directory can be customized by changing Dir parameter in testscript.Run(). Tests use runtime.Caller() to locate CLI root, ensuring correct path resolution regardless of working directory.

The framework supports:

  • Config file isolation via XDG_CONFIG_HOME redirection
  • Environment variable credential forwarding
  • Parallel test execution
  • Both unit tests (no API) and integration tests (with API)

Checklist

(For exoscale contributors)

  • Changelog updated (under Unreleased block)
  • Testing

- Add testscript library for declarative CLI testing
- Create test runner with config isolation per test
- Add example test scenarios for basic CLI commands
- Configure GitHub Actions workflow for CI
- Use scenarios/ directory for test files

This provides a more maintainable and readable alternative to the
existing Go-based integration tests, with automatic config isolation
and better support for both local and CI environments.

Scenarios directory can be customized by changing Dir parameter in
testscript.Run(). Tests use runtime.Caller() to locate CLI root,
ensuring correct path resolution regardless of working directory.

The framework supports:
- Config file isolation via XDG_CONFIG_HOME redirection
- Environment variable credential forwarding
- Parallel test execution
- Both unit tests (no API) and integration tests (with API)
- Remove outdated comment about interactive config add
- Add TODO for making test flags parametrizable per scenario
- Document need for org account setup in future PR for API tests
- Add scenarios/README.md explaining current and future test coverage
@natalie-o-perret natalie-o-perret requested a review from a team February 19, 2026 10:57
@natalie-o-perret natalie-o-perret marked this pull request as ready for review February 19, 2026 10:57
The integration-tests job is commented out until actual API test
scenarios are added in a future PR, since currently no testscript
scenarios require API credentials.
Instead of building the binary within the test code, use the binary
from the existing build pipeline (bin/exo). This:
- Eliminates redundant builds in test code
- Tests the actual build artifact from the pipeline
- Aligns with existing test infrastructure (blockstorage_test.go)
- Improves test execution speed

GitHub Actions workflow now runs 'make build' before tests.
Copy link
Member

@imiric imiric left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool! I wasn't familiar with testscript. It seems very convenient for CLI testing, and the fact it's used internally by the Go team is a strong signal of confidence. In personal projects I've usually designed my commands so that they're testable at the highest CLI layer, which avoids the overhead of having to build a binary, but this approach actually tests the end user interface, which is great.

No significant feedback from me, just a minor suggestion/question. Great contribution! 👏

- Move testscript scenarios from internal/integ/ to tests/e2e/
- Move programmatic tests from internal/integ/ to tests/integ/
- Rename unit/integration terminology to local/api for clarity
- Update build tags from 'integration' to 'api'
- Rename test functions: TestScriptsUnit → TestScriptsLocal, TestScriptsIntegration → TestScriptsAPI
- Update GitHub Actions workflow for new structure and build tags
- Update documentation to reflect new organization

This provides cleaner separation between:
- tests/e2e/: Declarative testscript scenarios (local vs api)
- tests/integ/: Programmatic Go tests with suite helpers

Both test approaches are end-to-end from CLI user perspective, just different implementation styles.
@natalie-o-perret natalie-o-perret merged commit cb03649 into master Feb 19, 2026
4 checks passed
@natalie-o-perret natalie-o-perret deleted the feat/testscript-integration-tests branch February 19, 2026 15:25
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.

4 participants

Comments