@ -21,7 +21,7 @@ func TestDockerSetup_Files(t *testing.T) {
// Read and validate basic structure
// Read and validate basic structure
content , err := os . ReadFile ( composePath )
content , err := os . ReadFile ( composePath )
require . NoError ( t , err )
require . NoError ( t , err )
composeContent := string ( content )
composeContent := string ( content )
assert . Contains ( t , composeContent , "version:" , "Should have version specified" )
assert . Contains ( t , composeContent , "version:" , "Should have version specified" )
assert . Contains ( t , composeContent , "services:" , "Should have services section" )
assert . Contains ( t , composeContent , "services:" , "Should have services section" )
@ -45,7 +45,7 @@ func TestDockerSetup_Files(t *testing.T) {
// Validate basic Dockerfile structure
// Validate basic Dockerfile structure
content , err := os . ReadFile ( dockerfilePath )
content , err := os . ReadFile ( dockerfilePath )
require . NoError ( t , err )
require . NoError ( t , err )
dockerContent := string ( content )
dockerContent := string ( content )
assert . Contains ( t , dockerContent , "FROM" , "Should have FROM instruction" )
assert . Contains ( t , dockerContent , "FROM" , "Should have FROM instruction" )
}
}
@ -69,7 +69,7 @@ func TestDockerSetup_Files(t *testing.T) {
// Validate basic shell script structure
// Validate basic shell script structure
content , err := os . ReadFile ( scriptPath )
content , err := os . ReadFile ( scriptPath )
require . NoError ( t , err )
require . NoError ( t , err )
scriptContent := string ( content )
scriptContent := string ( content )
assert . Contains ( t , scriptContent , "#!/" , "Should have shebang" )
assert . Contains ( t , scriptContent , "#!/" , "Should have shebang" )
}
}
@ -83,7 +83,7 @@ func TestDockerSetup_Files(t *testing.T) {
// Validate basic Makefile structure
// Validate basic Makefile structure
content , err := os . ReadFile ( makefilePath )
content , err := os . ReadFile ( makefilePath )
require . NoError ( t , err )
require . NoError ( t , err )
makefileContent := string ( content )
makefileContent := string ( content )
assert . Contains ( t , makefileContent , "help:" , "Should have help target" )
assert . Contains ( t , makefileContent , "help:" , "Should have help target" )
assert . Contains ( t , makefileContent , "setup:" , "Should have setup target" )
assert . Contains ( t , makefileContent , "setup:" , "Should have setup target" )
@ -99,7 +99,7 @@ func TestDockerSetup_Files(t *testing.T) {
// Validate basic README structure
// Validate basic README structure
content , err := os . ReadFile ( readmePath )
content , err := os . ReadFile ( readmePath )
require . NoError ( t , err )
require . NoError ( t , err )
readmeContent := string ( content )
readmeContent := string ( content )
assert . Contains ( t , readmeContent , "# Kafka Integration Testing" , "Should have main title" )
assert . Contains ( t , readmeContent , "# Kafka Integration Testing" , "Should have main title" )
assert . Contains ( t , readmeContent , "## Quick Start" , "Should have quick start section" )
assert . Contains ( t , readmeContent , "## Quick Start" , "Should have quick start section" )
@ -114,7 +114,7 @@ func TestDockerSetup_Files(t *testing.T) {
// Validate basic Go file structure
// Validate basic Go file structure
content , err := os . ReadFile ( setupPath )
content , err := os . ReadFile ( setupPath )
require . NoError ( t , err )
require . NoError ( t , err )
setupContent := string ( content )
setupContent := string ( content )
assert . Contains ( t , setupContent , "package main" , "Should be main package" )
assert . Contains ( t , setupContent , "package main" , "Should be main package" )
assert . Contains ( t , setupContent , "func main()" , "Should have main function" )
assert . Contains ( t , setupContent , "func main()" , "Should have main function" )
@ -127,11 +127,11 @@ func TestDockerSetup_Configuration(t *testing.T) {
t . Run ( "PortConfiguration" , func ( t * testing . T ) {
t . Run ( "PortConfiguration" , func ( t * testing . T ) {
// This test verifies that the ports used in docker-compose.yml are reasonable
// This test verifies that the ports used in docker-compose.yml are reasonable
// and don't conflict with common development ports
// and don't conflict with common development ports
expectedPorts := map [ string ] string {
expectedPorts := map [ string ] string {
"zookeeper" : "2181" ,
"kafka" : "9092" ,
"schema-registry" : "8081" ,
"zookeeper" : "2181" ,
"kafka" : "9092" ,
"schema-registry" : "8081" ,
"seaweedfs-master" : "9333" ,
"seaweedfs-master" : "9333" ,
"seaweedfs-volume" : "8080" ,
"seaweedfs-volume" : "8080" ,
"seaweedfs-filer" : "8888" ,
"seaweedfs-filer" : "8888" ,
@ -141,11 +141,11 @@ func TestDockerSetup_Configuration(t *testing.T) {
composePath := "docker-compose.yml"
composePath := "docker-compose.yml"
content , err := os . ReadFile ( composePath )
content , err := os . ReadFile ( composePath )
require . NoError ( t , err )
require . NoError ( t , err )
composeContent := string ( content )
composeContent := string ( content )
for service , port := range expectedPorts {
for service , port := range expectedPorts {
assert . Contains ( t , composeContent , port + ":" ,
assert . Contains ( t , composeContent , port + ":" ,
"Service %s should expose port %s" , service , port )
"Service %s should expose port %s" , service , port )
}
}
} )
} )
@ -155,17 +155,17 @@ func TestDockerSetup_Configuration(t *testing.T) {
composePath := "docker-compose.yml"
composePath := "docker-compose.yml"
content , err := os . ReadFile ( composePath )
content , err := os . ReadFile ( composePath )
require . NoError ( t , err )
require . NoError ( t , err )
composeContent := string ( content )
composeContent := string ( content )
// Should have health checks for critical services
// Should have health checks for critical services
assert . Contains ( t , composeContent , "healthcheck:" , "Should have health checks" )
assert . Contains ( t , composeContent , "healthcheck:" , "Should have health checks" )
// Verify specific health check patterns
// Verify specific health check patterns
healthCheckServices := [ ] string { "kafka" , "schema-registry" , "seaweedfs-master" }
healthCheckServices := [ ] string { "kafka" , "schema-registry" , "seaweedfs-master" }
for _ , service := range healthCheckServices {
for _ , service := range healthCheckServices {
// Look for health check in the service section (basic validation)
// Look for health check in the service section (basic validation)
assert . Contains ( t , composeContent , service + ":" ,
assert . Contains ( t , composeContent , service + ":" ,
"Service %s should be defined" , service )
"Service %s should be defined" , service )
}
}
} )
} )
@ -174,9 +174,9 @@ func TestDockerSetup_Configuration(t *testing.T) {
composePath := "docker-compose.yml"
composePath := "docker-compose.yml"
content , err := os . ReadFile ( composePath )
content , err := os . ReadFile ( composePath )
require . NoError ( t , err )
require . NoError ( t , err )
composeContent := string ( content )
composeContent := string ( content )
// Should have network configuration
// Should have network configuration
assert . Contains ( t , composeContent , "networks:" , "Should have networks section" )
assert . Contains ( t , composeContent , "networks:" , "Should have networks section" )
assert . Contains ( t , composeContent , "kafka-test-net" , "Should have test network" )
assert . Contains ( t , composeContent , "kafka-test-net" , "Should have test network" )
@ -193,7 +193,7 @@ func TestDockerSetup_Integration(t *testing.T) {
// Validate test structure
// Validate test structure
content , err := os . ReadFile ( testPath )
content , err := os . ReadFile ( testPath )
require . NoError ( t , err )
require . NoError ( t , err )
testContent := string ( content )
testContent := string ( content )
assert . Contains ( t , testContent , "TestDockerIntegration_E2E" , "Should have E2E test" )
assert . Contains ( t , testContent , "TestDockerIntegration_E2E" , "Should have E2E test" )
assert . Contains ( t , testContent , "KAFKA_BOOTSTRAP_SERVERS" , "Should check environment variables" )
assert . Contains ( t , testContent , "KAFKA_BOOTSTRAP_SERVERS" , "Should check environment variables" )
@ -205,17 +205,17 @@ func TestDockerSetup_Integration(t *testing.T) {
testPath := "docker_integration_test.go"
testPath := "docker_integration_test.go"
content , err := os . ReadFile ( testPath )
content , err := os . ReadFile ( testPath )
require . NoError ( t , err )
require . NoError ( t , err )
testContent := string ( content )
testContent := string ( content )
envVars := [ ] string {
envVars := [ ] string {
"KAFKA_BOOTSTRAP_SERVERS" ,
"KAFKA_BOOTSTRAP_SERVERS" ,
"KAFKA_GATEWAY_URL" ,
"KAFKA_GATEWAY_URL" ,
"SCHEMA_REGISTRY_URL" ,
"SCHEMA_REGISTRY_URL" ,
}
}
for _ , envVar := range envVars {
for _ , envVar := range envVars {
assert . Contains ( t , testContent , envVar ,
assert . Contains ( t , testContent , envVar ,
"Should reference environment variable %s" , envVar )
"Should reference environment variable %s" , envVar )
}
}
} )
} )
@ -227,9 +227,9 @@ func TestDockerSetup_Makefile(t *testing.T) {
makefilePath := "Makefile"
makefilePath := "Makefile"
content , err := os . ReadFile ( makefilePath )
content , err := os . ReadFile ( makefilePath )
require . NoError ( t , err )
require . NoError ( t , err )
makefileContent := string ( content )
makefileContent := string ( content )
essentialTargets := [ ] string {
essentialTargets := [ ] string {
"help:" ,
"help:" ,
"setup:" ,
"setup:" ,
@ -241,9 +241,9 @@ func TestDockerSetup_Makefile(t *testing.T) {
"logs:" ,
"logs:" ,
"status:" ,
"status:" ,
}
}
for _ , target := range essentialTargets {
for _ , target := range essentialTargets {
assert . Contains ( t , makefileContent , target ,
assert . Contains ( t , makefileContent , target ,
"Should have target %s" , target )
"Should have target %s" , target )
}
}
} )
} )
@ -252,9 +252,9 @@ func TestDockerSetup_Makefile(t *testing.T) {
makefilePath := "Makefile"
makefilePath := "Makefile"
content , err := os . ReadFile ( makefilePath )
content , err := os . ReadFile ( makefilePath )
require . NoError ( t , err )
require . NoError ( t , err )
makefileContent := string ( content )
makefileContent := string ( content )
devTargets := [ ] string {
devTargets := [ ] string {
"dev-kafka:" ,
"dev-kafka:" ,
"dev-seaweedfs:" ,
"dev-seaweedfs:" ,
@ -262,9 +262,9 @@ func TestDockerSetup_Makefile(t *testing.T) {
"shell-kafka:" ,
"shell-kafka:" ,
"topics:" ,
"topics:" ,
}
}
for _ , target := range devTargets {
for _ , target := range devTargets {
assert . Contains ( t , makefileContent , target ,
assert . Contains ( t , makefileContent , target ,
"Should have development target %s" , target )
"Should have development target %s" , target )
}
}
} )
} )