示例#1
0
func testStorageExtendNodeLock(storage cluster.Storage, t *testing.T) {
	node := cluster.Node{Address: "addr-xyz"}
	defer storage.RemoveNode("addr-xyz")
	err := storage.StoreNode(node)
	assertIsNil(err, t)
	locked, err := storage.LockNodeForHealing("addr-xyz", true, 200*time.Millisecond)
	assertIsNil(err, t)
	time.Sleep(300 * time.Millisecond)
	err = storage.ExtendNodeLock("addr-xyz", 200*time.Millisecond)
	assertIsNil(err, t)
	locked, err = storage.LockNodeForHealing("addr-xyz", true, 200*time.Millisecond)
	assertIsNil(err, t)
	if locked {
		t.Fatal("Expected LockNodeForHealing to return false after extending timeout")
	}
}