Skip to content

Commit 625f6b4

Browse files
committed
Fixed staging operation tests
Signed-off-by: nithinkdb <[email protected]>
1 parent 9112ac7 commit 625f6b4

File tree

4 files changed

+34
-2
lines changed

4 files changed

+34
-2
lines changed

connection_test.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,11 @@ func TestConn_executeStatement(t *testing.T) {
121121
},
122122
}
123123

124+
getResultSetMetadata := func(ctx context.Context, req *cli_service.TGetResultSetMetadataReq) (_r *cli_service.TGetResultSetMetadataResp, _err error) {
125+
var b = false
126+
return &cli_service.TGetResultSetMetadataResp{IsStagingOperation: &b}, nil
127+
}
128+
124129
testClient := &client.TestClient{
125130
FnExecuteStatement: func(ctx context.Context, req *cli_service.TExecuteStatementReq) (r *cli_service.TExecuteStatementResp, err error) {
126131
executeStatementCount++
@@ -130,6 +135,7 @@ func TestConn_executeStatement(t *testing.T) {
130135
closeOperationCount++
131136
return &cli_service.TCloseOperationResp{}, nil
132137
},
138+
FnGetResultSetMetadata: getResultSetMetadata,
133139
}
134140
testConn := &conn{
135141
session: getTestSession(),
@@ -1103,6 +1109,10 @@ func TestConn_ExecContext(t *testing.T) {
11031109
}
11041110
return getOperationStatusResp, nil
11051111
}
1112+
getResultSetMetadata := func(ctx context.Context, req *cli_service.TGetResultSetMetadataReq) (_r *cli_service.TGetResultSetMetadataResp, _err error) {
1113+
var b = false
1114+
return &cli_service.TGetResultSetMetadataResp{IsStagingOperation: &b}, nil
1115+
}
11061116

11071117
testClient := &client.TestClient{
11081118
FnExecuteStatement: executeStatement,
@@ -1112,6 +1122,7 @@ func TestConn_ExecContext(t *testing.T) {
11121122
assert.NoError(t, ctxErr)
11131123
return &cli_service.TCloseOperationResp{}, nil
11141124
},
1125+
FnGetResultSetMetadata: getResultSetMetadata,
11151126
}
11161127
testConn := &conn{
11171128
session: getTestSession(),
@@ -1155,6 +1166,11 @@ func TestConn_ExecContext(t *testing.T) {
11551166
return getOperationStatusResp, nil
11561167
}
11571168

1169+
getResultSetMetadata := func(ctx context.Context, req *cli_service.TGetResultSetMetadataReq) (_r *cli_service.TGetResultSetMetadataResp, _err error) {
1170+
var b = false
1171+
return &cli_service.TGetResultSetMetadataResp{IsStagingOperation: &b}, nil
1172+
}
1173+
11581174
testClient := &client.TestClient{
11591175
FnExecuteStatement: executeStatement,
11601176
FnGetOperationStatus: getOperationStatus,
@@ -1173,7 +1189,9 @@ func TestConn_ExecContext(t *testing.T) {
11731189
}
11741190
return cancelOperationResp, nil
11751191
},
1192+
FnGetResultSetMetadata: getResultSetMetadata,
11761193
}
1194+
11771195
testConn := &conn{
11781196
session: getTestSession(),
11791197
client: testClient,

driver_e2e_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ func TestWorkflowExample(t *testing.T) {
3131
)
3232
state := &callState{}
3333
// load basic responses
34+
loadTestData(t, "GetResultSetMetadataNotStaging.json", &state.getResultSetMetadataResp)
3435
loadTestData(t, "OpenSessionSuccess.json", &state.openSessionResp)
3536
loadTestData(t, "CloseSessionSuccess.json", &state.closeSessionResp)
3637
loadTestData(t, "CloseOperationSuccess.json", &state.closeOperationResp)
@@ -259,6 +260,7 @@ func TestContextTimeoutExample(t *testing.T) {
259260
_ = logger.SetLogLevel("debug")
260261
state := &callState{}
261262
// load basic responses
263+
loadTestData(t, "GetResultSetMetadataNotStaging.json", &state.getResultSetMetadataResp)
262264
loadTestData(t, "OpenSessionSuccess.json", &state.openSessionResp)
263265
loadTestData(t, "CloseSessionSuccess.json", &state.closeSessionResp)
264266
loadTestData(t, "CloseOperationSuccess.json", &state.closeOperationResp)
@@ -308,6 +310,7 @@ func TestRetries(t *testing.T) {
308310
_ = logger.SetLogLevel("debug")
309311
state := &callState{}
310312
// load basic responses
313+
loadTestData(t, "GetResultSetMetadataNotStaging.json", &state.getResultSetMetadataResp)
311314
loadTestData(t, "OpenSessionSuccess.json", &state.openSessionResp)
312315
loadTestData(t, "CloseSessionSuccess.json", &state.closeSessionResp)
313316
loadTestData(t, "CloseOperationSuccess.json", &state.closeOperationResp)
@@ -333,6 +336,7 @@ func TestRetries(t *testing.T) {
333336
_ = logger.SetLogLevel("debug")
334337
state := &callState{}
335338
// load basic responses
339+
loadTestData(t, "GetResultSetMetadataNotStaging.json", &state.getResultSetMetadataResp)
336340
loadTestData(t, "OpenSessionSuccess.json", &state.openSessionResp)
337341
loadTestData(t, "CloseSessionSuccess.json", &state.closeSessionResp)
338342
loadTestData(t, "CloseOperationSuccess.json", &state.closeOperationResp)
@@ -358,6 +362,7 @@ func TestRetries(t *testing.T) {
358362
_ = logger.SetLogLevel("debug")
359363
state := &callState{}
360364
// load basic responses
365+
loadTestData(t, "GetResultSetMetadataNotStaging.json", &state.getResultSetMetadataResp)
361366
loadTestData(t, "OpenSessionSuccess.json", &state.openSessionResp)
362367
loadTestData(t, "CloseSessionSuccess.json", &state.closeSessionResp)
363368
loadTestData(t, "CloseOperationSuccess.json", &state.closeOperationResp)
@@ -392,6 +397,7 @@ func TestRetries(t *testing.T) {
392397
_ = logger.SetLogLevel("debug")
393398
state := &callState{}
394399
// load basic responses
400+
loadTestData(t, "GetResultSetMetadataNotStaging.json", &state.getResultSetMetadataResp)
395401
loadTestData(t, "OpenSessionSuccess.json", &state.openSessionResp)
396402
loadTestData(t, "CloseSessionSuccess.json", &state.closeSessionResp)
397403
loadTestData(t, "CloseOperationSuccess.json", &state.closeOperationResp)
@@ -426,6 +432,7 @@ func TestRetries(t *testing.T) {
426432
_ = logger.SetLogLevel("debug")
427433
state := &callState{}
428434
// load basic responses
435+
loadTestData(t, "GetResultSetMetadataNotStaging.json", &state.getResultSetMetadataResp)
429436
loadTestData(t, "OpenSessionSuccess.json", &state.openSessionResp)
430437
loadTestData(t, "CloseSessionSuccess.json", &state.closeSessionResp)
431438
loadTestData(t, "CloseOperationSuccess.json", &state.closeOperationResp)

statement_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,16 @@ func TestStmt_ExecContext(t *testing.T) {
8787
}
8888
return getOperationStatusResp, nil
8989
}
90-
fetchResultSetMetadata := func(ctx context.Context, req *cli_service.TGetResultSetMetadataReq) (_r *cli_service.TGetResultSetMetadataResp, _err error) {
90+
91+
getResultSetMetadata := func(ctx context.Context, req *cli_service.TGetResultSetMetadataReq) (_r *cli_service.TGetResultSetMetadataResp, _err error) {
9192
var b = false
9293
return &cli_service.TGetResultSetMetadataResp{IsStagingOperation: &b}, nil
9394
}
9495

9596
testClient := &client.TestClient{
9697
FnExecuteStatement: executeStatement,
9798
FnGetOperationStatus: getOperationStatus,
98-
FnGetResultSetMetadata: fetchResultSetMetadata,
99+
FnGetResultSetMetadata: getResultSetMetadata,
99100
}
100101
testConn := &conn{
101102
session: getTestSession(),
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"status": {
3+
"statusCode": "SUCCESS_STATUS"
4+
},
5+
"isStagingOperation": false
6+
}

0 commit comments

Comments
 (0)