Beispiel #1
0
func agentRpcTestReloadSchema(ctx context.Context, t *testing.T, client tmclient.TabletManagerClient, ti *topo.TabletInfo) {
	err := client.ReloadSchema(ctx, ti)
	if err != nil {
		t.Errorf("ReloadSchema failed: %v", err)
	}
	if !testReloadSchemaCalled {
		t.Errorf("ReloadSchema didn't call the server side")
	}
}
Beispiel #2
0
func agentRpcTestRestore(ctx context.Context, t *testing.T, client tmclient.TabletManagerClient, ti *topo.TabletInfo) {
	logChannel, errFunc, err := client.Restore(ctx, ti, testRestoreArgs, time.Minute)
	if err != nil {
		t.Fatalf("Restore failed: %v", err)
	}
	compareLoggedStuff(t, "Restore", logChannel, 10)
	err = errFunc()
	compareError(t, "Restore", err, true, testRestoreCalled)
}
Beispiel #3
0
func agentRpcTestSnapshot(ctx context.Context, t *testing.T, client tmclient.TabletManagerClient, ti *topo.TabletInfo) {
	logChannel, errFunc, err := client.Snapshot(ctx, ti, testSnapshotArgs, time.Minute)
	if err != nil {
		t.Fatalf("Snapshot failed: %v", err)
	}
	compareLoggedStuff(t, "Snapshot", logChannel, 0)
	sr, err := errFunc()
	compareError(t, "Snapshot", err, sr, testSnapshotReply)
}
Beispiel #4
0
func agentRpcTestSetReadOnly(ctx context.Context, t *testing.T, client tmclient.TabletManagerClient, ti *topo.TabletInfo) {
	testSetReadOnlyExpectedValue = true
	err := client.SetReadOnly(ctx, ti)
	if err != nil {
		t.Errorf("SetReadOnly failed: %v", err)
	}
	testSetReadOnlyExpectedValue = false
	err = client.SetReadWrite(ctx, ti)
	if err != nil {
		t.Errorf("SetReadWrite failed: %v", err)
	}
}
Beispiel #5
0
func agentRpcTestRunBlpUntil(ctx context.Context, t *testing.T, client tmclient.TabletManagerClient, ti *topo.TabletInfo) {
	rp, err := client.RunBlpUntil(ctx, ti, testBlpPositionList, testRunBlpUntilWaitTime)
	compareError(t, "RunBlpUntil", err, rp, testReplicationPosition)
}
Beispiel #6
0
func agentRpcTestStopBlp(ctx context.Context, t *testing.T, client tmclient.TabletManagerClient, ti *topo.TabletInfo) {
	bpl, err := client.StopBlp(ctx, ti)
	compareError(t, "StopBlp", err, bpl, testBlpPositionList)
}
Beispiel #7
0
func agentRpcTestStartBlp(ctx context.Context, t *testing.T, client tmclient.TabletManagerClient, ti *topo.TabletInfo) {
	err := client.StartBlp(ctx, ti)
	compareError(t, "StartBlp", err, true, testStartBlpCalled)
}
Beispiel #8
0
func agentRpcTestRunHealthCheck(ctx context.Context, t *testing.T, client tmclient.TabletManagerClient, ti *topo.TabletInfo) {
	err := client.RunHealthCheck(ctx, ti, testRunHealthCheckValue)
	if err != nil {
		t.Errorf("RunHealthCheck failed: %v", err)
	}
}
Beispiel #9
0
func agentRpcTestWaitBlpPosition(ctx context.Context, t *testing.T, client tmclient.TabletManagerClient, ti *topo.TabletInfo) {
	err := client.WaitBlpPosition(ctx, ti, *testBlpPosition, testWaitBlpPositionWaitTime)
	compareError(t, "WaitBlpPosition", err, true, testWaitBlpPositionCalled)
}
Beispiel #10
0
func agentRpcTestSlaveWasPromoted(ctx context.Context, t *testing.T, client tmclient.TabletManagerClient, ti *topo.TabletInfo) {
	err := client.SlaveWasPromoted(ctx, ti)
	compareError(t, "SlaveWasPromoted", err, true, testSlaveWasPromotedCalled)
}
Beispiel #11
0
func agentRpcTestBreakSlaves(ctx context.Context, t *testing.T, client tmclient.TabletManagerClient, ti *topo.TabletInfo) {
	err := client.BreakSlaves(ctx, ti)
	compareError(t, "BreakSlaves", err, true, testBreakSlavesCalled)
}
Beispiel #12
0
func agentRpcTestMasterPosition(ctx context.Context, t *testing.T, client tmclient.TabletManagerClient, ti *topo.TabletInfo) {
	rs, err := client.MasterPosition(ctx, ti)
	compareError(t, "MasterPosition", err, rs, testReplicationPosition)
}
Beispiel #13
0
func agentRpcTestReparentPosition(ctx context.Context, t *testing.T, client tmclient.TabletManagerClient, ti *topo.TabletInfo) {
	rsd, err := client.ReparentPosition(ctx, ti, &testReplicationPosition)
	compareError(t, "ReparentPosition", err, rsd, testRestartSlaveData)
}
Beispiel #14
0
func agentRpcTestSlaveStatus(ctx context.Context, t *testing.T, client tmclient.TabletManagerClient, ti *topo.TabletInfo) {
	rs, err := client.SlaveStatus(ctx, ti)
	compareError(t, "SlaveStatus", err, rs, testReplicationStatus)
}
Beispiel #15
0
func agentRpcTestWaitSlavePosition(ctx context.Context, t *testing.T, client tmclient.TabletManagerClient, ti *topo.TabletInfo) {
	rs, err := client.WaitSlavePosition(ctx, ti, testReplicationPosition, testWaitSlavePositionWaitTimeout)
	compareError(t, "WaitSlavePosition", err, rs, testReplicationStatus)
}
Beispiel #16
0
func agentRpcTestExecuteFetch(ctx context.Context, t *testing.T, client tmclient.TabletManagerClient, ti *topo.TabletInfo) {
	qr, err := client.ExecuteFetch(ctx, ti, testExecuteFetchQuery, testExecuteFetchMaxRows, true, true)
	compareError(t, "ExecuteFetch", err, qr, testExecuteFetchResult)
}
Beispiel #17
0
func agentRpcTestApplySchema(ctx context.Context, t *testing.T, client tmclient.TabletManagerClient, ti *topo.TabletInfo) {
	scr, err := client.ApplySchema(ctx, ti, testSchemaChange)
	compareError(t, "ApplySchema", err, scr, testSchemaChangeResult)
}
Beispiel #18
0
func agentRpcTestSleep(ctx context.Context, t *testing.T, client tmclient.TabletManagerClient, ti *topo.TabletInfo) {
	err := client.Sleep(ctx, ti, testSleepDuration)
	if err != nil {
		t.Errorf("Sleep failed: %v", err)
	}
}
Beispiel #19
0
func agentRpcTestDemoteMaster(ctx context.Context, t *testing.T, client tmclient.TabletManagerClient, ti *topo.TabletInfo) {
	err := client.DemoteMaster(ctx, ti)
	compareError(t, "DemoteMaster", err, true, testDemoteMasterCalled)
}
Beispiel #20
0
func agentRpcTestSnapshotSourceEnd(ctx context.Context, t *testing.T, client tmclient.TabletManagerClient, ti *topo.TabletInfo) {
	err := client.SnapshotSourceEnd(ctx, ti, testSnapshotSourceEndArgs)
	compareError(t, "SnapshotSourceEnd", err, true, testSnapshotSourceEndCalled)
}
Beispiel #21
0
func agentRpcTestPromoteSlave(ctx context.Context, t *testing.T, client tmclient.TabletManagerClient, ti *topo.TabletInfo) {
	rsd, err := client.PromoteSlave(ctx, ti)
	compareError(t, "PromoteSlave", err, rsd, testRestartSlaveData)
}
Beispiel #22
0
func agentRpcTestScrap(ctx context.Context, t *testing.T, client tmclient.TabletManagerClient, ti *topo.TabletInfo) {
	err := client.Scrap(ctx, ti)
	if strings.Index(err.Error(), testScrapError.Error()) == -1 {
		t.Errorf("Unexpected Scrap result: got %v expected %v", err, testScrapError)
	}
}
Beispiel #23
0
func agentRpcTestSlaveWasRestarted(ctx context.Context, t *testing.T, client tmclient.TabletManagerClient, ti *topo.TabletInfo) {
	err := client.SlaveWasRestarted(ctx, ti, testSlaveWasRestartedArgs)
	compareError(t, "RestartSlave", err, true, testRestartSlaveCalled)
}
Beispiel #24
0
func agentRpcTestChangeType(ctx context.Context, t *testing.T, client tmclient.TabletManagerClient, ti *topo.TabletInfo) {
	err := client.ChangeType(ctx, ti, testChangeTypeValue)
	if err != nil {
		t.Errorf("ChangeType failed: %v", err)
	}
}
Beispiel #25
0
func agentRpcTestStopSlaveMinimum(ctx context.Context, t *testing.T, client tmclient.TabletManagerClient, ti *topo.TabletInfo) {
	rs, err := client.StopSlaveMinimum(ctx, ti, testReplicationPosition, testStopSlaveMinimumWaitTime)
	compareError(t, "StopSlave", err, rs, testReplicationStatus)
}
Beispiel #26
0
func agentRpcTestExecuteHook(ctx context.Context, t *testing.T, client tmclient.TabletManagerClient, ti *topo.TabletInfo) {
	hr, err := client.ExecuteHook(ctx, ti, testExecuteHookHook)
	compareError(t, "ExecuteHook", err, hr, testExecuteHookHookResult)
}
Beispiel #27
0
func agentRpcTestReserveForRestore(ctx context.Context, t *testing.T, client tmclient.TabletManagerClient, ti *topo.TabletInfo) {
	err := client.ReserveForRestore(ctx, ti, testReserveForRestoreArgs)
	compareError(t, "ReserveForRestore", err, true, testReserveForRestoreCalled)
}
Beispiel #28
0
func agentRpcTestTabletExternallyReparented(ctx context.Context, t *testing.T, client tmclient.TabletManagerClient, ti *topo.TabletInfo) {
	err := client.TabletExternallyReparented(ctx, ti, "")
	compareError(t, "TabletExternallyReparented", err, true, testTabletExternallyReparentedCalled)
}
Beispiel #29
0
func agentRpcTestPing(ctx context.Context, t *testing.T, client tmclient.TabletManagerClient, ti *topo.TabletInfo) {
	err := client.Ping(ctx, ti)
	if err != nil {
		t.Errorf("Ping failed: %v", err)
	}
}
Beispiel #30
0
func agentRpcTestGetSlaves(ctx context.Context, t *testing.T, client tmclient.TabletManagerClient, ti *topo.TabletInfo) {
	s, err := client.GetSlaves(ctx, ti)
	compareError(t, "GetSlaves", err, s, testGetSlavesResult)
}