Пример #1
0
func TestCallCorrectSplitQueryCallV2(t *testing.T) {
	mockCtrl := gomock.NewController(t)
	defer mockCtrl.Finish()
	mockQueryService := queryservice_testing.NewMockQueryService(mockCtrl)
	splitColumns := []string{"col1", "col2"}
	mockQueryService.EXPECT().SplitQueryV2(
		context.Background(),
		&target,
		sql,
		bindVariables,
		splitColumns,
		splitCount,
		numRowsPerQueryPart,
		algorithm,
		sessionID)
	CallCorrectSplitQuery(
		mockQueryService,
		true, /* useSplitQueryV2 */
		context.Background(),
		&target,
		sql,
		bindVariables,
		splitColumns,
		splitCount,
		numRowsPerQueryPart,
		algorithm,
		sessionID)
}
Пример #2
0
func TestCallCorrectSplitQueryCallV1WithSplitColumn(t *testing.T) {
	mockCtrl := gomock.NewController(t)
	defer mockCtrl.Finish()
	mockQueryService := queryservice_testing.NewMockQueryService(mockCtrl)

	mockQueryService.EXPECT().SplitQuery(
		context.Background(),
		&target,
		sql,
		bindVariables,
		"First Split Column",
		splitCount,
		sessionID)
	CallCorrectSplitQuery(
		mockQueryService,
		false, /* useSplitQueryV2 */
		context.Background(),
		&target,
		sql,
		bindVariables,
		[]string{"First Split Column"}, /* SplitColumns */
		splitCount,
		numRowsPerQueryPart,
		algorithm,
		sessionID)
}