generated from amazon-archives/__template_MIT-0
-
Notifications
You must be signed in to change notification settings - Fork 40
Open
Labels
TeamCityUpdates related to TeamCity ModuleUpdates related to TeamCity ModuletestsCreate or update testsCreate or update tests
Description
What type of tests are needed?
Comprehensive test coverage for the TeamCity Terraform module to ensure reliability and prevent regressions.
Is this related to an existing testing pattern?
Yes - following the established pattern in other modules with modules/<service>/tests/ directory structure.
What tests should be added?
1. Terraform Tests (modules/teamcity/tests/)
Create Terraform tests using the native terraform test command:
Basic Deployment Test (tests/basic.tftest.hcl):
# Test basic TeamCity deployment with minimal configuration
run "basic_deployment" {
command = plan
assert {
condition = length(module.teamcity.ecs_service_id) > 0
error_message = "TeamCity ECS service must be created"
}
assert {
condition = module.teamcity.alb_dns_name != null
error_message = "ALB must be created for TeamCity access"
}
}RDS Database Test:
# Verify RDS database configuration
run "rds_configuration" {
command = plan
assert {
condition = module.teamcity.rds_endpoint != null
error_message = "RDS database must be provisioned for TeamCity"
}
}EFS Storage Test:
# Verify EFS filesystem for TeamCity data directory
run "efs_storage" {
command = plan
assert {
condition = module.teamcity.efs_id != null
error_message = "EFS must be created for TeamCity data persistence"
}
}2. Setup Directory for CI (modules/teamcity/tests/setup/)
Create infrastructure to retrieve test parameters from CI:
# tests/setup/main.tf
# Retrieves VPC and subnet information for test execution
data "aws_vpc" "test" {
default = true
}
data "aws_subnets" "test" {
filter {
name = "vpc-id"
values = [data.aws_vpc.test.id]
}
}
output "vpc_id" {
value = data.aws_vpc.test.id
}
output "subnet_ids" {
value = data.aws_subnets.test.ids
}3. Example Validation
Ensure all examples in modules/teamcity/examples/ are valid and can be deployed:
Simple Example (examples/simple/):
- Test basic deployment with minimal configuration
- Verify outputs are populated correctly
Complete Example (examples/complete/):
- Test full-featured deployment with all optional components
- Verify auto-scaling, logging, monitoring configurations
4. Integration Tests (Optional)
For more comprehensive testing, consider adding integration tests that:
- Deploy the module to a real AWS account
- Verify TeamCity web UI is accessible
- Test build agent connectivity
- Validate RDS database connectivity from TeamCity server
- Confirm EFS mounts correctly
Test Execution
Tests should be runnable via:
# Run Terraform tests
cd modules/teamcity
terraform test
# Validate examples
cd modules/teamcity/examples/simple
terraform init
terraform plan
terraform validateCI Integration
Tests should run in GitHub Actions on:
- Pull requests that modify the TeamCity module
- Scheduled nightly runs to catch provider/API changes
- Before releases
Success Criteria
- Terraform tests exist in
modules/teamcity/tests/ - Setup directory exists for CI parameter retrieval
- All examples validate successfully (
terraform validate) - Tests are documented in module README
- Tests run in CI pipeline
- Tests cover key functionality (ECS, RDS, EFS, ALB)
References
- Terraform Testing Documentation
- Existing test patterns in other modules (Perforce, VDI, Jenkins)
- Module design standards:
modules/DESIGN_STANDARDS.md
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
TeamCityUpdates related to TeamCity ModuleUpdates related to TeamCity ModuletestsCreate or update testsCreate or update tests
Type
Projects
Status
Backlog