Skip to content

Commit 332508d

Browse files
committed
deps(etcd) Update to new etcd client version v3.5.0, go mod friendly
1 parent 1c1060e commit 332508d

File tree

12 files changed

+135
-382
lines changed

12 files changed

+135
-382
lines changed

Diff for: etcd/client.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"os"
55

66
etcdutils "github.com/Scalingo/go-utils/etcd"
7-
"go.etcd.io/etcd/v3/clientv3"
7+
clientv3 "go.etcd.io/etcd/client/v3"
88

99
"github.com/pkg/errors"
1010
)

Diff for: etcd/watcher.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"context"
55

66
"github.com/pkg/errors"
7-
"go.etcd.io/etcd/v3/clientv3"
7+
clientv3 "go.etcd.io/etcd/client/v3"
88
)
99

1010
type Watcher struct {

Diff for: go.mod

+15-4
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,22 @@ go 1.15
44

55
require (
66
github.com/Microsoft/go-winio v0.4.16 // indirect
7-
github.com/Scalingo/go-etcd-lock/v5 v5.0.4
7+
github.com/Scalingo/go-etcd-lock/v5 v5.0.5
88
github.com/Scalingo/go-handlers v1.4.0
99
github.com/Scalingo/go-plugins-helpers v1.3.0
10-
github.com/Scalingo/go-utils/etcd v1.0.1
10+
github.com/Scalingo/go-utils/etcd v1.1.0
1111
github.com/Scalingo/go-utils/graceful v1.0.0
1212
github.com/Scalingo/go-utils/logger v1.0.0
13+
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e // indirect
14+
github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect
1315
github.com/docker/docker v1.13.1
1416
github.com/docker/go-connections v0.4.0 // indirect
1517
github.com/docker/go-plugins-helpers v0.0.0-20200102110956-c9a8a2d92ccc // indirect
1618
github.com/docker/libnetwork v0.8.0-dev.2.0.20171213192018-26531e56a76d
1719
github.com/gofrs/uuid v3.4.0+incompatible
1820
github.com/golang/mock v1.6.0
1921
github.com/kelseyhightower/envconfig v1.4.0
22+
github.com/kr/text v0.2.0 // indirect
2023
github.com/magefile/mage v1.11.0
2124
github.com/pkg/errors v0.9.1
2225
github.com/sirupsen/logrus v1.8.1
@@ -25,9 +28,17 @@ require (
2528
github.com/vishvananda/netlink v1.0.0
2629
github.com/vishvananda/netns v0.0.0-20210104183010-2eb08e3e575f
2730
github.com/willf/bitset v1.1.11
28-
go.etcd.io/etcd/v3 v3.3.0-rc.0.0.20200826232710-c20cc05fc548
31+
go.etcd.io/etcd/api/v3 v3.5.0
32+
go.etcd.io/etcd/client/v3 v3.5.0
33+
go.uber.org/atomic v1.9.0 // indirect
34+
go.uber.org/multierr v1.7.0 // indirect
35+
go.uber.org/zap v1.18.1 // indirect
36+
golang.org/x/net v0.0.0-20210726213435-c6fcb2dbf985 // indirect
37+
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c // indirect
38+
google.golang.org/genproto v0.0.0-20210729151513-df9385d47c1b // indirect
2939
// This shouldn't be upgraded as long as go.etcd.io/etcd/v3 has not been updated.
3040
// Waiting for etcd 3.5 release: https://github.com/etcd-io/etcd/issues/12124
31-
google.golang.org/grpc v1.29.1
41+
google.golang.org/grpc v1.39.0
3242
gopkg.in/errgo.v1 v1.0.1
43+
gopkg.in/yaml.v2 v2.4.0 // indirect
3344
)

Diff for: go.sum

+95-353
Large diffs are not rendered by default.

Diff for: network/overlay/listener.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import (
66
"encoding/json"
77
"sync"
88

9-
"go.etcd.io/etcd/v3/clientv3"
10-
"go.etcd.io/etcd/v3/mvcc/mvccpb"
9+
"go.etcd.io/etcd/api/v3/mvccpb"
10+
"go.etcd.io/etcd/client/v3"
1111

1212
"github.com/Scalingo/go-utils/logger"
1313
"github.com/Scalingo/sand/api/types"

Diff for: network/overlay/listener_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import (
55
"testing"
66
"time"
77

8-
"go.etcd.io/etcd/v3/clientv3"
9-
"go.etcd.io/etcd/v3/mvcc/mvccpb"
8+
"go.etcd.io/etcd/api/v3/mvccpb"
9+
clientv3 "go.etcd.io/etcd/client/v3"
1010

1111
"github.com/Scalingo/sand/api/types"
1212
"github.com/Scalingo/sand/config"

Diff for: store/etcd.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package store
33
import (
44
"io"
55

6-
"go.etcd.io/etcd/v3/clientv3"
6+
clientv3 "go.etcd.io/etcd/client/v3"
77

88
"github.com/Scalingo/sand/etcd"
99
"github.com/pkg/errors"

Diff for: store/etcd_watcher_mock.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: store/store.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"encoding/json"
77
"reflect"
88

9-
"go.etcd.io/etcd/v3/clientv3"
9+
clientv3 "go.etcd.io/etcd/client/v3"
1010

1111
"github.com/Scalingo/go-utils/logger"
1212
"github.com/Scalingo/sand/config"

Diff for: store/storemock/registration_mock.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: store/watcher.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import (
55
"strings"
66
"sync"
77

8-
"go.etcd.io/etcd/v3/clientv3"
9-
"go.etcd.io/etcd/v3/etcdserver/api/v3rpc/rpctypes"
8+
"go.etcd.io/etcd/api/v3/v3rpc/rpctypes"
9+
clientv3 "go.etcd.io/etcd/client/v3"
1010
"google.golang.org/grpc/codes"
1111

1212
"github.com/Scalingo/go-utils/logger"

Diff for: store/watcher_test.go

+13-13
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,20 @@ import (
99
"github.com/golang/mock/gomock"
1010
"github.com/stretchr/testify/assert"
1111
"github.com/stretchr/testify/require"
12-
"go.etcd.io/etcd/v3/clientv3"
13-
"go.etcd.io/etcd/v3/mvcc/mvccpb"
12+
"go.etcd.io/etcd/api/v3/mvccpb"
13+
"go.etcd.io/etcd/client/v3"
1414
)
1515

1616
func TestWatcher_Register(t *testing.T) {
1717
cases := map[string]struct {
1818
registrationKey string
19-
expect func(t *testing.T, w Watcher, in chan clientv3.WatchResponse, r Registration)
19+
expect func(t *testing.T, w Watcher, in chan client.WatchResponse, r Registration)
2020
}{
2121
"it should get an event impacting a subkey": {
2222
registrationKey: "/prefix/subkey1",
23-
expect: func(t *testing.T, w Watcher, in chan clientv3.WatchResponse, r Registration) {
24-
in <- clientv3.WatchResponse{
25-
Events: []*clientv3.Event{{
23+
expect: func(t *testing.T, w Watcher, in chan client.WatchResponse, r Registration) {
24+
in <- client.WatchResponse{
25+
Events: []*client.Event{{
2626
Kv: &mvccpb.KeyValue{Key: []byte("/sc-net/prefix/subkey1/key1")},
2727
Type: mvccpb.PUT,
2828
}},
@@ -34,11 +34,11 @@ func TestWatcher_Register(t *testing.T) {
3434
},
3535
"it should not get an event after unregistration": {
3636
registrationKey: "/prefix/subkey2",
37-
expect: func(t *testing.T, w Watcher, in chan clientv3.WatchResponse, r Registration) {
37+
expect: func(t *testing.T, w Watcher, in chan client.WatchResponse, r Registration) {
3838
r.Unregister()
3939
// buffered chan, non blocking operation
40-
in <- clientv3.WatchResponse{
41-
Events: []*clientv3.Event{{Kv: &mvccpb.KeyValue{}}},
40+
in <- client.WatchResponse{
41+
Events: []*client.Event{{Kv: &mvccpb.KeyValue{}}},
4242
}
4343
select {
4444
case _, ok := <-r.EventChan():
@@ -50,8 +50,8 @@ func TestWatcher_Register(t *testing.T) {
5050
},
5151
"it should log an error and keep on listening until the chan is closed": {
5252
registrationKey: "/prefix/subkey3",
53-
expect: func(t *testing.T, w Watcher, in chan clientv3.WatchResponse, r Registration) {
54-
in <- clientv3.WatchResponse{
53+
expect: func(t *testing.T, w Watcher, in chan client.WatchResponse, r Registration) {
54+
in <- client.WatchResponse{
5555
Canceled: true,
5656
}
5757
select {
@@ -69,9 +69,9 @@ func TestWatcher_Register(t *testing.T) {
6969
defer ctrl.Finish()
7070

7171
etcdWatcher := NewMockEtcdWatcher(ctrl)
72-
incomingEvents := make(chan clientv3.WatchResponse, 1)
72+
incomingEvents := make(chan client.WatchResponse, 1)
7373

74-
etcdWatcher.EXPECT().WatchChan().Return(clientv3.WatchChan(incomingEvents))
74+
etcdWatcher.EXPECT().WatchChan().Return(client.WatchChan(incomingEvents))
7575
etcdWatcher.EXPECT().Close().Return(nil)
7676

7777
config, err := config.Build()

0 commit comments

Comments
 (0)