diff --git a/functional_consumer_staticmembership_test.go b/functional_consumer_staticmembership_test.go index 28c1f287a..7b78fc484 100644 --- a/functional_consumer_staticmembership_test.go +++ b/functional_consumer_staticmembership_test.go @@ -136,9 +136,6 @@ func TestFuncConsumerGroupStaticMembership_RejoinAndLeave(t *testing.T) { if err != nil { t.Fatal(err) } - if err != nil { - t.Fatal(err) - } if len(res3) != 1 { t.Errorf("group description should be only 1, got %v\n", len(res3)) } @@ -148,7 +145,7 @@ func TestFuncConsumerGroupStaticMembership_RejoinAndLeave(t *testing.T) { generationId3 := m1.generationId.Load() if generationId3 != generationId1 { - t.Errorf("m1 generation should not increase expect %v, actual %v", generationId1, generationId2) + t.Errorf("m1 generation should not increase expect %v, actual %v", generationId1, generationId3) } m2.AssertCleanShutdown() @@ -163,7 +160,7 @@ func TestFuncConsumerGroupStaticMembership_RejoinAndLeave(t *testing.T) { generationId4 := m1.generationId.Load() if generationId4 == generationId1 { - t.Errorf("m1 generation should increase expect %v, actual %v", generationId1, generationId2) + t.Errorf("m1 generation should increase expect %v, actual %v", generationId1, generationId4) } } diff --git a/functional_test.go b/functional_test.go index d328a075e..ede6f2cb1 100644 --- a/functional_test.go +++ b/functional_test.go @@ -283,12 +283,22 @@ func existingEnvironment(ctx context.Context, env *testEnvironment) (bool, error } func tearDownDockerTestEnvironment(ctx context.Context, env *testEnvironment) error { - c := exec.Command("docker", "compose", "down", "--volumes") + args := []string{"compose", "down", "--volumes"} + v, _ := ParseKafkaVersion(env.KafkaVersion) + // use zookeeper profile for kafka < 4 to ensure zookeeper containers are stopped + if !v.IsAtLeast(V4_0_0_0) { + args = append([]string{"compose", "--profile", "zookeeper"}, args[1:]...) + } + c := exec.Command("docker", args...) c.Stdout = os.Stdout c.Stderr = os.Stderr downErr := c.Run() - c = exec.Command("docker", "compose", "rm", "-v", "--force", "--stop") + args = []string{"compose", "rm", "-v", "--force", "--stop"} + if !v.IsAtLeast(V4_0_0_0) { + args = append([]string{"compose", "--profile", "zookeeper"}, args[1:]...) + } + c = exec.Command("docker", args...) c.Stdout = os.Stdout c.Stderr = os.Stderr rmErr := c.Run() diff --git a/go.mod b/go.mod index 523d72ce6..710a38c6c 100644 --- a/go.mod +++ b/go.mod @@ -19,7 +19,7 @@ require ( ) require ( - github.com/golang/snappy v0.0.4 // indirect + github.com/golang/snappy v1.0.0 // indirect github.com/hashicorp/go-uuid v1.0.3 // indirect github.com/jcmturner/aescts/v2 v2.0.0 // indirect github.com/jcmturner/dnsutils/v2 v2.0.0 // indirect diff --git a/go.sum b/go.sum index 3165cec9a..8f526947d 100644 --- a/go.sum +++ b/go.sum @@ -10,8 +10,8 @@ github.com/eapache/queue v1.1.0 h1:YOEu7KNc61ntiQlcEeUIoDTJ2o8mQznoNvUhiigpIqc= github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= -github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= -github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v1.0.0 h1:Oy607GVXHs7RtbggtPBnr2RmDArIsAefDwvrdWvRhGs= +github.com/golang/snappy v1.0.0/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4= github.com/gorilla/sessions v1.2.1/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM= github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=