Skip to content

Commit

Permalink
No apparent "problems"
Browse files Browse the repository at this point in the history
  • Loading branch information
otoolep committed Jan 3, 2024
1 parent e8570d7 commit 2f3b6ff
Show file tree
Hide file tree
Showing 18 changed files with 350 additions and 329 deletions.
5 changes: 3 additions & 2 deletions cluster/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"sync"
"time"

"github.com/rqlite/rqlite/v8/cluster/proto"
command "github.com/rqlite/rqlite/v8/command/proto"
"github.com/rqlite/rqlite/v8/random"
)
Expand Down Expand Up @@ -107,7 +108,7 @@ type Bootstrapper struct {
provider AddressProvider

client *Client
creds *Credentials
creds *proto.Credentials

logger *log.Logger
Interval time.Duration
Expand All @@ -128,7 +129,7 @@ func NewBootstrapper(p AddressProvider, client *Client) *Bootstrapper {
}

// SetCredentials sets the credentials for the Bootstrapper.
func (b *Bootstrapper) SetCredentials(creds *Credentials) {
func (b *Bootstrapper) SetCredentials(creds *proto.Credentials) {
b.creds = creds
}

Expand Down
27 changes: 14 additions & 13 deletions cluster/bootstrap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ import (
"testing"
"time"

"github.com/rqlite/rqlite/v8/cluster/proto"
"github.com/rqlite/rqlite/v8/cluster/servicetest"
"github.com/rqlite/rqlite/v8/command"
"google.golang.org/protobuf/proto"
command "github.com/rqlite/rqlite/v8/command/proto"
pb "google.golang.org/protobuf/proto"
)

func Test_AddressProviderString(t *testing.T) {
Expand Down Expand Up @@ -91,7 +92,7 @@ func Test_BootstrapperBootSingleJoin(t *testing.T) {
// Connection error handling
return
}
if c.Type != Command_COMMAND_TYPE_JOIN {
if c.Type != proto.Command_COMMAND_TYPE_JOIN {
t.Fatalf("unexpected command type: %d", c.Type)
}
jnr := c.GetJoinRequest()
Expand All @@ -102,7 +103,7 @@ func Test_BootstrapperBootSingleJoin(t *testing.T) {
t.Fatalf("unexpected node address, got %s", jnr.Address)
}

p, err = proto.Marshal(&CommandJoinResponse{})
p, err = pb.Marshal(&proto.CommandJoinResponse{})
if err != nil {
conn.Close()
return
Expand Down Expand Up @@ -139,7 +140,7 @@ func Test_BootstrapperBootNonVoter(t *testing.T) {
// Connection error handling
return
}
if c.Type != Command_COMMAND_TYPE_JOIN {
if c.Type != proto.Command_COMMAND_TYPE_JOIN {
t.Fatalf("unexpected command type: %d", c.Type)
}
jnr := c.GetJoinRequest()
Expand Down Expand Up @@ -183,12 +184,12 @@ func Test_BootstrapperBootSingleNotify(t *testing.T) {
return
}

if c.Type != Command_COMMAND_TYPE_NOTIFY {
if c.Type != proto.Command_COMMAND_TYPE_NOTIFY {
return
}
gotNR = c.GetNotifyRequest()

p, err = proto.Marshal(&CommandNotifyResponse{})
p, err = pb.Marshal(&proto.CommandNotifyResponse{})
if err != nil {
conn.Close()
return
Expand Down Expand Up @@ -237,16 +238,16 @@ func Test_BootstrapperBootMultiJoinNotify(t *testing.T) {
return
}

if c.Type == Command_COMMAND_TYPE_JOIN {
if c.Type == proto.Command_COMMAND_TYPE_JOIN {
atomic.AddInt32(&srv1JoinC, 1)
}

if c.Type != Command_COMMAND_TYPE_NOTIFY {
if c.Type != proto.Command_COMMAND_TYPE_NOTIFY {
return
}
atomic.AddInt32(&srv1NotifiedC, 1)

p, err = proto.Marshal(&CommandNotifyResponse{})
p, err = pb.Marshal(&proto.CommandNotifyResponse{})
if err != nil {
conn.Close()
return
Expand All @@ -268,16 +269,16 @@ func Test_BootstrapperBootMultiJoinNotify(t *testing.T) {
return
}

if c.Type == Command_COMMAND_TYPE_JOIN {
if c.Type == proto.Command_COMMAND_TYPE_JOIN {
atomic.AddInt32(&srv2JoinC, 1)
}

if c.Type != Command_COMMAND_TYPE_NOTIFY {
if c.Type != proto.Command_COMMAND_TYPE_NOTIFY {
return
}
atomic.AddInt32(&srv2NotifiedC, 1)

p, err = proto.Marshal(&CommandNotifyResponse{})
p, err = pb.Marshal(&proto.CommandNotifyResponse{})
if err != nil {
conn.Close()
return
Expand Down
Loading

0 comments on commit 2f3b6ff

Please sign in to comment.