From 4898908268c50eca92f88ce9d8190278fbaed13e Mon Sep 17 00:00:00 2001 From: Ivan Valdes Date: Wed, 20 Mar 2024 22:31:31 -0700 Subject: [PATCH] tests/integration: address golangci var-naming issues Signed-off-by: Ivan Valdes --- .../integration/clientv3/concurrency/session_test.go | 4 ++-- tests/integration/clientv3/naming/resolver_test.go | 6 +++--- tests/integration/embed/embed_test.go | 4 ++-- tests/integration/v3_leadership_test.go | 4 ++-- tests/integration/v3_lease_test.go | 8 ++++---- tests/integration/v3_watch_test.go | 12 ++++++------ 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/tests/integration/clientv3/concurrency/session_test.go b/tests/integration/clientv3/concurrency/session_test.go index c1ab0f6d2b9..d8c905384f3 100644 --- a/tests/integration/clientv3/concurrency/session_test.go +++ b/tests/integration/clientv3/concurrency/session_test.go @@ -65,9 +65,9 @@ func TestSessionTTLOptions(t *testing.T) { } defer s.Close() - leaseId := s.Lease() + leaseID := s.Lease() // TTL retrieved should be less than the set TTL, but not equal to default:60 or exprired:-1 - resp, err := cli.Lease.TimeToLive(context.Background(), leaseId) + resp, err := cli.Lease.TimeToLive(context.Background(), leaseID) if err != nil { t.Log(err) } diff --git a/tests/integration/clientv3/naming/resolver_test.go b/tests/integration/clientv3/naming/resolver_test.go index effb0b74efb..527be0334b5 100644 --- a/tests/integration/clientv3/naming/resolver_test.go +++ b/tests/integration/clientv3/naming/resolver_test.go @@ -32,7 +32,7 @@ import ( integration2 "go.etcd.io/etcd/tests/v3/framework/integration" ) -func testEtcdGrpcResolver(t *testing.T, lbPolicy string) { +func testEtcdGRPCResolver(t *testing.T, lbPolicy string) { // Setup two new dummy stub servers payloadBody := []byte{'1'} @@ -137,7 +137,7 @@ func TestEtcdGrpcResolverPickFirst(t *testing.T) { integration2.BeforeTest(t) // Pick first is the default load balancer policy for grpc-go - testEtcdGrpcResolver(t, "pick_first") + testEtcdGRPCResolver(t, "pick_first") } // TestEtcdGrpcResolverRoundRobin mimics scenarios described in grpc_naming.md doc. @@ -146,7 +146,7 @@ func TestEtcdGrpcResolverRoundRobin(t *testing.T) { integration2.BeforeTest(t) // Round robin is a common alternative for more production oriented scenarios - testEtcdGrpcResolver(t, "round_robin") + testEtcdGRPCResolver(t, "round_robin") } func TestEtcdEndpointManager(t *testing.T) { diff --git a/tests/integration/embed/embed_test.go b/tests/integration/embed/embed_test.go index 7cdb42934b8..6b35bf57ebf 100644 --- a/tests/integration/embed/embed_test.go +++ b/tests/integration/embed/embed_test.go @@ -224,7 +224,7 @@ func TestEmbedEtcdAutoCompactionRetentionRetained(t *testing.T) { e, err := embed.StartEtcd(cfg) assert.NoError(t, err) autoCompactionRetention := e.Server.Cfg.AutoCompactionRetention - duration_to_compare, _ := time.ParseDuration("2h0m0s") - assert.Equal(t, duration_to_compare, autoCompactionRetention) + durationToCompare, _ := time.ParseDuration("2h0m0s") + assert.Equal(t, durationToCompare, autoCompactionRetention) e.Close() } diff --git a/tests/integration/v3_leadership_test.go b/tests/integration/v3_leadership_test.go index 8bc8737ab14..aa1cd8ddc9c 100644 --- a/tests/integration/v3_leadership_test.go +++ b/tests/integration/v3_leadership_test.go @@ -195,14 +195,14 @@ func TestFirstCommitNotification(t *testing.T) { oldLeaderClient := cluster.Client(oldLeaderIdx) newLeaderIdx := (oldLeaderIdx + 1) % clusterSize - newLeaderId := uint64(cluster.Members[newLeaderIdx].ID()) + newLeaderID := uint64(cluster.Members[newLeaderIdx].ID()) notifiers := make(map[int]<-chan struct{}, clusterSize) for i, clusterMember := range cluster.Members { notifiers[i] = clusterMember.Server.FirstCommitInTermNotify() } - _, err := oldLeaderClient.MoveLeader(context.Background(), newLeaderId) + _, err := oldLeaderClient.MoveLeader(context.Background(), newLeaderID) if err != nil { t.Errorf("got error during leadership transfer: %v", err) diff --git a/tests/integration/v3_lease_test.go b/tests/integration/v3_lease_test.go index 0be08b6df7b..8e7b16e6981 100644 --- a/tests/integration/v3_lease_test.go +++ b/tests/integration/v3_lease_test.go @@ -389,15 +389,15 @@ func TestV3LeaseCheckpoint(t *testing.T) { time.Sleep(tc.checkpointingInterval + 1*time.Second) // Force a leader election - leaderId := clus.WaitLeader(t) - leader := clus.Members[leaderId] + leaderID := clus.WaitLeader(t) + leader := clus.Members[leaderID] leader.Stop(t) time.Sleep(time.Duration(3*integration.ElectionTicks) * framecfg.TickDuration) leader.Restart(t) } - newLeaderId := clus.WaitLeader(t) - c2 := integration.ToGRPC(clus.Client(newLeaderId)) + newLeaderID := clus.WaitLeader(t) + c2 := integration.ToGRPC(clus.Client(newLeaderID)) time.Sleep(250 * time.Millisecond) diff --git a/tests/integration/v3_watch_test.go b/tests/integration/v3_watch_test.go index fe41a27c151..b8bd89e4145 100644 --- a/tests/integration/v3_watch_test.go +++ b/tests/integration/v3_watch_test.go @@ -243,7 +243,7 @@ func TestV3WatchFromCurrentRevision(t *testing.T) { t.Fatalf("#%d: canceled watcher on create %+v", i, cresp) } - createdWatchId := cresp.WatchId + createdWatchID := cresp.WatchId if cresp.Header == nil || cresp.Header.Revision != 1 { t.Fatalf("#%d: header revision got +%v, wanted revison 1", i, cresp) } @@ -278,8 +278,8 @@ func TestV3WatchFromCurrentRevision(t *testing.T) { if wresp.Created != resp.Created { t.Errorf("#%d.%d: resp.Created got = %v, want = %v", i, j, resp.Created, wresp.Created) } - if resp.WatchId != createdWatchId { - t.Errorf("#%d.%d: resp.WatchId got = %d, want = %d", i, j, resp.WatchId, createdWatchId) + if resp.WatchId != createdWatchID { + t.Errorf("#%d.%d: resp.WatchId got = %d, want = %d", i, j, resp.WatchId, createdWatchID) } if !reflect.DeepEqual(resp.Events, wresp.Events) { @@ -1445,8 +1445,8 @@ func TestV3WatchProgressWaitsForSync(t *testing.T) { // Verify that we get the watch responses first. Note that // events might be spread across multiple packets. - var event_count = 0 - for event_count < count { + eventCount := 0 + for eventCount < count { wr := <-wch if wr.Err() != nil { t.Fatal(fmt.Errorf("watch error: %w", wr.Err())) @@ -1457,7 +1457,7 @@ func TestV3WatchProgressWaitsForSync(t *testing.T) { if wr.Header.Revision != int64(count+1) { t.Fatal("Incomplete watch response!") } - event_count += len(wr.Events) + eventCount += len(wr.Events) } // client needs to request progress notification again err = client.RequestProgress(ctx)