Skip to content

Commit

Permalink
tests/integration: address golangci var-naming issues
Browse files Browse the repository at this point in the history
Signed-off-by: Ivan Valdes <ivan@vald.es>
  • Loading branch information
ivanvc committed Mar 21, 2024
1 parent aeecfa0 commit 4898908
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions tests/integration/clientv3/concurrency/session_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/clientv3/naming/resolver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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'}
Expand Down Expand Up @@ -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.
Expand All @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/embed/embed_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
4 changes: 2 additions & 2 deletions tests/integration/v3_leadership_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions tests/integration/v3_lease_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
12 changes: 6 additions & 6 deletions tests/integration/v3_watch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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()))
Expand All @@ -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)
Expand Down

0 comments on commit 4898908

Please sign in to comment.