forked from dolthub/dolt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add few doltpy commands that broke with dolt compatibility changes re…
…cently
- Loading branch information
1 parent
01dbc04
commit 99d6118
Showing
1 changed file
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#!/usr/bin/env bats | ||
load $BATS_TEST_DIRNAME/helper/common.bash | ||
|
||
setup() { | ||
setup_common | ||
dolt sql <<SQL | ||
CREATE TABLE foo ( | ||
a BIGINT NOT NULL, | ||
b BIGINT, | ||
PRIMARY KEY (a) | ||
); | ||
INSERT INTO foo VALUES (0,0), (1,1); | ||
SELECT DOLT_COMMIT('-am', 'Initialize table'); | ||
SQL | ||
} | ||
|
||
teardown() { | ||
assert_feature_version | ||
teardown_common | ||
} | ||
|
||
# NOTE: if these break on a release that's OK, just tell Max/Oscar | ||
|
||
# already covered by other tests: | ||
# "select * from dolt_branches" | ||
# "SELECT * FROM `{table}` ASOF '{commit}'" | ||
|
||
# verifying the output comparison to dolt log would be nice | ||
@test "doltcli: Dolt.log" { | ||
run dolt sql -r csv <<SQL | ||
SELECT | ||
dc.commit_hash as commit_hash, | ||
dca.parent_hash as parent_hash, | ||
committer as committer, | ||
email as email, | ||
date as date, | ||
message as message | ||
FROM | ||
dolt_log AS dc | ||
LEFT OUTER JOIN dolt_commit_ancestors AS dca | ||
ON dc.commit_hash = dca.commit_hash | ||
WHERE dc.commit_hash = HASHOF('HEAD') | ||
ORDER BY date DESC | ||
LIMIT 1; | ||
SQL | ||
echo $status | ||
echo $output | ||
[[ "$output" =~ "commit_hash,parent_hash,committer,email,date,message" ]] || false | ||
} | ||
|
||
@test "doltcli: Dolt.head" { | ||
run dolt sql -r csv -q "select HASHOF('HEAD') as hash" | ||
[[ $output =~ "hash" ]] | ||
[[ "${#lines[@]}" = "2" ]] || false | ||
} | ||
|
||
@test "doltcli: Dolt.active_branch" { | ||
run dolt sql -r csv -q "select * from dolt_branches where name = (select active_branch())" | ||
echo $output | ||
[[ $output =~ "name,hash,latest_committer,latest_committer_email,latest_commit_date,latest_commit_message" ]] || false | ||
[[ "${#lines[@]}" = "2" ]] || false | ||
} |