diff options
Diffstat (limited to 'plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_url_prefix.test')
-rw-r--r-- | plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_url_prefix.test | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_url_prefix.test b/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_url_prefix.test new file mode 100644 index 00000000..4d26affb --- /dev/null +++ b/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_url_prefix.test @@ -0,0 +1,93 @@ +# MDEV-28277: Checking for mandatory "/v1/" prefix in the URL + +# The test presumes that the local vault is running at $VAULT_ADDR, +# and the token is configured in $VAULT_TOKEN. + +--source include/have_innodb.inc +--source hashicorp_plugin.inc + +--exec vault secrets disable bug > /dev/null +--exec vault secrets enable -path /bug -version=2 kv > /dev/null +--exec vault kv put /bug/1 data=01234567890123456789012345678901 > /dev/null + +--source include/shutdown_mysqld.inc + +--let $LOG_FILE=$MYSQLTEST_VARDIR/log/vault.err +--error 0,1 +--remove_file $LOG_FILE + +--let $vault_defaults=--plugin-load-add=hashicorp_key_management --hashicorp_key_management=force --hashicorp-key-management-check-kv-version=off --hashicorp-key-management-token="$VAULT_TOKEN" +--let $defaults=--defaults-group-suffix=.1 --defaults-file=$MYSQLTEST_VARDIR/my.cnf $vault_defaults --log-error=$LOG_FILE + +--error 1 +--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="/" +--error 1 +--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="abcd" +--error 1 +--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="abcd/" +--error 1 +--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="abcd//" +--error 1 +--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="/abcd" +--error 1 +--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="abcd/v" +--error 1 +--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="a/v1" +--error 1 +--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="a/v1b" +--error 1 +--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="a/v1/" +--error 1 +--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="a/v1///" +--error 1 +--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="a///v1/" +--error 1 +--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="///v1/a" +--error 1 +--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="http://" +--error 1 +--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="http:///" +--error 1 +--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="http://a" +--error 1 +--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="http://abcd" +--error 1 +--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="http://abcd/" +--error 1 +--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="http://abcd//" +--error 1 +--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="http:///abcd" +--error 1 +--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="http://abcd/v" +--error 1 +--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="http://a/v1" +--error 1 +--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="http://a/v1b" +--error 1 +--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="http://a/v1/" +--error 1 +--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="http://a/v1///" +--error 1 +--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="http://a///v1/" +--error 1 +--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="http://///v1/a" + +--exec grep -oE "\[ERROR\] .*: hashicorp: .*" -- $LOG_FILE + +--remove_file $LOG_FILE + +--let $restart_parameters=$vault_defaults --hashicorp-key-management-vault-url="$VAULT_ADDR/v1/bug///" +--let $restart_noprint=1 +--source include/start_mysqld.inc + +CREATE TABLE t1 (a VARCHAR(8)) ENGINE=InnoDB ENCRYPTED=YES ENCRYPTION_KEY_ID=1; +INSERT INTO t1 VALUES ('foo'),('bar'); + +# Cleanup + +DROP TABLE t1; + +--let $restart_parameters= +--source include/restart_mysqld.inc + +--exec vault secrets disable bug > /dev/null |