Skip to content

Commit

Permalink
etcdserver, wal: Fix tests that were performing unintended casting of…
Browse files Browse the repository at this point in the history
… int to String.

Fixes following problems during "./etcd# go test ./..."

> go.etcd.io/etcd/v3/etcdserver/api/v2store_test
etcdserver/api/v2store/store_test.go:847:24: conversion from int to string yields a string of one rune, not a string of digits (did you mean fmt.Sprint(x)?)

> go.etcd.io/etcd/v3/wal
wal/wal_test.go:242:68: conversion from int to string yields a string of one rune, not a string of digits (did you mean fmt.Sprint(x)?)
  • Loading branch information
ptabor committed Aug 4, 2020
1 parent 1af6d61 commit 00de56a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion etcdserver/api/v2store/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package v2store_test

import (
"fmt"
"testing"
"time"

Expand Down Expand Up @@ -844,7 +845,7 @@ func TestStoreWatchSlowConsumer(t *testing.T) {
s.Watch("/foo", true, true, 0) // stream must be true
// Fill watch channel with 100 events
for i := 1; i <= 100; i++ {
s.Set("/foo", false, string(i), v2store.TTLOptionSet{ExpireTime: v2store.Permanent}) // ok
s.Set("/foo", false, fmt.Sprint(i), v2store.TTLOptionSet{ExpireTime: v2store.Permanent}) // ok
}
// testutil.AssertEqual(t, s.WatcherHub.count, int64(1))
s.Set("/foo", false, "101", v2store.TTLOptionSet{ExpireTime: v2store.Permanent}) // ok
Expand Down
2 changes: 1 addition & 1 deletion wal/wal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ func TestVerify(t *testing.T) {

// make 5 separate files
for i := 0; i < 5; i++ {
es := []raftpb.Entry{{Index: uint64(i), Data: []byte("waldata" + string(i+1))}}
es := []raftpb.Entry{{Index: uint64(i), Data: []byte(fmt.Sprintf("waldata%d", i+1))}}
if err = w.Save(raftpb.HardState{}, es); err != nil {
t.Fatal(err)
}
Expand Down

0 comments on commit 00de56a

Please sign in to comment.