Ejemplo n.º 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")
	}
}
Ejemplo n.º 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)
}
Ejemplo n.º 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)
}
Ejemplo n.º 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)
	}
}
Ejemplo n.º 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)
}
Ejemplo n.º 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)
}
Ejemplo n.º 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)
}
Ejemplo n.º 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)
	}
}
Ejemplo n.º 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)
}
Ejemplo n.º 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)
}
Ejemplo n.º 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)
}
Ejemplo n.º 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)
}
Ejemplo n.º 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)
}
Ejemplo n.º 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)
}
Ejemplo n.º 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)
}
Ejemplo n.º 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)
}
Ejemplo n.º 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)
}
Ejemplo n.º 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)
	}
}
Ejemplo n.º 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)
}
Ejemplo n.º 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)
}
Ejemplo n.º 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)
}
Ejemplo n.º 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)
	}
}
Ejemplo n.º 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)
}
Ejemplo n.º 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)
	}
}
Ejemplo n.º 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)
}
Ejemplo n.º 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)
}
Ejemplo n.º 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)
}
Ejemplo n.º 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)
}
Ejemplo n.º 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)
	}
}
Ejemplo n.º 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)
}