Skip to content

Commit

Permalink
Change uuid lib from google/uuid to gofrs/uuid
Browse files Browse the repository at this point in the history
  • Loading branch information
rutgerc-klarrio committed May 30, 2022
1 parent 0a4f6a4 commit 82b0156
Show file tree
Hide file tree
Showing 11 changed files with 71 additions and 70 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ require (
github.com/docker/leadership v0.1.0
github.com/docker/libkv v0.2.1
github.com/evanphx/json-patch v4.5.0+incompatible
github.com/gofrs/uuid v4.2.0+incompatible
github.com/golang/mock v1.4.0
github.com/google/go-cmp v0.4.0
github.com/google/uuid v1.3.0
github.com/hashicorp/consul/api v1.4.0
github.com/lib/pq v1.3.0
github.com/mattn/go-isatty v0.0.12
Expand Down
5 changes: 3 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ github.com/go-openapi/jsonreference v0.0.0-20160704190145-13c6e3589ad9/go.mod h1
github.com/go-openapi/spec v0.0.0-20160808142527-6aced65f8501/go.mod h1:J8+jY1nAiCcj+friV/PDoE1/3eeccG9LYBs0tYvLOWc=
github.com/go-openapi/swag v0.0.0-20160704191624-1d0bd113de87/go.mod h1:DXUve3Dpr1UfpPtxFw+EFuQ41HhCWZfha5jSVRG7C7I=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/gofrs/uuid v4.2.0+incompatible h1:yyYWMnhkhrKwwr8gAOcOCYxOOscHgDS9yZgBrnJfGa0=
github.com/gofrs/uuid v4.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d h1:3PaI8p3seN09VjbTYC/QWlUZdZ1qS1zGjy7LH2Wt07I=
Expand Down Expand Up @@ -126,9 +128,8 @@ github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXi
github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY=
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
github.com/googleapis/gnostic v0.0.0-20170729233727-0c5108395e2d h1:7XGaL1e6bYS1yIonGp9761ExpPPV1ui0SAC59Yube9k=
github.com/googleapis/gnostic v0.0.0-20170729233727-0c5108395e2d/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY=
Expand Down
6 changes: 3 additions & 3 deletions internal/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"reflect"
"strings"

"github.com/google/uuid"
"github.com/gofrs/uuid"
)

