Skip to content

Commit 1e048ac

Browse files
time.Duration() doesnt like float64, move to uint
1 parent 5079089 commit 1e048ac

File tree

3 files changed

+9
-11
lines changed

3 files changed

+9
-11
lines changed

pkg/config/vitess_config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ type VitessConfigurationSettings struct {
88
API string
99
Keyspace string
1010
Shard string
11-
TimeoutSecs float64
11+
TimeoutSecs uint
1212
}
1313

1414
func (settings *VitessConfigurationSettings) IsEmpty() bool {

pkg/vitess/api_client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
"vitess.io/vitess/go/vt/proto/topodata"
1313
)
1414

15-
const defaultTimeout = time.Duration(5.0) * time.Second
15+
const defaultTimeout = time.Duration(5) * time.Second
1616

1717
// Tablet represents information about a running instance of vttablet.
1818
type Tablet struct {

pkg/vitess/api_client_test.go

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func TestParseTablets(t *testing.T) {
5656
API: vitessApi.URL,
5757
Keyspace: "test",
5858
Shard: "00",
59-
TimeoutSecs: 1.0,
59+
TimeoutSecs: 1,
6060
})
6161
if err != nil {
6262
t.Fatalf("Expected no error, got %q", err)
@@ -77,10 +77,9 @@ func TestParseTablets(t *testing.T) {
7777

7878
t.Run("not-found", func(t *testing.T) {
7979
tablets, err := ParseTablets(config.VitessConfigurationSettings{
80-
API: vitessApi.URL,
81-
Keyspace: "not-found",
82-
Shard: "40-80",
83-
TimeoutSecs: 0.0,
80+
API: vitessApi.URL,
81+
Keyspace: "not-found",
82+
Shard: "40-80",
8483
})
8584
if err != nil {
8685
t.Fatalf("Expected no error, got %q", err)
@@ -98,10 +97,9 @@ func TestParseTablets(t *testing.T) {
9897
t.Run("failed", func(t *testing.T) {
9998
vitessApi.Close() // kill the mock vitess API
10099
_, err := ParseTablets(config.VitessConfigurationSettings{
101-
API: vitessApi.URL,
102-
Keyspace: "fail",
103-
Shard: "00",
104-
TimeoutSecs: 0.0,
100+
API: vitessApi.URL,
101+
Keyspace: "fail",
102+
Shard: "00",
105103
})
106104
if err == nil {
107105
t.Fatal("Expected error, got nil")

0 commit comments

Comments
 (0)