Beispiel #1
0
// TestHookLockSrvShardForAction makes sure that changes to the upstream
// topo.Server interface don't break our hook. For example, if someone changes
// the function name in the interface and all its call sites, but doesn't change
// the name of our override to match.
func TestHookLockSrvShardForAction(t *testing.T) {
	cells := []string{"test_cell"}
	ts := NewTestServer(t, cells)

	triggered := false
	ts.HookLockSrvShardForAction = func() {
		triggered = true
	}

	topo.Server(ts).LockSrvShardForAction(cells[0], "keyspace", "shard", "contents", 0, nil)

	if !triggered {
		t.Errorf("HookLockSrvShardForAction wasn't triggered")
	}
}
Beispiel #2
0
// TestHookLockSrvShardForAction makes sure that changes to the upstream
// topo.Server interface don't break our hook. For example, if someone changes
// the function name in the interface and all its call sites, but doesn't change
// the name of our override to match.
func TestHookLockSrvShardForAction(t *testing.T) {
	cells := []string{"test_cell"}
	ts := NewTestServer(t, cells)

	triggered := false
	ts.Impl.(*TestServer).HookLockSrvShardForAction = func() {
		triggered = true
	}

	ctx := context.Background()
	topo.Server(ts).LockSrvShardForAction(ctx, cells[0], "keyspace", "shard", "contents")

	if !triggered {
		t.Errorf("HookLockSrvShardForAction wasn't triggered")
	}
}