const (
Expand All @@ -50,12 +50,12 @@ var Roles = []Role{
}

func UID() string {
u := uuid.Must(uuid.NewRandom())
u := uuid.Must(uuid.NewV4())
return fmt.Sprintf("%x", u[:4])
}

func UUID() string {
return uuid.Must(uuid.NewRandom()).String()
return uuid.Must(uuid.NewV4()).String()
}

const (
Expand Down
16 changes: 8 additions & 8 deletions tests/integration/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
"github.com/sorintlab/stolon/internal/common"
"github.com/sorintlab/stolon/internal/store"

"github.com/google/uuid"
"github.com/gofrs/uuid"
)

func TestServerParameters(t *testing.T) {
Expand All @@ -52,7 +52,7 @@ func TestServerParameters(t *testing.T) {
storeEndpoints := fmt.Sprintf("%s:%s", tstore.listenAddress, tstore.port)
defer tstore.Stop()

clusterName := uuid.Must(uuid.NewRandom()).String()
clusterName := uuid.Must(uuid.NewV4()).String()

storePath := filepath.Join(common.StorePrefix, clusterName)

Expand Down Expand Up @@ -149,7 +149,7 @@ func TestWalLevel(t *testing.T) {
storeEndpoints := fmt.Sprintf("%s:%s", tstore.listenAddress, tstore.port)
defer tstore.Stop()

clusterName := uuid.Must(uuid.NewRandom()).String()
clusterName := uuid.Must(uuid.NewV4()).String()

storePath := filepath.Join(common.StorePrefix, clusterName)

Expand Down Expand Up @@ -264,7 +264,7 @@ func TestWalKeepSegments(t *testing.T) {
storeEndpoints := fmt.Sprintf("%s:%s", tstore.listenAddress, tstore.port)
defer tstore.Stop()

clusterName := uuid.Must(uuid.NewRandom()).String()
clusterName := uuid.Must(uuid.NewV4()).String()

storePath := filepath.Join(common.StorePrefix, clusterName)

Expand Down Expand Up @@ -437,7 +437,7 @@ func TestAlterSystem(t *testing.T) {
storeEndpoints := fmt.Sprintf("%s:%s", tstore.listenAddress, tstore.port)
defer tstore.Stop()

clusterName := uuid.Must(uuid.NewRandom()).String()
clusterName := uuid.Must(uuid.NewV4()).String()

storePath := filepath.Join(common.StorePrefix, clusterName)

Expand Down Expand Up @@ -509,7 +509,7 @@ func TestAdditionalReplicationSlots(t *testing.T) {
}
defer os.RemoveAll(dir)

clusterName := uuid.Must(uuid.NewRandom()).String()
clusterName := uuid.Must(uuid.NewV4()).String()

tks, tss, tp, tstore := setupServers(t, clusterName, dir, 2, 1, false, false, nil)
defer shutdown(tks, tss, tp, tstore)
Expand Down Expand Up @@ -658,7 +658,7 @@ func TestAutomaticPgRestart(t *testing.T) {
storeEndpoints := fmt.Sprintf("%s:%s", tstore.listenAddress, tstore.port)
defer tstore.Stop()

clusterName := uuid.Must(uuid.NewRandom()).String()
clusterName := uuid.Must(uuid.NewV4()).String()

storePath := filepath.Join(common.StorePrefix, clusterName)

Expand Down Expand Up @@ -782,7 +782,7 @@ func TestAdvertise(t *testing.T) {
storeEndpoints := fmt.Sprintf("%s:%s", tstore.listenAddress, tstore.port)
defer tstore.Stop()

clusterName := uuid.Must(uuid.NewRandom()).String()
clusterName := uuid.Must(uuid.NewV4()).String()

storePath := filepath.Join(common.StorePrefix, clusterName)

Expand Down
50 changes: 25 additions & 25 deletions tests/integration/ha_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
"testing"
"time"

"github.com/google/uuid"
"github.com/gofrs/uuid"
"github.com/sorintlab/stolon/internal/cluster"
"github.com/sorintlab/stolon/internal/common"
pg "github.com/sorintlab/stolon/internal/postgresql"
Expand Down Expand Up @@ -70,7 +70,7 @@ func TestInitWithMultipleKeepers(t *testing.T) {

storeEndpoints := fmt.Sprintf("%s:%s", tstore.listenAddress, tstore.port)

clusterName := uuid.Must(uuid.NewRandom()).String()
clusterName := uuid.Must(uuid.NewV4()).String()

storePath := filepath.Join(common.StorePrefix, clusterName)

Expand Down Expand Up @@ -333,7 +333,7 @@ func testMasterStandby(t *testing.T, syncRepl bool) {
}
defer os.RemoveAll(dir)

clusterName := uuid.Must(uuid.NewRandom()).String()
clusterName := uuid.Must(uuid.NewV4()).String()

tks, tss, tp, tstore := setupServers(t, clusterName, dir, 2, 1, syncRepl, false, nil)
defer shutdown(tks, tss, tp, tstore)
Expand Down Expand Up @@ -388,7 +388,7 @@ func testFailover(t *testing.T, syncRepl bool, standbyCluster bool) {
var ptk *TestKeeper
var primary *TestKeeper
if standbyCluster {
primaryClusterName := uuid.Must(uuid.NewRandom()).String()
primaryClusterName := uuid.Must(uuid.NewV4()).String()
ptks, ptss, ptp, ptstore := setupServers(t, primaryClusterName, dir, 1, 1, false, false, nil)
defer shutdown(ptks, ptss, ptp, ptstore)
for _, ptk = range ptks {
Expand All @@ -397,7 +397,7 @@ func testFailover(t *testing.T, syncRepl bool, standbyCluster bool) {
primary = ptk
}

clusterName := uuid.Must(uuid.NewRandom()).String()
clusterName := uuid.Must(uuid.NewV4()).String()

tks, tss, tp, tstore := setupServers(t, clusterName, dir, 2, 1, syncRepl, false, ptk)
defer shutdown(tks, tss, tp, tstore)
Expand Down Expand Up @@ -499,7 +499,7 @@ func testFailoverFailed(t *testing.T, syncRepl bool, standbyCluster bool) {
var ptk *TestKeeper
var primary *TestKeeper
if standbyCluster {
primaryClusterName := uuid.Must(uuid.NewRandom()).String()
primaryClusterName := uuid.Must(uuid.NewV4()).String()
ptks, ptss, ptp, ptstore := setupServers(t, primaryClusterName, dir, 1, 1, false, false, nil)
defer shutdown(ptks, ptss, ptp, ptstore)
for _, ptk = range ptks {
Expand All @@ -508,7 +508,7 @@ func testFailoverFailed(t *testing.T, syncRepl bool, standbyCluster bool) {
primary = ptk
}

clusterName := uuid.Must(uuid.NewRandom()).String()
clusterName := uuid.Must(uuid.NewV4()).String()

tks, tss, tp, tstore := setupServers(t, clusterName, dir, 2, 1, syncRepl, false, ptk)
defer shutdown(tks, tss, tp, tstore)
Expand Down Expand Up @@ -611,7 +611,7 @@ func testFailoverTooMuchLag(t *testing.T, standbyCluster bool) {
var ptk *TestKeeper
var primary *TestKeeper
if standbyCluster {
primaryClusterName := uuid.Must(uuid.NewRandom()).String()
primaryClusterName := uuid.Must(uuid.NewV4()).String()
ptks, ptss, ptp, ptstore := setupServers(t, primaryClusterName, dir, 1, 1, false, false, nil)
defer shutdown(ptks, ptss, ptp, ptstore)
for _, ptk = range ptks {
Expand All @@ -620,7 +620,7 @@ func testFailoverTooMuchLag(t *testing.T, standbyCluster bool) {
primary = ptk
}

clusterName := uuid.Must(uuid.NewRandom()).String()
clusterName := uuid.Must(uuid.NewV4()).String()

tks, tss, tp, tstore := setupServers(t, clusterName, dir, 2, 1, false, false, ptk)
defer shutdown(tks, tss, tp, tstore)
Expand Down Expand Up @@ -690,7 +690,7 @@ func testOldMasterRestart(t *testing.T, syncRepl, minSync0 bool, usePgrewind boo
var ptk *TestKeeper
var primary *TestKeeper
if standbyCluster {
primaryClusterName := uuid.Must(uuid.NewRandom()).String()
primaryClusterName := uuid.Must(uuid.NewV4()).String()
ptks, ptss, ptp, ptstore := setupServers(t, primaryClusterName, dir, 1, 1, false, false, nil)
defer shutdown(ptks, ptss, ptp, ptstore)
for _, ptk = range ptks {
Expand All @@ -699,7 +699,7 @@ func testOldMasterRestart(t *testing.T, syncRepl, minSync0 bool, usePgrewind boo
primary = ptk
}

clusterName := uuid.Must(uuid.NewRandom()).String()
clusterName := uuid.Must(uuid.NewV4()).String()

specOptions := []optionSetter{
withMinSync0(minSync0),
Expand Down Expand Up @@ -844,7 +844,7 @@ func testPartition1(t *testing.T, syncRepl, minSync0, usePgrewind bool, standbyC
var ptk *TestKeeper
var primary *TestKeeper
if standbyCluster {
primaryClusterName := uuid.Must(uuid.NewRandom()).String()
primaryClusterName := uuid.Must(uuid.NewV4()).String()
ptks, ptss, ptp, ptstore := setupServers(t, primaryClusterName, dir, 1, 1, false, false, nil)
defer shutdown(ptks, ptss, ptp, ptstore)
for _, ptk = range ptks {
Expand All @@ -853,7 +853,7 @@ func testPartition1(t *testing.T, syncRepl, minSync0, usePgrewind bool, standbyC
primary = ptk
}

clusterName := uuid.Must(uuid.NewRandom()).String()
clusterName := uuid.Must(uuid.NewV4()).String()

specOptions := []optionSetter{
withMinSync0(minSync0),
Expand Down Expand Up @@ -1010,7 +1010,7 @@ func testTimelineFork(t *testing.T, syncRepl, usePgrewind bool) {
}
defer os.RemoveAll(dir)

clusterName := uuid.Must(uuid.NewRandom()).String()
clusterName := uuid.Must(uuid.NewV4()).String()

tks, tss, tp, tstore := setupServers(t, clusterName, dir, 2, 1, syncRepl, usePgrewind, nil)
defer shutdown(tks, tss, tp, tstore)
Expand Down Expand Up @@ -1206,7 +1206,7 @@ func testMasterChangedAddress(t *testing.T, standbyCluster bool) {
var ptk *TestKeeper
var primary *TestKeeper
if standbyCluster {
primaryClusterName := uuid.Must(uuid.NewRandom()).String()
primaryClusterName := uuid.Must(uuid.NewV4()).String()
ptks, ptss, ptp, ptstore := setupServers(t, primaryClusterName, dir, 1, 1, false, false, nil)
defer shutdown(ptks, ptss, ptp, ptstore)
for _, ptk = range ptks {
Expand All @@ -1215,7 +1215,7 @@ func testMasterChangedAddress(t *testing.T, standbyCluster bool) {
primary = ptk
}

clusterName := uuid.Must(uuid.NewRandom()).String()
clusterName := uuid.Must(uuid.NewV4()).String()

tks, tss, tp, tstore := setupServers(t, clusterName, dir, 2, 1, false, false, ptk)
defer shutdown(tks, tss, tp, tstore)
Expand Down Expand Up @@ -1301,7 +1301,7 @@ func TestFailedStandby(t *testing.T) {
}
defer os.RemoveAll(dir)

clusterName := uuid.Must(uuid.NewRandom()).String()
clusterName := uuid.Must(uuid.NewV4()).String()

initialClusterSpec := &cluster.ClusterSpec{
InitMode: cluster.ClusterInitModeP(cluster.ClusterInitModeNew),
Expand Down Expand Up @@ -1392,7 +1392,7 @@ func TestLoweredMaxStandbysPerSender(t *testing.T) {
}
defer os.RemoveAll(dir)

clusterName := uuid.Must(uuid.NewRandom()).String()
clusterName := uuid.Must(uuid.NewV4()).String()

initialClusterSpec := &cluster.ClusterSpec{
InitMode: cluster.ClusterInitModeP(cluster.ClusterInitModeNew),
Expand Down Expand Up @@ -1457,7 +1457,7 @@ func TestKeeperRemoval(t *testing.T) {
}
defer os.RemoveAll(dir)

clusterName := uuid.Must(uuid.NewRandom()).String()
clusterName := uuid.Must(uuid.NewV4()).String()

initialClusterSpec := &cluster.ClusterSpec{
InitMode: cluster.ClusterInitModeP(cluster.ClusterInitModeNew),
Expand Down Expand Up @@ -1565,7 +1565,7 @@ func testKeeperRemovalStolonCtl(t *testing.T, syncRepl bool) {
}
defer os.RemoveAll(dir)

clusterName := uuid.Must(uuid.NewRandom()).String()
clusterName := uuid.Must(uuid.NewV4()).String()

initialClusterSpec := &cluster.ClusterSpec{
InitMode: cluster.ClusterInitModeP(cluster.ClusterInitModeNew),
Expand Down Expand Up @@ -1691,7 +1691,7 @@ func TestStandbyCantSync(t *testing.T) {
}
defer os.RemoveAll(dir)

clusterName := uuid.Must(uuid.NewRandom()).String()
clusterName := uuid.Must(uuid.NewV4()).String()

initialClusterSpec := &cluster.ClusterSpec{
InitMode: cluster.ClusterInitModeP(cluster.ClusterInitModeNew),
Expand Down Expand Up @@ -1821,7 +1821,7 @@ func TestDisappearedKeeperData(t *testing.T) {
}
defer os.RemoveAll(dir)

clusterName := uuid.Must(uuid.NewRandom()).String()
clusterName := uuid.Must(uuid.NewV4()).String()

tks, tss, tp, tstore := setupServers(t, clusterName, dir, 2, 1, false, false, nil)
defer shutdown(tks, tss, tp, tstore)
Expand Down Expand Up @@ -1905,7 +1905,7 @@ func testForceFail(t *testing.T, syncRepl bool, standbyCluster bool) {
var ptk *TestKeeper
var primary *TestKeeper
if standbyCluster {
primaryClusterName := uuid.Must(uuid.NewRandom()).String()
primaryClusterName := uuid.Must(uuid.NewV4()).String()
ptks, ptss, ptp, ptstore := setupServers(t, primaryClusterName, dir, 1, 1, false, false, nil)
defer shutdown(ptks, ptss, ptp, ptstore)
for _, ptk = range ptks {
Expand All @@ -1914,7 +1914,7 @@ func testForceFail(t *testing.T, syncRepl bool, standbyCluster bool) {
primary = ptk
}

clusterName := uuid.Must(uuid.NewRandom()).String()
clusterName := uuid.Must(uuid.NewV4()).String()

tks, tss, tp, tstore := setupServers(t, clusterName, dir, 2, 1, syncRepl, false, ptk)
defer shutdown(tks, tss, tp, tstore)
Expand Down Expand Up @@ -2017,7 +2017,7 @@ func testSyncStandbyNotInSync(t *testing.T, minSync0 bool) {
t.Fatalf("unexpected err: %v", err)
}
defer os.RemoveAll(dir)
clusterName := uuid.Must(uuid.NewRandom()).String()
clusterName := uuid.Must(uuid.NewV4()).String()
clusterOpts := []optionSetter{
withMinSync0(minSync0),
}
Expand Down
Loading

0 comments on commit 82b0156

Please sign in to comment.