mirror of
https://github.com/dolthub/dolt.git
synced 2026-02-04 10:25:17 -06:00
Fix some previously updated tests
This commit is contained in:
@@ -26,10 +26,6 @@ export function assertQueryResult(q, resultStr, expected, rows, matcher) {
|
||||
if (q.toLowerCase().includes("dolt_commit")) {
|
||||
return rows.length === 1 && rows[0].hash.length === 32;
|
||||
}
|
||||
if (q.toLowerCase().includes("dolt_merge")) {
|
||||
const result = JSON.parse(resultStr);
|
||||
return expected.fast_forward === result.fast_forward && expected.conflicts === result.conflicts;
|
||||
}
|
||||
return resultStr === JSON.stringify(expected);
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,10 @@ const tests = [
|
||||
{ q: "call dolt_add('-A');", res: [{ status: 0 }] },
|
||||
{ q: "call dolt_commit('-m', 'my commit')", res: [] },
|
||||
{ q: "select COUNT(*) FROM dolt_log", res: [{ "COUNT(*)": 2 }] },
|
||||
{ q: "call dolt_checkout('-b', 'mybranch')", res: [{ status: 0, message: "Switched to branch 'mybranch'" }] },
|
||||
{
|
||||
q: "call dolt_checkout('-b', 'mybranch')",
|
||||
res: [{ status: 0, message: "Switched to branch 'mybranch'" }],
|
||||
},
|
||||
{
|
||||
q: "insert into test (pk, `value`) values (1,1)",
|
||||
res: {
|
||||
@@ -63,7 +66,10 @@ const tests = [
|
||||
},
|
||||
},
|
||||
{ q: "call dolt_commit('-a', '-m', 'my commit2')", res: [] },
|
||||
{ q: "call dolt_checkout('main')", res: [{ status: 0, message: "Switched to branch 'main'" }] },
|
||||
{
|
||||
q: "call dolt_checkout('main')",
|
||||
res: [{ status: 0, message: "Switched to branch 'main'" }],
|
||||
},
|
||||
{
|
||||
q: "call dolt_merge('mybranch')",
|
||||
res: [{ fast_forward: 1, conflicts: 0 }],
|
||||
|
||||
@@ -95,6 +95,22 @@ export function mergeBaseMatcher(rows, exp) {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function mergeMatcher(rows, exp) {
|
||||
const exceptionKeys = ["hash"];
|
||||
|
||||
function getExceptionIsValid(row, key) {
|
||||
const val = row[key];
|
||||
switch (key) {
|
||||
case "hash":
|
||||
return commitHashIsValid(val);
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return matcher(rows, exp, exceptionKeys, getExceptionIsValid);
|
||||
}
|
||||
|
||||
export function tagsMatcher(rows, exp) {
|
||||
const exceptionKeys = ["tag_hash", "date"];
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { logsMatcher, mergeBaseMatcher } from "./matchers.js";
|
||||
import { logsMatcher, mergeBaseMatcher, mergeMatcher } from "./matchers.js";
|
||||
|
||||
export const mergeTests = [
|
||||
{
|
||||
@@ -14,7 +14,8 @@ export const mergeTests = [
|
||||
{
|
||||
q: `CALL DOLT_MERGE(:branchName, "--no-ff", "-m", :commitMsg)`,
|
||||
p: { branchName: "mybranch", commitMsg: "Merge mybranch into main" },
|
||||
res: [{ fast_forward: 0, conflicts: 0 }],
|
||||
res: [{ hash: "", fast_forward: 0, conflicts: 0 }],
|
||||
matcher: mergeMatcher,
|
||||
},
|
||||
{
|
||||
q: `SELECT * FROM DOLT_LOG(:refName, '--parents') LIMIT :limit OFFSET :offset`,
|
||||
|
||||
@@ -74,7 +74,7 @@ export const tableTests = [
|
||||
FROM information_schema.statistics
|
||||
WHERE table_schema=:tableSchema AND table_name=:tableName AND index_name!="PRIMARY"
|
||||
GROUP BY index_name;`,
|
||||
p: { tableSchema: `${dbName}`, tableName: "test" },
|
||||
p: { tableSchema: `${dbName}/main`, tableName: "test" },
|
||||
res: [
|
||||
{
|
||||
TABLE_NAME: "test",
|
||||
@@ -122,19 +122,19 @@ export const tableTests = [
|
||||
},
|
||||
{
|
||||
q: `SELECT * FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE table_name=:tableName AND table_schema=:tableSchema AND referenced_table_schema IS NOT NULL`,
|
||||
p: { tableName: "test_info", tableSchema: `${dbName}` },
|
||||
p: { tableName: "test_info", tableSchema: `${dbName}/main` },
|
||||
res: [
|
||||
{
|
||||
CONSTRAINT_CATALOG: "def",
|
||||
CONSTRAINT_SCHEMA: `${dbName}`,
|
||||
CONSTRAINT_SCHEMA: `${dbName}/main`,
|
||||
CONSTRAINT_NAME: "s7utamh8",
|
||||
TABLE_CATALOG: "def",
|
||||
TABLE_SCHEMA: `${dbName}`,
|
||||
TABLE_SCHEMA: `${dbName}/main`,
|
||||
TABLE_NAME: "test_info",
|
||||
COLUMN_NAME: "test_pk",
|
||||
ORDINAL_POSITION: 1,
|
||||
POSITION_IN_UNIQUE_CONSTRAINT: 1,
|
||||
REFERENCED_TABLE_SCHEMA: `${dbName}`,
|
||||
REFERENCED_TABLE_SCHEMA: dbName,
|
||||
REFERENCED_TABLE_NAME: "test",
|
||||
REFERENCED_COLUMN_NAME: "pk",
|
||||
},
|
||||
@@ -270,7 +270,7 @@ export const tableTests = [
|
||||
},
|
||||
{
|
||||
q: "CALL DOLT_CHECKOUT('test_info')",
|
||||
res: [{ status: 0 }],
|
||||
res: [{ status: 0, message: "" }],
|
||||
},
|
||||
{
|
||||
q: `SELECT * FROM dolt_status`,
|
||||
|
||||
Reference in New Issue
Block a user