diff --git a/tests/integrations/realcluster/ts_test.go b/tests/integrations/realcluster/ts_test.go index 156e3d63e71..f19124d04a4 100644 --- a/tests/integrations/realcluster/ts_test.go +++ b/tests/integrations/realcluster/ts_test.go @@ -14,26 +14,45 @@ package realcluster -// func TestTS(t *testing.T) { -// re := require.New(t) - -// db := OpenTestDB(t) -// db.MustExec("use test") -// db.MustExec("drop table if exists t") -// db.MustExec("create table t(a int, index i(a))") -// db.MustExec("insert t values (1), (2), (3)") -// var rows int -// err := db.inner.Raw("select count(*) from t").Row().Scan(&rows) -// re.NoError(err) -// re.Equal(3, rows) - -// re.NoError(err) -// re.Equal(3, rows) - -// var ts uint64 -// err = db.inner.Begin().Raw("select @@tidb_current_ts").Scan(&ts).Rollback().Error -// re.NoError(err) -// re.NotEqual(0, GetTimeFromTS(ts)) - -// db.MustClose() -// } +import ( + "testing" + + "github.com/stretchr/testify/require" + "github.com/stretchr/testify/suite" +) + +type tsSuite struct { + realClusterSuite +} + +func TestTS(t *testing.T) { + suite.Run(t, &tsSuite{ + realClusterSuite: realClusterSuite{ + suiteName: "ts", + }, + }) +} + +func (s *tsSuite) TestTS() { + re := require.New(s.T()) + + db := OpenTestDB(s.T()) + db.MustExec("use test") + db.MustExec("drop table if exists t") + db.MustExec("create table t(a int, index i(a))") + db.MustExec("insert t values (1), (2), (3)") + var rows int + err := db.inner.Raw("select count(*) from t").Row().Scan(&rows) + re.NoError(err) + re.Equal(3, rows) + + re.NoError(err) + re.Equal(3, rows) + + var ts uint64 + err = db.inner.Begin().Raw("select @@tidb_current_ts").Scan(&ts).Rollback().Error + re.NoError(err) + re.NotEqual(0, GetTimeFromTS(ts)) + + db.MustClose() +}