Skip to content

Commit 9820077

Browse files
committed
change creating table in test
1 parent 0c693ee commit 9820077

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

table/table_e2e_test.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ func (s *stats) addInFlight(t *testing.T, delta int) {
120120

121121
// nolint:gocyclo
122122
func TestTable(t *testing.T) {
123-
ctx, cancel := context.WithTimeout(context.Background(), 55*time.Second)
123+
ctx, cancel := context.WithTimeout(context.Background(), 42*time.Second)
124124
defer cancel()
125125

126126
s := &stats{
@@ -1193,6 +1193,9 @@ func createTables(ctx context.Context, c table.Client, folder string) error {
11931193
err := c.Do(
11941194
ctx,
11951195
func(ctx context.Context, s table.Session) (err error) {
1196+
if _, err = s.DescribeTable(ctx, path.Join(folder, "series")); err == nil {
1197+
_ = s.DropTable(ctx, path.Join(folder, "series"))
1198+
}
11961199
return s.CreateTable(ctx, path.Join(folder, "series"),
11971200
options.WithColumn("series_id", types.Optional(types.TypeUint64)),
11981201
options.WithColumn("title", types.Optional(types.TypeUTF8)),
@@ -1211,6 +1214,9 @@ func createTables(ctx context.Context, c table.Client, folder string) error {
12111214
err = c.Do(
12121215
ctx,
12131216
func(ctx context.Context, s table.Session) (err error) {
1217+
if _, err = s.DescribeTable(ctx, path.Join(folder, "seasons")); err == nil {
1218+
_ = s.DropTable(ctx, path.Join(folder, "seasons"))
1219+
}
12141220
return s.CreateTable(ctx, path.Join(folder, "seasons"),
12151221
options.WithColumn("series_id", types.Optional(types.TypeUint64)),
12161222
options.WithColumn("season_id", types.Optional(types.TypeUint64)),
@@ -1228,6 +1234,9 @@ func createTables(ctx context.Context, c table.Client, folder string) error {
12281234
err = c.Do(
12291235
ctx,
12301236
func(ctx context.Context, s table.Session) (err error) {
1237+
if _, err = s.DescribeTable(ctx, path.Join(folder, "episodes")); err == nil {
1238+
_ = s.DropTable(ctx, path.Join(folder, "episodes"))
1239+
}
12311240
return s.CreateTable(ctx, path.Join(folder, "episodes"),
12321241
options.WithColumn("series_id", types.Optional(types.TypeUint64)),
12331242
options.WithColumn("season_id", types.Optional(types.TypeUint64)),

0 commit comments

Comments
 (0)