make tests pass
parent
23de1b15aa
commit
0f6c75ab7d
|
@ -18,6 +18,7 @@ func TestServer_BackupAndRestore(t *testing.T) {
|
|||
config.Data.Dir, _ = ioutil.TempDir("", "data_backup")
|
||||
config.Meta.Dir, _ = ioutil.TempDir("", "meta_backup")
|
||||
config.Meta.BindAddress = freePort()
|
||||
config.Meta.HTTPBindAddress = freePort()
|
||||
|
||||
backupDir, _ := ioutil.TempDir("", "backup")
|
||||
defer os.RemoveAll(backupDir)
|
||||
|
@ -81,9 +82,6 @@ func TestServer_BackupAndRestore(t *testing.T) {
|
|||
if _, err := os.Stat(nodePath); err != nil || os.IsNotExist(err) {
|
||||
t.Fatalf("node.json should exist")
|
||||
}
|
||||
// Need to remove the restored node.json because the metaservers it points to are to the ephemeral ports
|
||||
// of itself. Opening the server below will hang indefinitely if we try to use them.
|
||||
os.RemoveAll(nodePath)
|
||||
|
||||
// now open it up and verify we're good
|
||||
s := OpenServer(config, "")
|
||||
|
|
|
@ -973,7 +973,7 @@ func TestMetaService_CreateDataNode(t *testing.T) {
|
|||
defer c.Close()
|
||||
|
||||
exp := &meta.NodeInfo{
|
||||
ID: 2,
|
||||
ID: 1,
|
||||
Host: "foo:8180",
|
||||
TCPHost: "bar:8281",
|
||||
}
|
||||
|
@ -1006,7 +1006,7 @@ func TestMetaService_DropDataNode(t *testing.T) {
|
|||
defer c.Close()
|
||||
|
||||
exp := &meta.NodeInfo{
|
||||
ID: 2,
|
||||
ID: 1,
|
||||
Host: "foo:8180",
|
||||
TCPHost: "bar:8281",
|
||||
}
|
||||
|
@ -1037,11 +1037,11 @@ func TestMetaService_DropDataNode(t *testing.T) {
|
|||
t.Fatal(err.Error())
|
||||
}
|
||||
|
||||
if !reflect.DeepEqual(sg.Shards[0].Owners, []meta.ShardOwner{{2}}) {
|
||||
t.Fatalf("expected owners to be [2]: %v", sg.Shards[0].Owners)
|
||||
if !reflect.DeepEqual(sg.Shards[0].Owners, []meta.ShardOwner{{1}}) {
|
||||
t.Fatalf("expected owners to be [1]: %v", sg.Shards[0].Owners)
|
||||
}
|
||||
|
||||
if res := c.ExecuteStatement(mustParseStatement("DROP DATA SERVER 2")); res.Err != nil {
|
||||
if res := c.ExecuteStatement(mustParseStatement("DROP DATA SERVER 1")); res.Err != nil {
|
||||
t.Fatal(res.Err.Error())
|
||||
}
|
||||
|
||||
|
@ -1169,6 +1169,7 @@ func TestMetaService_AcquireLease(t *testing.T) {
|
|||
t.Fatalf("owner ID wrong. exp %d got %d", n1.ID, l.Owner)
|
||||
}
|
||||
|
||||
t.Logf("c1: %d, c2: %d", c1.NodeID(), c2.NodeID())
|
||||
// Client 2 attempts to acquire the same lease. Should fail.
|
||||
l, err = c2.AcquireLease("foo")
|
||||
if err == nil {
|
||||
|
|
|
@ -548,7 +548,7 @@ func (fsm *storeFSM) applyCreateDataNodeCommand(cmd *internal.Command) interface
|
|||
other := fsm.data.Clone()
|
||||
|
||||
// Get the only meta node
|
||||
if len(other.MetaNodes) == 1 {
|
||||
if len(other.MetaNodes) == 1 && len(other.DataNodes) == 0 {
|
||||
metaNode := other.MetaNodes[0]
|
||||
|
||||
if err := other.setDataNode(metaNode.ID, v.GetHTTPAddr(), v.GetTCPAddr()); err != nil {
|
||||
|
|
Loading…
Reference in New Issue