Accepted
2025-09-29
The Torrust Tracker Deployer project has two distinct concepts that both could be called "environment":
-
Testing Context (Current
TestEnvironment): A test harness managing temporary resources, SSH keys, services, and cleanup for end-to-end testing. -
Multi-Environment Deployment (Planned Feature): Different deployment targets (dev, staging, production) with separate state, build artifacts, and persistent infrastructure.
This naming collision could mislead contributors and create ambiguity in the codebase.
TestEnvironment→TestContext: Better represents a complete testing context with multiple resources- Reserve
Environmentfor multi-environment feature: Aligns with industry standards (GitHub, AWS, Railway, Vercel)
For Testing Context:
TestFixture: Too narrow, implies single resource rather than complete contextTestHarness: Less familiar to some developersTestSetup: Generic, less descriptiveTestSandbox: Could suggest security focus rather than resource management
For Multi-Environment Feature:
Context: Used by Docker/Kubernetes but less intuitive for deployment targetsWorkspace: Used by Terraform differently, could conflict with IDE workspacesTarget: Less descriptive of full environment conceptStage: Implies sequence, less flexibleStack: Implies specific architecture
- TestContext accurately describes managing a complete testing context with multiple resources and services
- Environment is the industry standard for deployment targets, making it immediately intuitive for users
- Clear conceptual separation:
TestContextfor temporary test infrastructure,Environmentfor persistent deployment targets |TestContext✅ | Conveys complete context management | Slightly longer | Testing frameworks, .NET | |TestSandbox| Implies isolation | Could suggest security focus | Containerization | |TestWorkspace| Suggests temporary work area | Could conflict with IDE workspaces | IDE terminology |
| Name | Pros | Cons | Industry Usage |
|---|---|---|---|
Environment ✅ |
Industry standard, intuitive | Could conflict with test environment | GitHub, AWS, Railway, Vercel |
Context |
Used by Docker/Kubernetes | Less intuitive for deployment targets | Docker, Kubernetes |
Workspace |
Clear isolation concept | Used by Terraform differently | Terraform |
Target |
Clear deployment meaning | Less descriptive of full environment | Build systems |
Stage |
Common in CI/CD | Implies sequence, less flexible | AWS, CI/CD pipelines |
Stack |
Complete infrastructure set | Implies specific architecture | Pulumi, CloudFormation |
We will adopt the following naming strategy:
Rationale:
TestContextbetter represents what the struct actually does: managing a complete testing context with multiple resources, configuration, and services- It's more accurate than "TestFixture" which implies a single resource
- Common in testing frameworks and clearly distinguishes from deployment environments
- Conveys the idea of a complete context that encompasses multiple concerns
Rationale:
Environmentis the industry standard term used by GitHub Actions, AWS, Railway, Vercel, and most DevOps tools- Users will immediately understand commands like
deploy --environment devordeploy --environment staging - Aligns with common DevOps terminology and user expectations
- Most intuitive for the target use case
TestEnvironmentError→TestContextErrorTestEnvironmentType→TestContextType- Update field names:
environment_type→context_type - Update documentation and comments throughout
- Clear Conceptual Separation:
TestContextfor temporary test infrastructure,Environmentfor persistent deployment targets - Industry Alignment: Users familiar with other DevOps tools will immediately understand the Environment concept
- Accurate Naming:
TestContextbetter describes the actual functionality - Future-Proof: Leaves
Environmentavailable for the more important multi-environment feature
- Refactoring Required: Need to update existing code, tests, and documentation
- Temporary Disruption: Developers working on branches will need to update their code
- Documentation Updates: All references in docs and comments need updating
- Learning Curve: Minimal -
TestContextis intuitive for developers familiar with testing frameworks
- Create this decision record
- Update
TestEnvironment→TestContextinsrc/e2e/environment.rs - Search for and update all references in other files
- Update documentation and module-level comments
- Update error types and messages
- Run tests to ensure no breakage
// Test context usage
let test_context = TestContext::initialized(
false,
"templates",
&ssh_user,
instance_name,
ssh_private_key_path,
ssh_public_key_path,
TestContextType::Container,
)?;
// Future environment usage (planned)
deploy --environment dev
deploy --environment staging
deploy --environment production
struct Environment {
name: String,
build_dir: PathBuf,
data_dir: PathBuf,
config: EnvironmentConfig,
}This decision enables future work on:
- Multi-environment deployment feature
- Environment-specific configuration management
- Independent state management per environment
- Industry examples: GitHub Environments, AWS Environments, Docker Contexts, Terraform Workspaces
- Testing terminology: xUnit TestFixture, .NET TestContext
- Current codebase:
src/e2e/environment.rs