mirror of
https://github.com/dolthub/dolt.git
synced 2026-02-25 10:19:24 -06:00
Tests for USE of non-dolt dbs
This commit is contained in:
@@ -972,7 +972,9 @@ func (d *DoltSession) SwitchWorkingSet(
|
||||
func (d *DoltSession) UseDatabase(ctx *sql.Context, db sql.Database) error {
|
||||
sdb, ok := db.(SqlDatabase)
|
||||
if !ok {
|
||||
return fmt.Errorf("expected a SqlDatabase, got %T", db)
|
||||
// Could be an externally provided db such as `mysql` or `information_schema`, in which case there's nothing for
|
||||
// this hook to do
|
||||
return nil
|
||||
}
|
||||
|
||||
branchState, ok, err := d.lookupDbState(ctx, sdb.RevisionQualifiedName())
|
||||
|
||||
@@ -2855,3 +2855,26 @@ SQL
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "provided --use-db dba does not exist or is not a directory" ]] || false
|
||||
}
|
||||
|
||||
@test "sql: USE information schema and mysql databases" {
|
||||
run dolt sql <<SQL
|
||||
USE information_schema;
|
||||
show tables;
|
||||
SQL
|
||||
|
||||
# spot check result
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "Database changed" ]] || false
|
||||
[[ "$output" =~ "columns" ]] || false
|
||||
|
||||
run dolt sql <<SQL
|
||||
USE mysql;
|
||||
show tables;
|
||||
SQL
|
||||
|
||||
# spot check result
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "Database changed" ]] || false
|
||||
[[ "$output" =~ "role_edges" ]] || false
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user