diff --git a/.github/workflows/fvt.yml b/.github/workflows/fvt.yml index 8dcd933e7..c28741373 100644 --- a/.github/workflows/fvt.yml +++ b/.github/workflows/fvt.yml @@ -59,6 +59,10 @@ jobs: nohup sudo tcpdump -i lo -w "fvt-kafka-${{ inputs.kafka-version }}.pcap" portrange 29091-29095 >/dev/null 2>&1 & echo $! >tcpdump.pid make test_functional + echo "## Code Coverage" >>$GITHUB_STEP_SUMMARY + echo "|Filename|Function|Coverage|" >>$GITHUB_STEP_SUMMARY + echo "|--------|--------|--------|" >>$GITHUB_STEP_SUMMARY + go tool cover -func=profile.out | sed -E -e 's/[[:space:]]+/|/g' -e 's/$/|/g' -e 's/^/|/g' >>$GITHUB_STEP_SUMMARY - name: Stop tcpdump if: always() run: | diff --git a/Makefile b/Makefile index 7cefc2a2c..ba6f46e41 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ FILES := $(shell find . -name '*.go' -type f -not -name '*.pb.go' -not -name TESTS := $(shell find . -name '*.go' -type f -not -name '*.pb.go' -not -name '*_generated.go' -name '*_test.go') $(GOBIN)/tparse: - GOBIN=$(GOBIN) go install github.com/mfridman/tparse@v0.11.1 + GOBIN=$(GOBIN) go install github.com/mfridman/tparse@v0.16.0 get: $(GO) get ./... $(GO) mod verify diff --git a/acl_create_request_test.go b/acl_create_request_test.go index fdaf0edd5..5aa3db3ee 100644 --- a/acl_create_request_test.go +++ b/acl_create_request_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import "testing" diff --git a/acl_create_response_test.go b/acl_create_response_test.go index 65b934d9a..b44a5134c 100644 --- a/acl_create_response_test.go +++ b/acl_create_response_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/acl_delete_request_test.go b/acl_delete_request_test.go index cb126e30f..b688adf02 100644 --- a/acl_delete_request_test.go +++ b/acl_delete_request_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import "testing" diff --git a/acl_delete_response_test.go b/acl_delete_response_test.go index eb57d68a5..3336d309a 100644 --- a/acl_delete_response_test.go +++ b/acl_delete_response_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/acl_describe_request_test.go b/acl_describe_request_test.go index 3cb73eb79..fdaa08e1f 100644 --- a/acl_describe_request_test.go +++ b/acl_describe_request_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/acl_describe_response_test.go b/acl_describe_response_test.go index f0652cfee..2224bbe95 100644 --- a/acl_describe_response_test.go +++ b/acl_describe_response_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/acl_types_test.go b/acl_types_test.go index 0b5247a14..5ea9e7e24 100644 --- a/acl_types_test.go +++ b/acl_types_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/add_offsets_to_txn_request_test.go b/add_offsets_to_txn_request_test.go index 471d085cd..4bcfb4640 100644 --- a/add_offsets_to_txn_request_test.go +++ b/add_offsets_to_txn_request_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import "testing" diff --git a/add_offsets_to_txn_response_test.go b/add_offsets_to_txn_response_test.go index d1730cee4..95d4eba94 100644 --- a/add_offsets_to_txn_response_test.go +++ b/add_offsets_to_txn_response_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/add_partitions_to_txn_request_test.go b/add_partitions_to_txn_request_test.go index f60a88695..b7f033970 100644 --- a/add_partitions_to_txn_request_test.go +++ b/add_partitions_to_txn_request_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import "testing" diff --git a/add_partitions_to_txn_response_test.go b/add_partitions_to_txn_response_test.go index b3635e58d..4f899f94f 100644 --- a/add_partitions_to_txn_response_test.go +++ b/add_partitions_to_txn_response_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/admin_test.go b/admin_test.go index 5b42a5a6a..31545c4a2 100644 --- a/admin_test.go +++ b/admin_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/alter_client_quotas_request_test.go b/alter_client_quotas_request_test.go index 46f92b9cb..081dec5df 100644 --- a/alter_client_quotas_request_test.go +++ b/alter_client_quotas_request_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import "testing" diff --git a/alter_client_quotas_response_test.go b/alter_client_quotas_response_test.go index 40efeb547..f4de77e5c 100644 --- a/alter_client_quotas_response_test.go +++ b/alter_client_quotas_response_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import "testing" diff --git a/alter_configs_request_test.go b/alter_configs_request_test.go index e612244c6..ae0161f65 100644 --- a/alter_configs_request_test.go +++ b/alter_configs_request_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import "testing" diff --git a/alter_configs_response_test.go b/alter_configs_response_test.go index 62cd5991f..4707d075d 100644 --- a/alter_configs_response_test.go +++ b/alter_configs_response_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/alter_partition_reassignments_request_test.go b/alter_partition_reassignments_request_test.go index c917f2d79..1ece51a2e 100644 --- a/alter_partition_reassignments_request_test.go +++ b/alter_partition_reassignments_request_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import "testing" diff --git a/alter_partition_reassignments_response_test.go b/alter_partition_reassignments_response_test.go index 8c39ef6ce..1b511c6be 100644 --- a/alter_partition_reassignments_response_test.go +++ b/alter_partition_reassignments_response_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import "testing" diff --git a/alter_user_scram_credentials_request_test.go b/alter_user_scram_credentials_request_test.go index 6fe881906..c83b21e5d 100644 --- a/alter_user_scram_credentials_request_test.go +++ b/alter_user_scram_credentials_request_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import "testing" diff --git a/alter_user_scram_credentials_response_test.go b/alter_user_scram_credentials_response_test.go index 983500639..beca668ce 100644 --- a/alter_user_scram_credentials_response_test.go +++ b/alter_user_scram_credentials_response_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/api_versions_request_test.go b/api_versions_request_test.go index 371ac9602..03cfed8fd 100644 --- a/api_versions_request_test.go +++ b/api_versions_request_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import "testing" diff --git a/api_versions_response_test.go b/api_versions_response_test.go index 26e0bf2a4..d71b72ab7 100644 --- a/api_versions_response_test.go +++ b/api_versions_response_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import "testing" diff --git a/async_producer_test.go b/async_producer_test.go index 099441d70..8e395c755 100644 --- a/async_producer_test.go +++ b/async_producer_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( @@ -17,55 +19,6 @@ import ( "github.com/stretchr/testify/require" ) -const TestMessage = "ABC THE MESSAGE" - -func closeProducerWithTimeout(t *testing.T, p AsyncProducer, timeout time.Duration) { - var wg sync.WaitGroup - p.AsyncClose() - - closer := make(chan struct{}) - timer := time.AfterFunc(timeout, func() { - t.Error("timeout") - close(closer) - }) - defer timer.Stop() - - wg.Add(2) - go func() { - defer wg.Done() - for { - select { - case <-closer: - return - case _, ok := <-p.Successes(): - if !ok { - return - } - t.Error("Unexpected message on Successes()") - } - } - }() - go func() { - defer wg.Done() - for { - select { - case <-closer: - return - case msg, ok := <-p.Errors(): - if !ok { - return - } - t.Error(msg.Err) - } - } - }() - wg.Wait() -} - -func closeProducer(t *testing.T, p AsyncProducer) { - closeProducerWithTimeout(t, p, 5*time.Minute) -} - func expectResultsWithTimeout(t *testing.T, p AsyncProducer, successCount, errorCount int, timeout time.Duration) { t.Helper() expect := successCount + errorCount @@ -1612,27 +1565,6 @@ func TestBrokerProducerShutdown(t *testing.T) { mockBroker.Close() } -type appendInterceptor struct { - i int -} - -func (b *appendInterceptor) OnSend(msg *ProducerMessage) { - if b.i < 0 { - panic("hey, the interceptor has failed") - } - v, _ := msg.Value.Encode() - msg.Value = StringEncoder(string(v) + strconv.Itoa(b.i)) - b.i++ -} - -func (b *appendInterceptor) OnConsume(msg *ConsumerMessage) { - if b.i < 0 { - panic("hey, the interceptor has failed") - } - msg.Value = []byte(string(msg.Value) + strconv.Itoa(b.i)) - b.i++ -} - func testProducerInterceptor( t *testing.T, interceptors []ProducerInterceptor, diff --git a/balance_strategy.go b/balance_strategy.go index 30d41779c..b5bc30a13 100644 --- a/balance_strategy.go +++ b/balance_strategy.go @@ -989,6 +989,7 @@ func (p *partitionMovements) getTheActualPartitionToBeMoved(partition topicParti return reversePairPartition } +//nolint:unused // this is used but only in unittests as a helper (which are excluded by the integration build tag) func (p *partitionMovements) isLinked(src, dst string, pairs []consumerPair, currentPath []string) ([]string, bool) { if src == dst { return currentPath, false @@ -1023,6 +1024,7 @@ func (p *partitionMovements) isLinked(src, dst string, pairs []consumerPair, cur return currentPath, false } +//nolint:unused // this is used but only in unittests as a helper (which are excluded by the integration build tag) func (p *partitionMovements) in(cycle []string, cycles [][]string) bool { superCycle := make([]string, len(cycle)-1) for i := 0; i < len(cycle)-1; i++ { @@ -1037,6 +1039,7 @@ func (p *partitionMovements) in(cycle []string, cycles [][]string) bool { return false } +//nolint:unused // this is used but only in unittests as a helper (which are excluded by the integration build tag) func (p *partitionMovements) hasCycles(pairs []consumerPair) bool { cycles := make([][]string, 0) for _, pair := range pairs { @@ -1068,6 +1071,7 @@ func (p *partitionMovements) hasCycles(pairs []consumerPair) bool { return false } +//nolint:unused // this is used but only in unittests as a helper (which are excluded by the integration build tag) func (p *partitionMovements) isSticky() bool { for topic, movements := range p.PartitionMovementsByTopic { movementPairs := make([]consumerPair, len(movements)) @@ -1085,6 +1089,7 @@ func (p *partitionMovements) isSticky() bool { return true } +//nolint:unused // this is used but only in unittests as a helper (which are excluded by the integration build tag) func indexOfSubList(source []string, target []string) int { targetSize := len(target) maxCandidate := len(source) - targetSize diff --git a/balance_strategy_test.go b/balance_strategy_test.go index f397a9073..fa42bca82 100644 --- a/balance_strategy_test.go +++ b/balance_strategy_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/broker_test.go b/broker_test.go index 6e6b8480c..7abcc5ca8 100644 --- a/broker_test.go +++ b/broker_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/client_test.go b/client_test.go index 155827a00..117a25e40 100644 --- a/client_test.go +++ b/client_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( @@ -12,14 +14,6 @@ import ( "github.com/rcrowley/go-metrics" ) -func safeClose(t testing.TB, c io.Closer) { - t.Helper() - err := c.Close() - if err != nil { - t.Error(err) - } -} - func TestSimpleClient(t *testing.T) { seedBroker := NewMockBroker(t, 1) diff --git a/client_tls_test.go b/client_tls_test.go index 7c2432c99..c95b5354d 100644 --- a/client_tls_test.go +++ b/client_tls_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/config_test.go b/config_test.go index 4db9af95c..92130ff90 100644 --- a/config_test.go +++ b/config_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/consumer_group_example_test.go b/consumer_group_example_test.go index 06eb1d964..ccaf24f78 100644 --- a/consumer_group_example_test.go +++ b/consumer_group_example_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/consumer_group_members_test.go b/consumer_group_members_test.go index a28755d2e..6c2d7c5d9 100644 --- a/consumer_group_members_test.go +++ b/consumer_group_members_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/consumer_group_test.go b/consumer_group_test.go index 30d615e98..3c77e77b3 100644 --- a/consumer_group_test.go +++ b/consumer_group_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/consumer_metadata_request_test.go b/consumer_metadata_request_test.go index 3f6bcdb57..aa2d5a323 100644 --- a/consumer_metadata_request_test.go +++ b/consumer_metadata_request_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/consumer_metadata_response_test.go b/consumer_metadata_response_test.go index cdd489ec1..8d64d268c 100644 --- a/consumer_metadata_response_test.go +++ b/consumer_metadata_response_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/consumer_test.go b/consumer_test.go index 126cef6c3..23ad71f2e 100644 --- a/consumer_test.go +++ b/consumer_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/control_record_test.go b/control_record_test.go index 8a1d74863..06c155e0b 100644 --- a/control_record_test.go +++ b/control_record_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/create_partitions_request_test.go b/create_partitions_request_test.go index 8230b3866..7019868d8 100644 --- a/create_partitions_request_test.go +++ b/create_partitions_request_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/create_partitions_response_test.go b/create_partitions_response_test.go index 83125a20e..8df0ad12e 100644 --- a/create_partitions_response_test.go +++ b/create_partitions_response_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/create_topics_request_test.go b/create_topics_request_test.go index daf223c53..d845aa38e 100644 --- a/create_topics_request_test.go +++ b/create_topics_request_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/create_topics_response_test.go b/create_topics_response_test.go index 8e92db331..58428bf8f 100644 --- a/create_topics_response_test.go +++ b/create_topics_response_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/delete_groups_request_test.go b/delete_groups_request_test.go index 908172498..8381829a0 100644 --- a/delete_groups_request_test.go +++ b/delete_groups_request_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import "testing" diff --git a/delete_groups_response_test.go b/delete_groups_response_test.go index 0bcfe5528..824f0217a 100644 --- a/delete_groups_response_test.go +++ b/delete_groups_response_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/delete_offsets_request_test.go b/delete_offsets_request_test.go index 0eea3fc9f..d04b8eab4 100644 --- a/delete_offsets_request_test.go +++ b/delete_offsets_request_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import "testing" diff --git a/delete_offsets_response_test.go b/delete_offsets_response_test.go index 8d069dbcb..17be3c86b 100644 --- a/delete_offsets_response_test.go +++ b/delete_offsets_response_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/delete_records_request_test.go b/delete_records_request_test.go index c72960cfb..aa79033b2 100644 --- a/delete_records_request_test.go +++ b/delete_records_request_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/delete_records_response_test.go b/delete_records_response_test.go index 3653cdc41..dc954947d 100644 --- a/delete_records_response_test.go +++ b/delete_records_response_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/delete_topics_request_test.go b/delete_topics_request_test.go index c313a2f3b..18a6bd0fe 100644 --- a/delete_topics_request_test.go +++ b/delete_topics_request_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/delete_topics_response_test.go b/delete_topics_response_test.go index 516f1a3bd..674faa2d1 100644 --- a/delete_topics_response_test.go +++ b/delete_topics_response_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/describe_client_quotas_request_test.go b/describe_client_quotas_request_test.go index 6b8c0c9c5..086c478f3 100644 --- a/describe_client_quotas_request_test.go +++ b/describe_client_quotas_request_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import "testing" diff --git a/describe_client_quotas_response_test.go b/describe_client_quotas_response_test.go index 6c681d11c..1c9d6d36c 100644 --- a/describe_client_quotas_response_test.go +++ b/describe_client_quotas_response_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import "testing" diff --git a/describe_configs_request_test.go b/describe_configs_request_test.go index b3a8d295a..649dc94d8 100644 --- a/describe_configs_request_test.go +++ b/describe_configs_request_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import "testing" diff --git a/describe_configs_response_test.go b/describe_configs_response_test.go index ea8f28e57..60c4a0810 100644 --- a/describe_configs_response_test.go +++ b/describe_configs_response_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/describe_groups_request_test.go b/describe_groups_request_test.go index a2d87b4b6..ff15637c3 100644 --- a/describe_groups_request_test.go +++ b/describe_groups_request_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import "testing" diff --git a/describe_groups_response_test.go b/describe_groups_response_test.go index 8930a2eb6..7370c8145 100644 --- a/describe_groups_response_test.go +++ b/describe_groups_response_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/describe_log_dirs_request_test.go b/describe_log_dirs_request_test.go index 65b88c685..250edc708 100644 --- a/describe_log_dirs_request_test.go +++ b/describe_log_dirs_request_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import "testing" diff --git a/describe_log_dirs_response_test.go b/describe_log_dirs_response_test.go index 5a1eb5b5e..646e6c293 100644 --- a/describe_log_dirs_response_test.go +++ b/describe_log_dirs_response_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/describe_user_scram_credentials_request_test.go b/describe_user_scram_credentials_request_test.go index 87e52bab6..f27921737 100644 --- a/describe_user_scram_credentials_request_test.go +++ b/describe_user_scram_credentials_request_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import "testing" diff --git a/describe_user_scram_credentials_response_test.go b/describe_user_scram_credentials_response_test.go index a251eaf7a..fcbe471a8 100644 --- a/describe_user_scram_credentials_response_test.go +++ b/describe_user_scram_credentials_response_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/elect_leaders_request_test.go b/elect_leaders_request_test.go index 0133c0cad..70fd1b914 100644 --- a/elect_leaders_request_test.go +++ b/elect_leaders_request_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import "testing" diff --git a/elect_leaders_response_test.go b/elect_leaders_response_test.go index 8768dfbb8..394037d95 100644 --- a/elect_leaders_response_test.go +++ b/elect_leaders_response_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import "testing" diff --git a/encoder_decoder_fuzz_test.go b/encoder_decoder_fuzz_test.go index 968fb1a29..1ccfadf22 100644 --- a/encoder_decoder_fuzz_test.go +++ b/encoder_decoder_fuzz_test.go @@ -1,4 +1,4 @@ -//go:build go1.18 +//go:build go1.18 && !functional package sarama diff --git a/end_txn_request_test.go b/end_txn_request_test.go index 6f5d4480e..a57d497ef 100644 --- a/end_txn_request_test.go +++ b/end_txn_request_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import "testing" diff --git a/end_txn_response_test.go b/end_txn_response_test.go index d7ae1c988..29c8052f4 100644 --- a/end_txn_response_test.go +++ b/end_txn_response_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/errors_test.go b/errors_test.go index 4efdd9d4e..7e0af00f4 100644 --- a/errors_test.go +++ b/errors_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/examples/http_server/http_server_test.go b/examples/http_server/http_server_test.go index 83d445196..6d299baf5 100644 --- a/examples/http_server/http_server_test.go +++ b/examples/http_server/http_server_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package main import ( diff --git a/fetch_request_test.go b/fetch_request_test.go index 3df2df125..d6647f34c 100644 --- a/fetch_request_test.go +++ b/fetch_request_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import "testing" diff --git a/fetch_response_test.go b/fetch_response_test.go index ab8959a9a..193790e4f 100644 --- a/fetch_response_test.go +++ b/fetch_response_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/find_coordinator_request_test.go b/find_coordinator_request_test.go index 7e889b074..697e87c45 100644 --- a/find_coordinator_request_test.go +++ b/find_coordinator_request_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import "testing" diff --git a/find_coordinator_response_test.go b/find_coordinator_response_test.go index 417a76c6e..55a62310a 100644 --- a/find_coordinator_response_test.go +++ b/find_coordinator_response_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/heartbeat_request_test.go b/heartbeat_request_test.go index fd62685b0..abcddf1be 100644 --- a/heartbeat_request_test.go +++ b/heartbeat_request_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/heartbeat_response_test.go b/heartbeat_response_test.go index c5d669e8f..071810c70 100644 --- a/heartbeat_response_test.go +++ b/heartbeat_response_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/helpers_test.go b/helpers_test.go new file mode 100644 index 000000000..1ccc69dd9 --- /dev/null +++ b/helpers_test.go @@ -0,0 +1,87 @@ +package sarama + +import ( + "io" + "strconv" + "sync" + "testing" + "time" +) + +func safeClose(t testing.TB, c io.Closer) { + t.Helper() + err := c.Close() + if err != nil { + t.Error(err) + } +} + +func closeProducerWithTimeout(t *testing.T, p AsyncProducer, timeout time.Duration) { + var wg sync.WaitGroup + p.AsyncClose() + + closer := make(chan struct{}) + timer := time.AfterFunc(timeout, func() { + t.Error("timeout") + close(closer) + }) + defer timer.Stop() + + wg.Add(2) + go func() { + defer wg.Done() + for { + select { + case <-closer: + return + case _, ok := <-p.Successes(): + if !ok { + return + } + t.Error("Unexpected message on Successes()") + } + } + }() + go func() { + defer wg.Done() + for { + select { + case <-closer: + return + case msg, ok := <-p.Errors(): + if !ok { + return + } + t.Error(msg.Err) + } + } + }() + wg.Wait() +} + +func closeProducer(t *testing.T, p AsyncProducer) { + closeProducerWithTimeout(t, p, 5*time.Minute) +} + +const TestMessage = "ABC THE MESSAGE" + +type appendInterceptor struct { + i int +} + +func (b *appendInterceptor) OnSend(msg *ProducerMessage) { + if b.i < 0 { + panic("hey, the interceptor has failed") + } + v, _ := msg.Value.Encode() + msg.Value = StringEncoder(string(v) + strconv.Itoa(b.i)) + b.i++ +} + +func (b *appendInterceptor) OnConsume(msg *ConsumerMessage) { + if b.i < 0 { + panic("hey, the interceptor has failed") + } + msg.Value = []byte(string(msg.Value) + strconv.Itoa(b.i)) + b.i++ +} diff --git a/incremental_alter_configs_request_test.go b/incremental_alter_configs_request_test.go index d239bf5f5..1b7d691ad 100644 --- a/incremental_alter_configs_request_test.go +++ b/incremental_alter_configs_request_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import "testing" diff --git a/incremental_alter_configs_response_test.go b/incremental_alter_configs_response_test.go index 697156709..0b7688b0b 100644 --- a/incremental_alter_configs_response_test.go +++ b/incremental_alter_configs_response_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/init_producer_id_request_test.go b/init_producer_id_request_test.go index 4214342e1..dea65c191 100644 --- a/init_producer_id_request_test.go +++ b/init_producer_id_request_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/init_producer_id_response_test.go b/init_producer_id_response_test.go index ebc5d16ad..545cde6c2 100644 --- a/init_producer_id_response_test.go +++ b/init_producer_id_response_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/join_group_request_test.go b/join_group_request_test.go index 2597b8669..eb13c7d2c 100644 --- a/join_group_request_test.go +++ b/join_group_request_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/join_group_response_test.go b/join_group_response_test.go index 9c9800b9a..e86602732 100644 --- a/join_group_response_test.go +++ b/join_group_response_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/kerberos_client_test.go b/kerberos_client_test.go index 6b14a6e44..c2a2e7f79 100644 --- a/kerberos_client_test.go +++ b/kerberos_client_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/leave_group_request_test.go b/leave_group_request_test.go index 4b8d482f7..6525f1280 100644 --- a/leave_group_request_test.go +++ b/leave_group_request_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/leave_group_response_test.go b/leave_group_response_test.go index 306c721a0..8969b78b3 100644 --- a/leave_group_response_test.go +++ b/leave_group_response_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/list_groups_request_test.go b/list_groups_request_test.go index fbb3bbd42..7eb784b1e 100644 --- a/list_groups_request_test.go +++ b/list_groups_request_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import "testing" diff --git a/list_groups_response_test.go b/list_groups_response_test.go index a7205f854..ad75c5faf 100644 --- a/list_groups_response_test.go +++ b/list_groups_response_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/list_partition_reassignments_request_test.go b/list_partition_reassignments_request_test.go index e50b289b9..c77806cdf 100644 --- a/list_partition_reassignments_request_test.go +++ b/list_partition_reassignments_request_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import "testing" diff --git a/list_partition_reassignments_response_test.go b/list_partition_reassignments_response_test.go index 71532423d..b32ed86a1 100644 --- a/list_partition_reassignments_response_test.go +++ b/list_partition_reassignments_response_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import "testing" diff --git a/logger_test.go b/logger_test.go index 1aa79c5ee..02514c205 100644 --- a/logger_test.go +++ b/logger_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import "testing" diff --git a/message_test.go b/message_test.go index 02d29134b..16cfec5e2 100644 --- a/message_test.go +++ b/message_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/metadata_request_test.go b/metadata_request_test.go index f99993032..9a26fa85b 100644 --- a/metadata_request_test.go +++ b/metadata_request_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import "testing" diff --git a/metadata_response_test.go b/metadata_response_test.go index 63c1d4801..ade2032bb 100644 --- a/metadata_response_test.go +++ b/metadata_response_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/metrics_helpers_test.go b/metrics_helpers_test.go new file mode 100644 index 000000000..14c5719e4 --- /dev/null +++ b/metrics_helpers_test.go @@ -0,0 +1,169 @@ +package sarama + +import ( + "testing" + + "github.com/rcrowley/go-metrics" +) + +// Common type and functions for metric validation +type metricValidator struct { + name string + validator func(*testing.T, interface{}) +} + +type metricValidators []*metricValidator + +func newMetricValidators() metricValidators { + return make([]*metricValidator, 0, 32) +} + +func (m *metricValidators) register(validator *metricValidator) { + *m = append(*m, validator) +} + +func (m *metricValidators) registerForBroker(broker *Broker, validator *metricValidator) { + m.register(&metricValidator{getMetricNameForBroker(validator.name, broker), validator.validator}) +} + +func (m *metricValidators) registerForGlobalAndTopic(topic string, validator *metricValidator) { + m.register(&metricValidator{validator.name, validator.validator}) + m.register(&metricValidator{getMetricNameForTopic(validator.name, topic), validator.validator}) +} + +func (m *metricValidators) registerForAllBrokers(broker *Broker, validator *metricValidator) { + m.register(validator) + m.registerForBroker(broker, validator) +} + +func (m metricValidators) run(t *testing.T, r metrics.Registry) { + t.Helper() + for _, metricValidator := range m { + metric := r.Get(metricValidator.name) + if metric == nil { + t.Error("No metric named", metricValidator.name) + } else { + metricValidator.validator(t, metric) + } + } +} + +func meterValidator(name string, extraValidator func(*testing.T, metrics.Meter)) *metricValidator { + return &metricValidator{ + name: name, + validator: func(t *testing.T, metric interface{}) { + t.Helper() + if meter, ok := metric.(metrics.Meter); !ok { + t.Errorf("Expected meter metric for '%s', got %T", name, metric) + } else { + extraValidator(t, meter) + } + }, + } +} + +func countMeterValidator(name string, expectedCount int) *metricValidator { + return meterValidator(name, func(t *testing.T, meter metrics.Meter) { + t.Helper() + count := meter.Count() + if count != int64(expectedCount) { + t.Errorf("Expected meter metric '%s' count = %d, got %d", name, expectedCount, count) + } + }) +} + +func minCountMeterValidator(name string, minCount int) *metricValidator { + return meterValidator(name, func(t *testing.T, meter metrics.Meter) { + t.Helper() + count := meter.Count() + if count < int64(minCount) { + t.Errorf("Expected meter metric '%s' count >= %d, got %d", name, minCount, count) + } + }) +} + +func histogramValidator(name string, extraValidator func(*testing.T, metrics.Histogram)) *metricValidator { + return &metricValidator{ + name: name, + validator: func(t *testing.T, metric interface{}) { + t.Helper() + if histogram, ok := metric.(metrics.Histogram); !ok { + t.Errorf("Expected histogram metric for '%s', got %T", name, metric) + } else { + extraValidator(t, histogram) + } + }, + } +} + +func countHistogramValidator(name string, expectedCount int) *metricValidator { + return histogramValidator(name, func(t *testing.T, histogram metrics.Histogram) { + t.Helper() + count := histogram.Count() + if count != int64(expectedCount) { + t.Errorf("Expected histogram metric '%s' count = %d, got %d", name, expectedCount, count) + } + }) +} + +func minCountHistogramValidator(name string, minCount int) *metricValidator { + return histogramValidator(name, func(t *testing.T, histogram metrics.Histogram) { + t.Helper() + count := histogram.Count() + if count < int64(minCount) { + t.Errorf("Expected histogram metric '%s' count >= %d, got %d", name, minCount, count) + } + }) +} + +//nolint:unused // this is used but only in unittests which are excluded by the integration build tag +func minMaxHistogramValidator(name string, expectedMin int, expectedMax int) *metricValidator { + return histogramValidator(name, func(t *testing.T, histogram metrics.Histogram) { + t.Helper() + min := int(histogram.Min()) + if min != expectedMin { + t.Errorf("Expected histogram metric '%s' min = %d, got %d", name, expectedMin, min) + } + max := int(histogram.Max()) + if max != expectedMax { + t.Errorf("Expected histogram metric '%s' max = %d, got %d", name, expectedMax, max) + } + }) +} + +func minValHistogramValidator(name string, minMin int) *metricValidator { + return histogramValidator(name, func(t *testing.T, histogram metrics.Histogram) { + t.Helper() + min := int(histogram.Min()) + if min < minMin { + t.Errorf("Expected histogram metric '%s' min >= %d, got %d", name, minMin, min) + } + }) +} + +func maxValHistogramValidator(name string, maxMax int) *metricValidator { + return histogramValidator(name, func(t *testing.T, histogram metrics.Histogram) { + t.Helper() + max := int(histogram.Max()) + if max > maxMax { + t.Errorf("Expected histogram metric '%s' max <= %d, got %d", name, maxMax, max) + } + }) +} + +func counterValidator(name string, expectedCount int) *metricValidator { + return &metricValidator{ + name: name, + validator: func(t *testing.T, metric interface{}) { + t.Helper() + if counter, ok := metric.(metrics.Counter); !ok { + t.Errorf("Expected counter metric for '%s', got %T", name, metric) + } else { + count := counter.Count() + if count != int64(expectedCount) { + t.Errorf("Expected counter metric '%s' count = %d, got %d", name, expectedCount, count) + } + } + }, + } +} diff --git a/metrics_test.go b/metrics_test.go index c9144df38..27edcc7bd 100644 --- a/metrics_test.go +++ b/metrics_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( @@ -36,164 +38,3 @@ func TestGetMetricNameForBroker(t *testing.T) { t.Error("Unexpected metric name", metricName) } } - -// Common type and functions for metric validation -type metricValidator struct { - name string - validator func(*testing.T, interface{}) -} - -type metricValidators []*metricValidator - -func newMetricValidators() metricValidators { - return make([]*metricValidator, 0, 32) -} - -func (m *metricValidators) register(validator *metricValidator) { - *m = append(*m, validator) -} - -func (m *metricValidators) registerForBroker(broker *Broker, validator *metricValidator) { - m.register(&metricValidator{getMetricNameForBroker(validator.name, broker), validator.validator}) -} - -func (m *metricValidators) registerForGlobalAndTopic(topic string, validator *metricValidator) { - m.register(&metricValidator{validator.name, validator.validator}) - m.register(&metricValidator{getMetricNameForTopic(validator.name, topic), validator.validator}) -} - -func (m *metricValidators) registerForAllBrokers(broker *Broker, validator *metricValidator) { - m.register(validator) - m.registerForBroker(broker, validator) -} - -func (m metricValidators) run(t *testing.T, r metrics.Registry) { - t.Helper() - for _, metricValidator := range m { - metric := r.Get(metricValidator.name) - if metric == nil { - t.Error("No metric named", metricValidator.name) - } else { - metricValidator.validator(t, metric) - } - } -} - -func meterValidator(name string, extraValidator func(*testing.T, metrics.Meter)) *metricValidator { - return &metricValidator{ - name: name, - validator: func(t *testing.T, metric interface{}) { - t.Helper() - if meter, ok := metric.(metrics.Meter); !ok { - t.Errorf("Expected meter metric for '%s', got %T", name, metric) - } else { - extraValidator(t, meter) - } - }, - } -} - -func countMeterValidator(name string, expectedCount int) *metricValidator { - return meterValidator(name, func(t *testing.T, meter metrics.Meter) { - t.Helper() - count := meter.Count() - if count != int64(expectedCount) { - t.Errorf("Expected meter metric '%s' count = %d, got %d", name, expectedCount, count) - } - }) -} - -func minCountMeterValidator(name string, minCount int) *metricValidator { - return meterValidator(name, func(t *testing.T, meter metrics.Meter) { - t.Helper() - count := meter.Count() - if count < int64(minCount) { - t.Errorf("Expected meter metric '%s' count >= %d, got %d", name, minCount, count) - } - }) -} - -func histogramValidator(name string, extraValidator func(*testing.T, metrics.Histogram)) *metricValidator { - return &metricValidator{ - name: name, - validator: func(t *testing.T, metric interface{}) { - t.Helper() - if histogram, ok := metric.(metrics.Histogram); !ok { - t.Errorf("Expected histogram metric for '%s', got %T", name, metric) - } else { - extraValidator(t, histogram) - } - }, - } -} - -func countHistogramValidator(name string, expectedCount int) *metricValidator { - return histogramValidator(name, func(t *testing.T, histogram metrics.Histogram) { - t.Helper() - count := histogram.Count() - if count != int64(expectedCount) { - t.Errorf("Expected histogram metric '%s' count = %d, got %d", name, expectedCount, count) - } - }) -} - -func minCountHistogramValidator(name string, minCount int) *metricValidator { - return histogramValidator(name, func(t *testing.T, histogram metrics.Histogram) { - t.Helper() - count := histogram.Count() - if count < int64(minCount) { - t.Errorf("Expected histogram metric '%s' count >= %d, got %d", name, minCount, count) - } - }) -} - -func minMaxHistogramValidator(name string, expectedMin int, expectedMax int) *metricValidator { - return histogramValidator(name, func(t *testing.T, histogram metrics.Histogram) { - t.Helper() - min := int(histogram.Min()) - if min != expectedMin { - t.Errorf("Expected histogram metric '%s' min = %d, got %d", name, expectedMin, min) - } - max := int(histogram.Max()) - if max != expectedMax { - t.Errorf("Expected histogram metric '%s' max = %d, got %d", name, expectedMax, max) - } - }) -} - -func minValHistogramValidator(name string, minMin int) *metricValidator { - return histogramValidator(name, func(t *testing.T, histogram metrics.Histogram) { - t.Helper() - min := int(histogram.Min()) - if min < minMin { - t.Errorf("Expected histogram metric '%s' min >= %d, got %d", name, minMin, min) - } - }) -} - -func maxValHistogramValidator(name string, maxMax int) *metricValidator { - return histogramValidator(name, func(t *testing.T, histogram metrics.Histogram) { - t.Helper() - max := int(histogram.Max()) - if max > maxMax { - t.Errorf("Expected histogram metric '%s' max <= %d, got %d", name, maxMax, max) - } - }) -} - -func counterValidator(name string, expectedCount int) *metricValidator { - return &metricValidator{ - name: name, - validator: func(t *testing.T, metric interface{}) { - t.Helper() - if counter, ok := metric.(metrics.Counter); !ok { - t.Errorf("Expected counter metric for '%s', got %T", name, metric) - } else { - count := counter.Count() - if count != int64(expectedCount) { - t.Errorf("Expected counter metric '%s' count = %d, got %d", name, expectedCount, count) - } - } - }, - } -} diff --git a/mocks/async_producer_test.go b/mocks/async_producer_test.go index e282109e2..5097cd606 100644 --- a/mocks/async_producer_test.go +++ b/mocks/async_producer_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package mocks import ( diff --git a/mocks/consumer_test.go b/mocks/consumer_test.go index 1d8659a3d..cbf81344e 100644 --- a/mocks/consumer_test.go +++ b/mocks/consumer_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package mocks import ( diff --git a/mocks/sync_producer_test.go b/mocks/sync_producer_test.go index f2e51cf5e..7919f8be3 100644 --- a/mocks/sync_producer_test.go +++ b/mocks/sync_producer_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package mocks import ( diff --git a/offset_commit_request_test.go b/offset_commit_request_test.go index 2731aacdb..76593e263 100644 --- a/offset_commit_request_test.go +++ b/offset_commit_request_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/offset_commit_response_test.go b/offset_commit_response_test.go index e0ad7c02c..0ac11549e 100644 --- a/offset_commit_response_test.go +++ b/offset_commit_response_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/offset_fetch_request_test.go b/offset_fetch_request_test.go index d4497a8b8..3716211de 100644 --- a/offset_fetch_request_test.go +++ b/offset_fetch_request_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/offset_fetch_response_test.go b/offset_fetch_response_test.go index 0676b0fc4..b756700f1 100644 --- a/offset_fetch_response_test.go +++ b/offset_fetch_response_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/offset_manager_test.go b/offset_manager_test.go index 971ed3a42..48c9ecb4b 100644 --- a/offset_manager_test.go +++ b/offset_manager_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/offset_request_test.go b/offset_request_test.go index 619680ea3..1301f5617 100644 --- a/offset_request_test.go +++ b/offset_request_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import "testing" diff --git a/offset_response_test.go b/offset_response_test.go index e46fc121e..2d5501630 100644 --- a/offset_response_test.go +++ b/offset_response_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/partitioner_test.go b/partitioner_test.go index 7d25db1d3..256cb820a 100644 --- a/partitioner_test.go +++ b/partitioner_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/produce_request_test.go b/produce_request_test.go index e8684ffd2..5c25f5860 100644 --- a/produce_request_test.go +++ b/produce_request_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/produce_response_test.go b/produce_response_test.go index 9018d5354..df745a608 100644 --- a/produce_response_test.go +++ b/produce_response_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/produce_set_test.go b/produce_set_test.go index 8f580c27d..c72a8dba6 100644 --- a/produce_set_test.go +++ b/produce_set_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/record_test.go b/record_test.go index aec5c848d..b8c48fcab 100644 --- a/record_test.go +++ b/record_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/records_test.go b/records_test.go index 621e4b32d..ee0ef6588 100644 --- a/records_test.go +++ b/records_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/request_test.go b/request_test.go index 70b09a89a..89bc89d46 100644 --- a/request_test.go +++ b/request_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/response_header_test.go b/response_header_test.go index c7c68eae7..b86daf18d 100644 --- a/response_header_test.go +++ b/response_header_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import "testing" diff --git a/sasl_authenticate_request_test.go b/sasl_authenticate_request_test.go index fd13a7c4a..a53388541 100644 --- a/sasl_authenticate_request_test.go +++ b/sasl_authenticate_request_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import "testing" diff --git a/sasl_authenticate_response_test.go b/sasl_authenticate_response_test.go index ed037ed08..48a1cf6ec 100644 --- a/sasl_authenticate_response_test.go +++ b/sasl_authenticate_response_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import "testing" diff --git a/sasl_handshake_request_test.go b/sasl_handshake_request_test.go index e100ad5b9..1fe2a7ab7 100644 --- a/sasl_handshake_request_test.go +++ b/sasl_handshake_request_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import "testing" diff --git a/sasl_handshake_response_test.go b/sasl_handshake_response_test.go index de289ca0d..598e8e0c1 100644 --- a/sasl_handshake_response_test.go +++ b/sasl_handshake_response_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/scram_formatter_test.go b/scram_formatter_test.go index b673a6a7d..fcccb396c 100644 --- a/scram_formatter_test.go +++ b/scram_formatter_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/sticky_assignor_user_data_test.go b/sticky_assignor_user_data_test.go index 9eb09a615..576738c30 100644 --- a/sticky_assignor_user_data_test.go +++ b/sticky_assignor_user_data_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/sync_group_request_test.go b/sync_group_request_test.go index 2eb23b03b..4fa301693 100644 --- a/sync_group_request_test.go +++ b/sync_group_request_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/sync_group_response_test.go b/sync_group_response_test.go index 8943153f6..be891fc0d 100644 --- a/sync_group_response_test.go +++ b/sync_group_response_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/sync_producer_test.go b/sync_producer_test.go index 776ae5f69..357a7d5b1 100644 --- a/sync_producer_test.go +++ b/sync_producer_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/transaction_manager_test.go b/transaction_manager_test.go index 6a9b04ab0..20a9e5ffa 100644 --- a/transaction_manager_test.go +++ b/transaction_manager_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/txn_offset_commit_request_test.go b/txn_offset_commit_request_test.go index 5dea31767..b59a7faee 100644 --- a/txn_offset_commit_request_test.go +++ b/txn_offset_commit_request_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import "testing" diff --git a/txn_offset_commit_response_test.go b/txn_offset_commit_response_test.go index b4caa69b9..570c712c2 100644 --- a/txn_offset_commit_response_test.go +++ b/txn_offset_commit_response_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import ( diff --git a/utils_test.go b/utils_test.go index dc487dd67..96b2c4b54 100644 --- a/utils_test.go +++ b/utils_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import "testing" diff --git a/zstd_test.go b/zstd_test.go index efdc6d83d..119772b1d 100644 --- a/zstd_test.go +++ b/zstd_test.go @@ -1,3 +1,5 @@ +//go:build !functional + package sarama import (