Copilot commented on code in PR #1499:
URL: https://github.com/apache/pulsar-client-go/pull/1499#discussion_r3265444269


##########
pulsar/internal/batch_builder_test.go:
##########
@@ -0,0 +1,93 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package internal
+
+import (
+       "testing"
+       "time"
+
+       "github.com/apache/pulsar-client-go/pulsar/internal/compression"
+       pb "github.com/apache/pulsar-client-go/pulsar/internal/pulsar_proto"
+       "github.com/apache/pulsar-client-go/pulsar/log"
+       "github.com/prometheus/client_golang/prometheus"
+       "github.com/sirupsen/logrus"
+       "github.com/stretchr/testify/assert"
+       "github.com/stretchr/testify/require"
+       "google.golang.org/protobuf/proto"
+)
+
+func TestBatchBuilderAddsTxnIDToMessageMetadata(t *testing.T) {
+       batcher, err := NewBatchBuilder(
+               1000,
+               1000,
+               1000,
+               "test",
+               1,
+               pb.CompressionType_NONE,
+               compression.Level(0),
+               &bufferPoolImpl{},
+               NewMetricsProvider(2, map[string]string{}, 
prometheus.DefaultRegisterer),

Review Comment:
   Using `prometheus.DefaultRegisterer` in unit tests can make the test suite 
flaky due to cross-test metric registration collisions (especially when tests 
run in parallel or when multiple tests register the same metric names). Prefer 
using a per-test registry (e.g., `prometheus.NewRegistry()`) and pass that into 
`NewMetricsProvider` so each test has isolated metric state.



##########
pulsar/producer_test.go:
##########
@@ -81,6 +81,34 @@ func TestProducerConnectError(t *testing.T) {
        assert.ErrorContains(t, err, "connection error")
 }
 
+func TestUpdateMetaDataAddsTxnID(t *testing.T) {

Review Comment:
   Go naming conventions typically use `Metadata` rather than `MetaData`. 
Renaming this test to `TestUpdateMetadataAddsTxnID` would improve consistency 
and searchability.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to