Skip to content

Commit

Permalink
Generate expected error string with actual Result object
Browse files Browse the repository at this point in the history
Signed-off-by: Rafer Hazen <rafer@ralua.com>
  • Loading branch information
rafer committed May 16, 2024
1 parent 7997d1e commit c3d4c57
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions go/vt/vttablet/tabletmanager/vreplication/engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,8 @@ func TestWaitForPosError(t *testing.T) {

dbClient.ExpectRequest("select pos, state, message from _vt.vreplication where id=1", &sqltypes.Result{Rows: [][]sqltypes.Value{{}}}, nil)
err = vre.WaitForPos(context.Background(), 1, "MariaDB/0-1-1084")
want = "unexpected result: &{[] 0 0 [[]] 0 }"
want = fmt.Sprintf("unexpected result: %v", &sqltypes.Result{Rows: [][]sqltypes.Value{}})

assert.EqualError(t, err, want, "WaitForPos:")

dbClient.ExpectRequest("select pos, state, message from _vt.vreplication where id=1", &sqltypes.Result{Rows: [][]sqltypes.Value{{
Expand All @@ -435,7 +436,11 @@ func TestWaitForPosError(t *testing.T) {
sqltypes.NewVarBinary("MariaDB/0-1-1083"),
}}}, nil)
err = vre.WaitForPos(context.Background(), 1, "MariaDB/0-1-1084")
want = `unexpected result: &{[] 0 0 [[VARBINARY("MariaDB/0-1-1083")] [VARBINARY("MariaDB/0-1-1083")]] 0 }`
want = fmt.Sprintf("unexpected result: %v", &sqltypes.Result{Rows: [][]sqltypes.Value{{
sqltypes.NewVarBinary("MariaDB/0-1-1083"),
}, {
sqltypes.NewVarBinary("MariaDB/0-1-1083"),
}}})
assert.EqualError(t, err, want, "WaitForPos:")
}

Expand Down

0 comments on commit c3d4c57

Please sign in to comment.