Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
xuriwuyun committed Oct 24, 2023
1 parent 6e5d0e2 commit 4942c93
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
1 change: 1 addition & 0 deletions lorry/engines/etcd/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ func (mgr *Manager) IsDBStartupReady() bool {
cancel()
if err != nil {
mgr.Logger.Info("get etcd status failed", "error", err, "status", status)
return false
}

mgr.DBStartupReady = true
Expand Down
24 changes: 13 additions & 11 deletions lorry/engines/etcd/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,19 @@ var _ = Describe("ETCD DBManager", func() {
Expect(manager.IsDBStartupReady()).Should(BeTrue())
})

// It("it is not ready", func() {
// etcdServer, err := StartEtcdServer()
// Expect(err).Should(BeNil())
// etcdServer.Stop()
// testEndpoint := fmt.Sprintf("http://%s", etcdServer.ETCD.Clients[0].Addr().(*net.TCPAddr).String())
// manager := &Manager{
// etcd: etcdServer.client,
// endpoint: testEndpoint,
// }
// Expect(manager.IsDBStartupReady()).Should(BeFalse())
// })
It("it is not ready", func() {
etcdServer, err := StartEtcdServer()
Expect(err).Should(BeNil())
etcdServer.Stop()
testEndpoint := fmt.Sprintf("http://%s", etcdServer.ETCD.Clients[0].Addr().(*net.TCPAddr).String())
properties := engines.Properties{
"endpoint": testEndpoint,
}
manager, err := NewManager(properties)
Expect(err).Should(BeNil())
Expect(manager).ShouldNot(BeNil())
Expect(manager.IsDBStartupReady()).Should(BeFalse())
})
})

Context("get replica role", func() {
Expand Down

0 comments on commit 4942c93

Please sign in to comment.