Files
dolt/integration-tests/go-sql-server-driver/tests/sql-server-config.yaml

428 lines
13 KiB
YAML

parallel: true
tests:
- name: persist global variable before server startup
repos:
- name: repo1
with_files:
- name: ".dolt/config.json"
contents: |
{"sqlserver.global.max_connections":"1000"}
server:
args: ["-l", "trace", "-P", '{{get_port "repo1"}}']
dynamic_port: repo1
connections:
- on: repo1
queries:
- query: "select @@GLOBAL.max_connections"
result:
columns: ["@@GLOBAL.max_connections"]
rows: [["1000"]]
- name: invalid persisted global variable name throws warning on server startup, but does not crash
repos:
- name: repo1
with_files:
- name: ".dolt/config.json"
contents: |
{"sqlserver.global.unknown":"1000"}
server:
args: ["-l", "trace", "-P", '{{get_port "repo1"}}']
dynamic_port: repo1
log_matches:
- "warning: persisted system variable unknown was not loaded since its definition does not exist."
connections:
- on: repo1
- name: invalid persisted global variable value throws warning on server startup, but does not crash
repos:
- name: repo1
with_files:
- name: ".dolt/config.json"
contents: |
{"sqlserver.global.max_connections":"string"}
server:
args: ["-P", '{{get_port "repo1"}}']
dynamic_port: repo1
log_matches:
- "error: failed to load persisted global variables: key: 'max_connections'; strconv.ParseInt: parsing \"string\": invalid syntax"
connections:
- on: repo1
- name: persisted global variable in server
repos:
- name: repo1
server:
args: ["-l", "trace", "-P", '{{get_port "repo1"}}']
dynamic_port: repo1
connections:
- on: repo1
queries:
- exec: "SET @@PERSIST.max_connections = 1000"
- query: "select @@GLOBAL.max_connections"
result:
columns: ["@@GLOBAL.max_connections"]
rows: [["1000"]]
restart_server: {}
- on: repo1
queries:
- query: "select @@GLOBAL.max_connections"
result:
columns: ["@@GLOBAL.max_connections"]
rows: [["1000"]]
- name: dolt_replicate_heads is global variable
repos:
- name: repo1
server:
args: ["-l", "trace", "-P", '{{get_port "repo1"}}']
dynamic_port: repo1
connections:
- on: repo1
queries:
- exec: "SET @@GLOBAL.dolt_replicate_heads = main"
- query: "select @@GLOBAL.dolt_replicate_heads"
result:
columns: ["@@GLOBAL.dolt_replicate_heads"]
rows: [["main"]]
- query: "select @@SESSION.dolt_replicate_heads"
result:
columns: ["@@SESSION.dolt_replicate_heads"]
# XXX: Is this OK? The session variable does not see the new global value; only new connections see it.
rows: [[""]]
- on: repo1
queries:
- query: "select @@SESSION.dolt_replicate_heads"
result:
columns: ["@@SESSION.dolt_replicate_heads"]
rows: [["main"]]
- query: "select @@dolt_replicate_heads"
result:
columns: ["@@dolt_replicate_heads"]
rows: [["main"]]
- name: dolt_replicate_all_heads is global variable
repos:
- name: repo1
server:
args: ["-l", "trace", "-P", '{{get_port "repo1"}}']
dynamic_port: repo1
connections:
- on: repo1
queries:
- exec: "SET @@GLOBAL.dolt_replicate_all_heads = 1"
- query: "select @@GLOBAL.dolt_replicate_all_heads"
result:
columns: ["@@GLOBAL.dolt_replicate_all_heads"]
rows: [["1"]]
- query: "select @@SESSION.dolt_replicate_all_heads"
result:
columns: ["@@SESSION.dolt_replicate_all_heads"]
# XXX: Is this OK? The session variable does not see the new global value; only new connections see it.
rows: [["0"]]
- on: repo1
queries:
- query: "select @@SESSION.dolt_replicate_all_heads"
result:
columns: ["@@SESSION.dolt_replicate_all_heads"]
rows: [["1"]]
- query: "select @@dolt_replicate_all_heads"
result:
columns: ["@@dolt_replicate_all_heads"]
rows: [["1"]]
- name: dolt_transaction_commit is global variable
repos:
- name: repo1
server:
args: ["-l", "trace", "-P", '{{get_port "repo1"}}']
dynamic_port: repo1
connections:
- on: repo1
queries:
- exec: "SET @@GLOBAL.dolt_transaction_commit = 1"
- query: "select @@GLOBAL.dolt_transaction_commit"
result:
columns: ["@@GLOBAL.dolt_transaction_commit"]
rows: [["1"]]
- query: "select @@SESSION.dolt_transaction_commit"
result:
columns: ["@@SESSION.dolt_transaction_commit"]
# XXX: Is this OK? The session variable does not see the new global value; only new connections see it.
rows: [["0"]]
- on: repo1
queries:
- query: "select @@SESSION.dolt_transaction_commit"
result:
columns: ["@@SESSION.dolt_transaction_commit"]
rows: [["1"]]
- query: "select @@dolt_transaction_commit"
result:
columns: ["@@dolt_transaction_commit"]
rows: [["1"]]
- query: "select count(*) from dolt_log"
result:
columns: ["count(*)"]
rows: [["1"]]
- exec: "create table tmp (i int)"
- query: "select count(*) from dolt_log"
result:
columns: ["count(*)"]
rows: [["2"]]
- name: persist only global variable during server session
repos:
- name: repo1
server:
args: ["-l", "trace", "-P", '{{get_port "repo1"}}']
dynamic_port: repo1
connections:
- on: repo1
queries:
- exec: "SET PERSIST max_connections = 1000"
- exec: "SET PERSIST_ONLY max_connections = 7777"
- query: "select @@GLOBAL.max_connections"
result:
columns: ["@@GLOBAL.max_connections"]
rows: [["1000"]]
restart_server: {}
- on: repo1
queries:
- query: "select @@GLOBAL.max_connections"
result:
columns: ["@@GLOBAL.max_connections"]
rows: [["7777"]]
- name: persist invalid global variable name during server session
repos:
- name: repo1
server:
args: ["-l", "trace", "-P", '{{get_port "repo1"}}']
dynamic_port: repo1
connections:
- on: repo1
queries:
- exec: "SET @@PERSIST.unknown = 1000"
error_match: "Unknown system variable"
- name: persist invalid global variable value during server session
repos:
- name: repo1
server:
args: ["-P", '{{get_port "repo1"}}']
dynamic_port: repo1
connections:
- on: repo1
queries:
- exec: "SET @@PERSIST.max_connections = 'string'"
error_match: "Variable 'max_connections' can't be set to the value of 'string'"
- name: set max_connections with yaml config
repos:
- name: repo1
with_files:
- name: "server.yaml"
contents: |
log_level: trace
listener:
max_connections: 999
port: {{get_port "repo1"}}
server:
args: ["--config", "server.yaml"]
dynamic_port: repo1
connections:
- on: repo1
queries:
- query: "select @@GLOBAL.max_connections"
result:
columns: ["@@GLOBAL.max_connections"]
rows: [["999"]]
- name: persistence behavior
repos:
- name: repo1
server:
args: ["-P", '{{get_port "repo1"}}']
dynamic_port: repo1
connections:
- on: repo1
queries:
- query: "select @@GLOBAL.max_connections"
result:
columns: ["@@GLOBAL.max_connections"]
rows: [["151"]]
- name: persisted global variable defined on the command line
repos:
- name: repo1
server:
args: ["--max-connections", "555", "-P", '{{get_port "repo1"}}']
dynamic_port: repo1
connections:
- on: repo1
queries:
- query: "select @@GLOBAL.max_connections"
result:
columns: ["@@GLOBAL.max_connections"]
rows: [["555"]]
- name: "@@global.dolt_log_level behavior"
repos:
- name: repo1
server:
args: ["-l", "warning", "-P", '{{get_port "repo1"}}']
dynamic_port: repo1
log_matches:
- "Starting query"
connections:
- on: repo1
queries:
- query: "select @@GLOBAL.dolt_log_level"
result:
columns: ["@@GLOBAL.dolt_log_level"]
rows: [["warning"]]
- exec: "set @@GLOBAL.dolt_log_level = 'trace'"
- query: "select 2+2 from dual"
result:
columns: ["2+2"]
rows: [["4"]]
- query: "select @@GLOBAL.dolt_log_level"
result:
columns: ["@@GLOBAL.dolt_log_level"]
rows: [["trace"]]
restart_server:
args: ["-l", "info", "-P", '{{get_port "repo1"}}']
- on: repo1
queries:
- query: "select @@GLOBAL.dolt_log_level"
result:
columns: ["@@GLOBAL.dolt_log_level"]
rows: [["info"]]
- name: "@@global.dolt_auto_gc_enabled default"
repos:
- name: repo1
server:
args: ["-P", '{{get_port "repo1"}}']
dynamic_port: repo1
connections:
- on: repo1
queries:
- query: "select @@GLOBAL.dolt_auto_gc_enabled"
result:
columns: ["@@GLOBAL.dolt_auto_gc_enabled"]
rows: [[1]]
- exec: "SET @@GLOBAL.dolt_auto_gc_enabled = 0"
error_match: "Variable 'dolt_auto_gc_enabled' is a read only variable"
- name: "@@global.dolt_auto_gc_enabled true"
repos:
- name: repo1
with_files:
- name: "config.yaml"
contents: |
behavior:
auto_gc_behavior:
enable: true
listener:
port: {{get_port "repo1"}}
server:
args: ["--config", "config.yaml"]
dynamic_port: repo1
connections:
- on: repo1
queries:
- query: "select @@GLOBAL.dolt_auto_gc_enabled"
result:
columns: ["@@GLOBAL.dolt_auto_gc_enabled"]
rows: [[1]]
- name: "@@global.dolt_auto_gc_enabled false"
repos:
- name: repo1
with_files:
- name: "config.yaml"
contents: |
behavior:
auto_gc_behavior:
enable: false
listener:
port: {{get_port "repo1"}}
server:
args: ["--config", "config.yaml"]
dynamic_port: repo1
connections:
- on: repo1
queries:
- query: "select @@GLOBAL.dolt_auto_gc_enabled"
result:
columns: ["@@GLOBAL.dolt_auto_gc_enabled"]
rows: [[0]]
- name: system variables in config.yaml can be read in show variables
repos:
- name: repo1
with_files:
- name: "config.yaml"
contents: |
system_variables:
secure_file_priv: "/dev/null"
max_connections: 1000
listener:
port: {{get_port "repo1"}}
server:
args: ["-l", "trace", "--config", "config.yaml"]
dynamic_port: repo1
connections:
- on: repo1
queries:
- query: "select @@GLOBAL.secure_file_priv, @@GLOBAL.max_connections"
result:
columns: ["@@GLOBAL.secure_file_priv", "@@GLOBAL.max_connections"]
rows: [["/dev/null", "1000"]]
- name: secure_file_priv set to /dev/null prevents loading files
repos:
- name: repo1
with_files:
- name: "config.yaml"
contents: |
system_variables:
secure_file_priv: "/dev/null"
listener:
port: {{get_port "repo1"}}
server:
args: ["-l", "trace", "--config", "config.yaml"]
dynamic_port: repo1
connections:
- on: repo1
queries:
- query: "select LOAD_FILE('config.yaml')"
result:
columns: ["LOAD_FILE('config.yaml')"]
rows: [["NULL"]]
- query: "select LOAD_FILE('/etc/passwd')"
result:
columns: ["LOAD_FILE('/etc/passwd')"]
rows: [["NULL"]]
- exec: "create table loaded (contents text)"
- exec: "load data infile \"config.yaml\" into table loaded"
error_match: "LOAD DATA is unable to open file: The MySQL server is running with the --secure-file-priv option so it cannot execute this statement"
- exec: "load data infile \"/config.yaml\" into table loaded"
error_match: "LOAD DATA is unable to open file: The MySQL server is running with the --secure-file-priv option so it cannot execute this statement"
- name: secure_file_priv set to empty strings allows loading files
repos:
- name: repo1
with_files:
- name: "config.yaml"
contents: |
system_variables:
secure_file_priv: ""
listener:
port: {{get_port "repo1"}}
- name: "known_contents"
contents: |
system_variables:
secure_file_priv: ""
server:
args: ["-l", "trace", "--config", "config.yaml"]
dynamic_port: repo1
connections:
- on: repo1
queries:
- query: "select LOAD_FILE('known_contents')"
result:
columns: ["LOAD_FILE('known_contents')"]
rows: [["system_variables:\n secure_file_priv: \"\"\n"]]
- query: "select LOAD_FILE('./.dolt/../known_contents')"
result:
columns: ["LOAD_FILE('./.dolt/../known_contents')"]
rows: [["system_variables:\n secure_file_priv: \"\"\n"]]
- exec: "create table loaded (contents text)"
- exec: "load data infile \"known_contents\" into table loaded lines terminated by \"\\0\""
- query: "select contents from loaded"
result:
columns: ["contents"]
rows: [["system_variables:\n secure_file_priv: \"\"\n"]]