-
-
Notifications
You must be signed in to change notification settings - Fork 2k
MDEV-31527: Add --validate-config option to check configuration without starting the server #4716
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
bodyhedia44
wants to merge
1
commit into
MariaDB:main
Choose a base branch
from
bodyhedia44:MDEV-31527-validate-config
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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,60 @@ | ||
| # | ||
| # MDEV-31527: Add --validate-config option to check configuration | ||
| # without starting the server | ||
| # | ||
| # | ||
| # Test 1: --validate-config with valid configuration should succeed (exit 0) | ||
| # | ||
| FOUND 1 /Configuration is valid/ in mdev-31527-test1.log | ||
| # | ||
| # Test 2: --validate-config with unknown option should fail (exit 2) | ||
| # | ||
| FOUND 1 /unknown option '--nonexistentoption'/ in mdev-31527-test2.log | ||
| # | ||
| # Test 3: --validate-config should not start the server (no pid file) | ||
| # | ||
| # | ||
| # Test 4: --validate-config should not produce help output | ||
| # | ||
| NOT FOUND /Starts the MariaDB database server/ in mdev-31527-test4.log | ||
| # | ||
| # Test 5: --validate-config with bad option in config file should fail | ||
| # | ||
| FOUND 1 /unknown variable 'zzz_bogus_option=123'/ in mdev-31527-test5.log | ||
| # | ||
| # Test 6: --validate-config with valid config file should succeed | ||
| # | ||
| FOUND 1 /Configuration is valid/ in mdev-31527-test6.log | ||
| # | ||
| # Test 7: --validate-config with --help (help takes precedence, | ||
| # 'Configuration is valid' should NOT be printed) | ||
| # | ||
| FOUND 1 /Starts the MariaDB database server/ in mdev-31527-test7.log | ||
| NOT FOUND /Configuration is valid/ in mdev-31527-test7.log | ||
| # | ||
| # Test 8: --validate-config with --verbose should still succeed (exit 0) | ||
| # | ||
| FOUND 1 /Configuration is valid/ in mdev-31527-test8.log | ||
| # | ||
| # Test 9: --validate-config with --bootstrap should succeed (exit 0) | ||
| # | ||
| FOUND 1 /Configuration is valid/ in mdev-31527-test9.log | ||
| # | ||
| # Test 10: --validate-config with --version (version takes precedence, | ||
| # 'Configuration is valid' should NOT be printed) | ||
| # | ||
| FOUND 1 /Ver [0-9]/ in mdev-31527-test10.log | ||
| NOT FOUND /Configuration is valid/ in mdev-31527-test10.log | ||
| # | ||
| # Test 11: --help --validate-config --invalid-config should print help | ||
| # and exit cleanly (help takes precedence) | ||
| # | ||
| FOUND 1 /Starts the MariaDB database server/ in mdev-31527-test11.log | ||
| NOT FOUND /unknown option/ in mdev-31527-test11.log | ||
| # | ||
| # Test 12: --version --validate-config --invalid-config should print version | ||
| # and exit cleanly (version takes precedence) | ||
| # | ||
| FOUND 1 /Ver [0-9]/ in mdev-31527-test12.log | ||
| NOT FOUND /unknown option/ in mdev-31527-test12.log | ||
| # End of 13.0 tests |
This file contains hidden or 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,156 @@ | ||
| # | ||
| # MDEV-31527: Add --validate-config option to check configuration | ||
| # without starting the server | ||
| # | ||
|
|
||
| --source include/not_embedded.inc | ||
|
|
||
| # mysqld refuses to run as root normally. | ||
| --source include/not_as_root.inc | ||
|
|
||
| --echo # | ||
| --echo # MDEV-31527: Add --validate-config option to check configuration | ||
| --echo # without starting the server | ||
| --echo # | ||
|
|
||
| --echo # | ||
| --echo # Test 1: --validate-config with valid configuration should succeed (exit 0) | ||
| --echo # | ||
| --exec $MYSQLD_BOOTSTRAP_CMD --validate-config >$MYSQLTEST_VARDIR/tmp/mdev-31527-test1.log 2>&1 | ||
|
raghunandanbhat marked this conversation as resolved.
|
||
| --let SEARCH_FILE=$MYSQLTEST_VARDIR/tmp/mdev-31527-test1.log | ||
| --let SEARCH_PATTERN=Configuration is valid | ||
| --source include/search_pattern_in_file.inc | ||
| --remove_file $MYSQLTEST_VARDIR/tmp/mdev-31527-test1.log | ||
|
|
||
| --echo # | ||
| --echo # Test 2: --validate-config with unknown option should fail (exit 2) | ||
| --echo # | ||
| --error 2 | ||
| --exec $MYSQLD_BOOTSTRAP_CMD --validate-config --nonexistentoption >$MYSQLTEST_VARDIR/tmp/mdev-31527-test2.log 2>&1 | ||
| --let SEARCH_FILE=$MYSQLTEST_VARDIR/tmp/mdev-31527-test2.log | ||
| --let SEARCH_PATTERN=unknown option '--nonexistentoption' | ||
| --source include/search_pattern_in_file.inc | ||
| --remove_file $MYSQLTEST_VARDIR/tmp/mdev-31527-test2.log | ||
|
|
||
| --echo # | ||
| --echo # Test 3: --validate-config should not start the server (no pid file) | ||
| --echo # | ||
| --exec $MYSQLD_BOOTSTRAP_CMD --validate-config --pid-file=$MYSQLTEST_VARDIR/tmp/mdev-31527-validate.pid >$MYSQLTEST_VARDIR/tmp/mdev-31527-test3.log 2>&1 | ||
| --error 1 | ||
| --file_exists $MYSQLTEST_VARDIR/tmp/mdev-31527-validate.pid | ||
| --remove_file $MYSQLTEST_VARDIR/tmp/mdev-31527-test3.log | ||
|
|
||
| --echo # | ||
| --echo # Test 4: --validate-config should not produce help output | ||
| --echo # | ||
| --exec $MYSQLD_BOOTSTRAP_CMD --validate-config >$MYSQLTEST_VARDIR/tmp/mdev-31527-test4.log 2>&1 | ||
| --let SEARCH_FILE=$MYSQLTEST_VARDIR/tmp/mdev-31527-test4.log | ||
| --let SEARCH_PATTERN=Starts the MariaDB database server | ||
| --source include/search_pattern_in_file.inc | ||
| --remove_file $MYSQLTEST_VARDIR/tmp/mdev-31527-test4.log | ||
|
|
||
| --echo # | ||
| --echo # Test 5: --validate-config with bad option in config file should fail | ||
| --echo # | ||
| --write_file $MYSQLTEST_VARDIR/tmp/mdev-31527-bad.cnf | ||
| [mariadb] | ||
| zzz_bogus_option=123 | ||
| EOF | ||
| --error 7 | ||
| --exec $MYSQLD --defaults-file=$MYSQLTEST_VARDIR/tmp/mdev-31527-bad.cnf --validate-config >$MYSQLTEST_VARDIR/tmp/mdev-31527-test5.log 2>&1 | ||
| --let SEARCH_FILE=$MYSQLTEST_VARDIR/tmp/mdev-31527-test5.log | ||
| --let SEARCH_PATTERN=unknown variable 'zzz_bogus_option=123' | ||
| --source include/search_pattern_in_file.inc | ||
| --remove_file $MYSQLTEST_VARDIR/tmp/mdev-31527-test5.log | ||
| --remove_file $MYSQLTEST_VARDIR/tmp/mdev-31527-bad.cnf | ||
|
|
||
|
bodyhedia44 marked this conversation as resolved.
|
||
| --echo # | ||
| --echo # Test 6: --validate-config with valid config file should succeed | ||
| --echo # | ||
| --write_file $MYSQLTEST_VARDIR/tmp/mdev-31527-good.cnf | ||
| [mariadb] | ||
| max_connections=50 | ||
| EOF | ||
| --exec $MYSQLD --defaults-file=$MYSQLTEST_VARDIR/tmp/mdev-31527-good.cnf --validate-config >$MYSQLTEST_VARDIR/tmp/mdev-31527-test6.log 2>&1 | ||
| --let SEARCH_FILE=$MYSQLTEST_VARDIR/tmp/mdev-31527-test6.log | ||
| --let SEARCH_PATTERN=Configuration is valid | ||
| --source include/search_pattern_in_file.inc | ||
| --remove_file $MYSQLTEST_VARDIR/tmp/mdev-31527-test6.log | ||
| --remove_file $MYSQLTEST_VARDIR/tmp/mdev-31527-good.cnf | ||
|
|
||
| --echo # | ||
| --echo # Test 7: --validate-config with --help (help takes precedence, | ||
| --echo # 'Configuration is valid' should NOT be printed) | ||
| --echo # | ||
| --exec $MYSQLD_BOOTSTRAP_CMD --validate-config --help >$MYSQLTEST_VARDIR/tmp/mdev-31527-test7.log 2>&1 | ||
|
raghunandanbhat marked this conversation as resolved.
|
||
| --let SEARCH_FILE=$MYSQLTEST_VARDIR/tmp/mdev-31527-test7.log | ||
| --let SEARCH_PATTERN=Starts the MariaDB database server | ||
| --source include/search_pattern_in_file.inc | ||
| --let SEARCH_PATTERN=Configuration is valid | ||
| --let SEARCH_ABORT=FOUND | ||
| --source include/search_pattern_in_file.inc | ||
| --let SEARCH_ABORT= | ||
| --remove_file $MYSQLTEST_VARDIR/tmp/mdev-31527-test7.log | ||
|
|
||
| --echo # | ||
| --echo # Test 8: --validate-config with --verbose should still succeed (exit 0) | ||
| --echo # | ||
| --exec $MYSQLD_BOOTSTRAP_CMD --validate-config --verbose >$MYSQLTEST_VARDIR/tmp/mdev-31527-test8.log 2>&1 | ||
| --let SEARCH_FILE=$MYSQLTEST_VARDIR/tmp/mdev-31527-test8.log | ||
| --let SEARCH_PATTERN=Configuration is valid | ||
| --source include/search_pattern_in_file.inc | ||
| --remove_file $MYSQLTEST_VARDIR/tmp/mdev-31527-test8.log | ||
|
|
||
| --echo # | ||
| --echo # Test 9: --validate-config with --bootstrap should succeed (exit 0) | ||
| --echo # | ||
| --exec $MYSQLD_BOOTSTRAP_CMD --validate-config --bootstrap >$MYSQLTEST_VARDIR/tmp/mdev-31527-test9.log 2>&1 | ||
| --let SEARCH_FILE=$MYSQLTEST_VARDIR/tmp/mdev-31527-test9.log | ||
| --let SEARCH_PATTERN=Configuration is valid | ||
| --source include/search_pattern_in_file.inc | ||
| --remove_file $MYSQLTEST_VARDIR/tmp/mdev-31527-test9.log | ||
|
|
||
|
gkodinov marked this conversation as resolved.
|
||
| --echo # | ||
| --echo # Test 10: --validate-config with --version (version takes precedence, | ||
| --echo # 'Configuration is valid' should NOT be printed) | ||
| --echo # | ||
| --exec $MYSQLD_BOOTSTRAP_CMD --validate-config --version >$MYSQLTEST_VARDIR/tmp/mdev-31527-test10.log 2>&1 | ||
| --let SEARCH_FILE=$MYSQLTEST_VARDIR/tmp/mdev-31527-test10.log | ||
| --let SEARCH_PATTERN=Ver [0-9] | ||
| --source include/search_pattern_in_file.inc | ||
| --let SEARCH_PATTERN=Configuration is valid | ||
| --let SEARCH_ABORT=FOUND | ||
| --source include/search_pattern_in_file.inc | ||
| --let SEARCH_ABORT= | ||
| --remove_file $MYSQLTEST_VARDIR/tmp/mdev-31527-test10.log | ||
|
|
||
| --echo # | ||
| --echo # Test 11: --help --validate-config --invalid-config should print help | ||
| --echo # and exit cleanly (help takes precedence) | ||
| --echo # | ||
| --exec $MYSQLD_BOOTSTRAP_CMD --help --validate-config --invalid-config >$MYSQLTEST_VARDIR/tmp/mdev-31527-test11.log 2>&1 | ||
| --let SEARCH_FILE=$MYSQLTEST_VARDIR/tmp/mdev-31527-test11.log | ||
| --let SEARCH_PATTERN=Starts the MariaDB database server | ||
| --source include/search_pattern_in_file.inc | ||
| --let SEARCH_PATTERN=unknown option | ||
| --let SEARCH_ABORT=FOUND | ||
| --source include/search_pattern_in_file.inc | ||
| --let SEARCH_ABORT= | ||
| --remove_file $MYSQLTEST_VARDIR/tmp/mdev-31527-test11.log | ||
|
|
||
| --echo # | ||
| --echo # Test 12: --version --validate-config --invalid-config should print version | ||
| --echo # and exit cleanly (version takes precedence) | ||
| --echo # | ||
| --exec $MYSQLD_BOOTSTRAP_CMD --version --validate-config --invalid-config >$MYSQLTEST_VARDIR/tmp/mdev-31527-test12.log 2>&1 | ||
| --let SEARCH_FILE=$MYSQLTEST_VARDIR/tmp/mdev-31527-test12.log | ||
| --let SEARCH_PATTERN=Ver [0-9] | ||
| --source include/search_pattern_in_file.inc | ||
| --let SEARCH_PATTERN=unknown option | ||
| --let SEARCH_ABORT=FOUND | ||
| --source include/search_pattern_in_file.inc | ||
| --let SEARCH_ABORT= | ||
| --remove_file $MYSQLTEST_VARDIR/tmp/mdev-31527-test12.log | ||
|
|
||
| --echo # End of 13.0 tests | ||
|
|
||
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.