Skip to content

Commit

Permalink
feat: add vtadmin api command
Browse files Browse the repository at this point in the history
Signed-off-by: Manan Gupta <[email protected]>
  • Loading branch information
GuptaManan100 committed Nov 6, 2024
1 parent 22a6b49 commit 3c9fb2c
Show file tree
Hide file tree
Showing 10 changed files with 2,240 additions and 1,466 deletions.
5 changes: 5 additions & 0 deletions go/test/endtoend/transaction/twopc/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,11 @@ func TestMain(m *testing.M) {
vtParams = clusterInstance.GetVTParams(keyspaceName)
vtgateGrpcAddress = fmt.Sprintf("%s:%d", clusterInstance.Hostname, clusterInstance.VtgateGrpcPort)

clusterInstance.NewVTAdminProcess()
if err := clusterInstance.VtadminProcess.Setup(); err != nil {
return 1
}

// create mysql instance and connection parameters
conn, closer, err := utils.NewMySQL(clusterInstance, keyspaceName, SchemaSQL)
if err != nil {
Expand Down
7 changes: 7 additions & 0 deletions go/test/endtoend/transaction/twopc/twopc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"fmt"
"reflect"
"sort"
"strconv"
"strings"
"sync"
"testing"
Expand Down Expand Up @@ -1428,6 +1429,12 @@ func TestReadTransactionStatus(t *testing.T) {
require.Contains(t, out, "insert into twopc_t1(id, col) values (9, 4)")
require.Contains(t, out, unresTransaction.Dtid)

// Read the data from vtadmin API, and verify that too has the same information.
apiRes := clusterInstance.VtadminProcess.MakeAPICallRetry(t, fmt.Sprintf("/api/transaction/local/%v/info", unresTransaction.Dtid))
require.Contains(t, apiRes, "insert into twopc_t1(id, col) values (9, 4)")
require.Contains(t, apiRes, unresTransaction.Dtid)
require.Contains(t, apiRes, strconv.FormatInt(res.TimeCreated, 10))

// Wait for the commit to have returned.
wg.Wait()
}
Expand Down
Loading

0 comments on commit 3c9fb2c

Please sign in to comment.