From 28560ea0e7ccba38f8d15abf91fa210e688fa628 Mon Sep 17 00:00:00 2001 From: Andy Arthur Date: Mon, 18 Jul 2022 11:59:04 -0700 Subject: [PATCH] unskipped autoincrement bats for __DOLT_1__, created mirrored enginetest --- .../doltcore/sqle/enginetest/dolt_queries.go | 68 +++++++++++++++++++ integration-tests/bats/auto_increment.bats | 4 -- 2 files changed, 68 insertions(+), 4 deletions(-) diff --git a/go/libraries/doltcore/sqle/enginetest/dolt_queries.go b/go/libraries/doltcore/sqle/enginetest/dolt_queries.go index dc71d287e3..51c406633f 100644 --- a/go/libraries/doltcore/sqle/enginetest/dolt_queries.go +++ b/go/libraries/doltcore/sqle/enginetest/dolt_queries.go @@ -1657,6 +1657,74 @@ var MergeScripts = []queries.ScriptTest{ //}, }, }, + { + Name: "dolt_merge() works with no auto increment overlap", + SetUpScript: []string{ + "CREATE TABLE t (pk int PRIMARY KEY AUTO_INCREMENT, c0 int);", + "INSERT INTO t (c0) VALUES (1), (2);", + "CALL dolt_commit('-a', '-m', 'cm1');", + "CALL dolt_checkout('-b', 'test');", + "INSERT INTO t (c0) VALUES (3), (4);", + "CALL dolt_commit('-a', '-m', 'cm2');", + "CALL dolt_checkout('main');", + }, + Assertions: []queries.ScriptTestAssertion{ + { + Query: "CALL dolt_merge('test');", + Expected: []sql.Row{{1, 0}}, + }, + { + Query: "INSERT INTO t VALUES (NULL,5),(6,6),(NULL,7);", + Expected: []sql.Row{{sql.OkResult{RowsAffected: 3, InsertID: 5}}}, + }, + { + Query: "SELECT * FROM t ORDER BY pk;", + Expected: []sql.Row{ + {1, 1}, + {2, 2}, + {3, 3}, + {4, 4}, + {5, 5}, + {6, 6}, + {7, 7}, + }, + }, + }, + }, + { + Name: "dolt_merge() with a gap in an auto increment key", + SetUpScript: []string{ + "CREATE TABLE t (pk int PRIMARY KEY AUTO_INCREMENT, c0 int);", + "INSERT INTO t (c0) VALUES (1), (2);", + "CALL dolt_add('-A');", + "CALL dolt_commit('-am', 'cm1');", + "CALL dolt_checkout('-b', 'test');", + "INSERT INTO t VALUES (4,4), (5,5);", + "CALL dolt_commit('-am', 'cm2');", + "CALL dolt_checkout('main');", + }, + Assertions: []queries.ScriptTestAssertion{ + { + Query: "CALL dolt_merge('test');", + Expected: []sql.Row{{1, 0}}, + }, + { + Query: "INSERT INTO t VALUES (3,3),(NULL,6);", + Expected: []sql.Row{{sql.OkResult{RowsAffected: 2, InsertID: 3}}}, + }, + { + Query: "SELECT * FROM t ORDER BY pk;", + Expected: []sql.Row{ + {1, 1}, + {2, 2}, + {3, 3}, + {4, 4}, + {5, 5}, + {6, 6}, + }, + }, + }, + }, } var KeylessMergeCVsAndConflictsScripts = []queries.ScriptTest{ diff --git a/integration-tests/bats/auto_increment.bats b/integration-tests/bats/auto_increment.bats index 70cf07f193..323d2c11b4 100644 --- a/integration-tests/bats/auto_increment.bats +++ b/integration-tests/bats/auto_increment.bats @@ -434,8 +434,6 @@ SQL } @test "auto_increment: dolt_merge() works with no auto increment overlap" { - skip_nbf_dolt_1 - dolt sql <