mirror of
https://github.com/dolthub/dolt.git
synced 2026-02-26 18:29:03 -06:00
add dolt_backups() script tests and bats test
This commit is contained in:
@@ -1487,6 +1487,12 @@ func TestBackupsSystemTable(t *testing.T) {
|
||||
enginetest.TestScript(t, h, BackupsSystemTableQueries)
|
||||
}
|
||||
|
||||
func TestBackupsTableFunction(t *testing.T) {
|
||||
h := newDoltHarness(t)
|
||||
defer h.Close()
|
||||
enginetest.TestScript(t, h, BackupsTableFunctionQueries)
|
||||
}
|
||||
|
||||
func TestHistorySystemTable(t *testing.T) {
|
||||
harness := newDoltEnginetestHarness(t).WithParallelism(2)
|
||||
RunHistorySystemTableTests(t, harness)
|
||||
|
||||
@@ -103,3 +103,21 @@ var BackupsSystemTableQueries = queries.ScriptTest{
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
var BackupsTableFunctionQueries = queries.ScriptTest{
|
||||
Name: "dolt_backups() table function",
|
||||
SetUpScript: []string{
|
||||
`call dolt_backup("add", "backup1", "file:///tmp/backup1");`,
|
||||
},
|
||||
Assertions: []queries.ScriptTestAssertion{
|
||||
{
|
||||
Query: "select name from dolt_backups();",
|
||||
Expected: []sql.Row{{"backup1"}},
|
||||
},
|
||||
{
|
||||
Query: "select name from dolt_backups() where name = 'backup1';",
|
||||
Expected: []sql.Row{{"backup1"}},
|
||||
},
|
||||
// Table functions are implicitly read-only at the SQL parser level.
|
||||
},
|
||||
}
|
||||
|
||||
@@ -317,3 +317,19 @@ teardown() {
|
||||
run dolt backup sync-url file://../bac1
|
||||
[ "$status" -ne 0 ]
|
||||
}
|
||||
|
||||
@test "backup: dolt_backups() table function with verbose flag" {
|
||||
cd repo1
|
||||
dolt backup add bac1 file://../bac1
|
||||
|
||||
run dolt sql -q "SELECT name, url FROM dolt_backups()" -r csv
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "${lines[0]}" =~ "name,url" ]] || false
|
||||
[[ "${lines[1]}" =~ "bac1,file://" ]] || false
|
||||
|
||||
run dolt sql -q "SELECT name, url, params FROM dolt_backups('--verbose')" -r csv
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "${lines[0]}" =~ "name,url,params" ]] || false
|
||||
[[ "${lines[1]}" =~ "bac1,file://" ]] || false
|
||||
[[ "${lines[1]}" =~ "{}" ]] || false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user