Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
m0_67397764
soar
提交
34e7d796
S
soar
项目概览
m0_67397764
/
soar
与 Fork 源项目一致
Fork自
Xiaomi / soar
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
soar
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
34e7d796
编写于
1月 13, 2019
作者:
X
xiyangxixian
提交者:
GitHub
1月 13, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #188 from Becivells/dev
Dev
上级
394a9e1c
5ef35c4f
变更
5
展开全部
显示空白变更内容
内联
并排
Showing
5 changed file
with
7681 addition
and
2 deletion
+7681
-2
test/fixture/test_Check_soar_for_pipe_input.golden
test/fixture/test_Check_soar_for_pipe_input.golden
+2505
-0
test/fixture/test_Check_soar_query_for_input_file.golden
test/fixture/test_Check_soar_query_for_input_file.golden
+2505
-0
test/fixture/test_Check_soar_query_for_input_string.golden
test/fixture/test_Check_soar_query_for_input_string.golden
+2505
-0
test/fixture/test_Check_the_default_config_of_the_changes.golden
...xture/test_Check_the_default_config_of_the_changes.golden
+126
-0
test/main.bats
test/main.bats
+40
-2
未找到文件。
test/fixture/test_Check_soar_for_pipe_input.golden
0 → 100644
浏览文件 @
34e7d796
此差异已折叠。
点击以展开。
test/fixture/test_Check_soar_query_for_input_file.golden
0 → 100644
浏览文件 @
34e7d796
此差异已折叠。
点击以展开。
test/fixture/test_Check_soar_query_for_input_string.golden
0 → 100644
浏览文件 @
34e7d796
此差异已折叠。
点击以展开。
test/fixture/test_Check_the_default_config_of_the_changes.golden
0 → 100644
浏览文件 @
34e7d796
online-dsn:
user: online-test
password: '********'
net: tcp
addr: 192.168.12.200:3307
schema: information_schema
charset: utf8mb4
collation: utf8mb4_general_ci
loc: GMT
tls: dsfsfdsf
server-public-key: AAAAB3NzaC1yc2EAAAADAQABAAABAQC0JFhoEgrl5/51UHlIIlfWwhiJLR/EEeF8enGnY0PnAldLQ8STdWD8Um2BUtVjgE9COl1X3mN4vMvnSm8A6aPn66enHn0hKzwh1GvcuZNTPgeaZyGKWG0kcvbziUjAPsxxvRvvoaUspSkRYAP/9vpq3SImJKuIHCPfjnGMurKV1n7W/QfpmNjUEwYOswDjL1Ik6Jy6Lrzf8T0hQEy+dYoV4zNM0HcROCXFuu1LyG+WTch3FW660BecNT8+c4sVTHuUMXgGot8OUtwgfXrt5ZL5as7cuyKiWsLVrtrtvL3T0ZHlV8qxQ3DT1gqjSw6jBOzyDOx3jwthAbdsWjyK4Oqp
maxallowedpacket: 419437
params:
charset: utf8mb4
timeout: 60
read-timeout: 70
write-timeout: 80
allow-native-passwords: false
allow-old-passwords: true
disable: false
test-dsn:
user: test-user
password: '********'
net: tcp
addr: 192.168.12.34:3309
schema: information_schema
charset: utf8mb4
collation: utf8mb4_general_ci
loc: GMT
tls: aabbbaa
server-public-key: this is a tset serverpublic
maxallowedpacket: 4194309
params:
charset: utf8mb4
timeout: 50
read-timeout: 40
write-timeout: 30
allow-native-passwords: false
allow-old-passwords: true
disable: false
allow-online-as-test: true
drop-test-temporary: false
cleanup-test-database: true
only-syntax-check: true
sampling-statistic-target: 110
sampling: true
sampling-condition: aaa
profiling: true
trace: true
explain: false
delimiter: ;
log-level: 5
log-output: /dev/null
report-type: html
report-css: sdfs
report-javascript: sdfsd
report-title: SQL优化分析报告-test
markdown-extensions: 92
markdown-html-flags: 10
ignore-rules:
- COL.012
rewrite-rules:
- delimiter
- orderbynull
- groupbyconst
- dmlorderby
- having
- star2columns
- insertcolumns
- distinctstar
blacklist: /tmp/blacklist
max-join-table-count: 12
max-group-by-cols-count: 15
max-distinct-count: 7
max-index-cols-count: 2
max-text-cols-count: 3
max-total-rows: 9999991
max-query-cost: 9992
spaghetti-query-length: 2041
allow-drop-index: true
max-in-count: 101
max-index-bytes-percolumn: 762
max-index-bytes: 3073
allow-charsets:
- utf8
- utf8mb4
allow-collates: []
allow-engines:
- innodb
- tokudb
max-index-count: 12
max-column-count: 41
max-value-count: 102
index-prefix: idx_
unique-key-prefix: uk_
max-subquery-depth: 6
max-varchar-length: 1022
column-not-allow-type:
- boolean
min-cardinality: 2
explain-sql-report-type: pretty
explain-type: extended
explain-format: traditional
explain-warn-select-type:
- ""
explain-warn-access-type:
- ALL
explain-max-keys: 31
explain-min-keys: 10
explain-max-rows: 10002
explain-warn-extra:
- Using temporary
- Using filesort
explain-max-filtered: 120
explain-warn-scalability:
- O(log(n))
show-warnings: true
show-last-query-cost: true
query: ""
list-heuristic-rules: true
list-rewrite-rules: true
list-test-sqls: true
list-report-types: true
verbose: true
dry-run: false
max-pretty-sql-length: 1022
test/main.bats
浏览文件 @
34e7d796
...
@@ -2,39 +2,77 @@
...
@@ -2,39 +2,77 @@
load test_helper
load test_helper
# 1. 检查版本输出格式是否正确
# 2. 检查版本是否为当天编译的
@test "Test soar version" {
@test "Test soar version" {
run ${SOAR_BIN} -version
run ${SOAR_BIN} -version
[ "$status" -eq 0 ]
[ "$status" -eq 0 ]
[ "${lines[0]%% *}" == "Version:" ]
[ "${lines[0]%% *}" == "Version:" ]
[ "${lines[1]%% *}" == "Branch:" ]
[ "${lines[1]%% *}" == "Branch:" ]
[ "${lines[2]%% *}" == "Compile:" ]
[ "${lines[2]%% *}" == "Compile:" ]
[ $(expr "${lines[2]}" : "Compile: $(date +'%Y-%m-%d').*") -ne 0 ]
[ $(expr "${lines[2]}" : "Compile: $(date +'%Y-%m-%d').*") -ne 0 ]
# 检查当前版本是否为今日编译的
}
}
# 3. 无参数执行是否正确
@test "No arguments prints message" {
@test "No arguments prints message" {
run ${SOAR_BIN}
run ${SOAR_BIN}
[ $status -eq 1 ]
[ $status -eq 1 ]
[ "${lines[0]}" == 'Args format error, use --help see how to use it!' ]
[ "${lines[0]}" == 'Args format error, use --help see how to use it!' ]
}
}
# 4. 检查输出的默认值是否改变 soar -print-config 加log-outpt 是因为日志默认是相对路径
@test "Run default printconfig cases" {
@test "Run default printconfig cases" {
${SOAR_BIN} -print-config -log-output=/dev/null > ${BATS_TMP_DIRNAME}/${BATS_TEST_NAME}.golden
${SOAR_BIN} -print-config -log-output=/dev/null > ${BATS_TMP_DIRNAME}/${BATS_TEST_NAME}.golden
run golden_diff
run golden_diff
[ $status -eq 0 ]
[ $status -eq 0 ]
}
}
# 5. soar 使用 config 配置文件路径是否正确
@test "Check config cases" {
@test "Check config cases" {
run ${SOAR_BIN_ENV} -check-config
run ${SOAR_BIN_ENV} -check-config
[ $status -eq 0 ]
[ $status -eq 0 ]
[ -z ${output} ]
[ -z ${output} ]
}
}
# 6. soar 使用配置文件修改默认参数是否正确
# 注意 不启用的配置为默认配置项目
@test "Check the default config of the changes" {
${SOAR_BIN} -config ${BATS_FIXTURE_DIRNAME}/${BATS_TEST_NAME}.golden -print-config -log-output=/dev/null > ${BATS_TMP_DIRNAME}/${BATS_TEST_NAME}.golden
# 去掉 2019/01/12 05:45:14.922 [D] [config.go:429] go-sql-driver/mysql.ParseDSN Error: invalid value / unknown server pub
sed -n '3,$p' ${BATS_TMP_DIRNAME}/${BATS_TEST_NAME}.golden > ${BATS_TMP_DIRNAME}/${BATS_TEST_NAME}.golden1
mv ${BATS_TMP_DIRNAME}/${BATS_TEST_NAME}.golden1 ${BATS_TMP_DIRNAME}/${BATS_TEST_NAME}.golden
run golden_diff
[ $status -eq 0 ]
}
# 8. 执行 soar -query 为string时是否正常
@test "Check soar query for input string" {
${SOAR_BIN} -query "`${SOAR_BIN} -list-test-sqls`" > ${BATS_TMP_DIRNAME}/${BATS_TEST_NAME}.golden
run golden_diff
[ $status -eq 0 ]
}
# 8. 执行 soar -query 为文件时是否正常
@test "Check soar query for input file" {
${SOAR_BIN} -query <(${SOAR_BIN} -list-test-sqls) > ${BATS_TMP_DIRNAME}/${BATS_TEST_NAME}.golden
run golden_diff
[ $status -eq 0 ]
}
# 9. 管道输入 sql 是否正常
@test "Check soar for pipe input" {
${SOAR_BIN} -list-test-sqls |${SOAR_BIN} > ${BATS_TMP_DIRNAME}/${BATS_TEST_NAME}.golden
run golden_diff
[ $status -eq 0 ]
}
# 17. 语法检查(正确)
@test "Syntax Check OK" {
@test "Syntax Check OK" {
run ${SOAR_BIN} -query "select * from film" -only-syntax-check
run ${SOAR_BIN} -query "select * from film" -only-syntax-check
[ $status -eq 0 ]
[ $status -eq 0 ]
[ -z $ouput ]
[ -z $ouput ]
}
}
# 17. 语法检查(错误)
@test "Syntax Check Error" {
@test "Syntax Check Error" {
run ${SOAR_BIN} -query "select * frm film" -only-syntax-check
run ${SOAR_BIN} -query "select * frm film" -only-syntax-check
[ $status -eq 1 ]
[ $status -eq 1 ]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录