mongodb/test/ctest_WT_cache
2018-10-29 09:35:21 +00:00

39 lines
1.2 KiB
Text

#
# WT cache size test for MongoDB image.
#
# Always use sourced from a specific container testfile
ctest_WT_cache() {
local name="WT_cache_size"
echo " Testing setting of WT cache size"
local database='db'
local user='user'
local password='password'
local admin_password='adminPassword'
local common_arguments="
-e MONGODB_DATABASE=${database}
-e MONGODB_USER=${user}
-e MONGODB_PASSWORD=${password}
-e MONGODB_ADMIN_PASSWORD=${admin_password}
"
# need to set these because `mongo_cmd` relies on global variables
USER=${user}
PASS=${password}
DB=${database}
ADMIN_PASS=${admin_password}
# minimum is 1G
CONTAINER_ARGS="$common_arguments -m 200M"
ct_create_container "${name}_200M"
test_connection ${name}_200M
mongo_admin_cmd "if (db.serverStatus()['wiredTiger']['cache']['maximum bytes configured'] == Math.pow(2,30)){quit(0)}; quit(1)"
# if greater that 1G, use 60% of (RAM - 1G)
CONTAINER_ARGS="$common_arguments -m 6G"
ct_create_container "${name}_6G"
test_connection ${name}_6G
mongo_admin_cmd "if (db.serverStatus()['wiredTiger']['cache']['maximum bytes configured'] == 3*Math.pow(2,30)){quit(0)}; quit(1)"
echo " Success!"
echo
}