Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
ansiwen committed Sep 21, 2023
1 parent 305b88e commit 60a9e46
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
6 changes: 4 additions & 2 deletions rados/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,21 @@ func (c *Conn) Cluster() ClusterRef {

// PingMonitor sends a ping to a monitor and returns the reply.
func (c *Conn) PingMonitor(id string) (string, error) {
suite.T().Log("A")
cid := C.CString(id)
defer C.free(unsafe.Pointer(cid))

var strlen C.size_t
var strout *C.char

suite.T().Log("B")
ret := C.rados_ping_monitor(c.cluster, cid, &strout, &strlen)
defer C.rados_buffer_free(strout)

suite.T().Log("C")
if ret == 0 {
reply := C.GoStringN(strout, (C.int)(strlen))
return reply, nil
}
suite.T().Log("D")
runtime.KeepAlive(c.cluster)
return "", getError(ret)
}
Expand Down
6 changes: 0 additions & 6 deletions rados/rados_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -460,19 +460,13 @@ func (suite *RadosTestSuite) TestAAAPingMonitor() {
const N = 1000
for i := 0; i < N; i++ {
// mon id that should work with vstart.sh
suite.T().Log("A")
reply, err := suite.conn.PingMonitor("a")
suite.T().Log("B")
assert.NoError(suite.T(), err)
suite.T().Log("C")
assert.NotEqual(suite.T(), reply, "")
suite.T().Log("D")

// invalid mon id
reply, err = suite.conn.PingMonitor("charlieB")
suite.T().Log("E")
assert.Error(suite.T(), err)
suite.T().Log("F")
assert.Equal(suite.T(), reply, "")
}
}
Expand Down

0 comments on commit 60a9e46

Please sign in to comment.