# # 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 256MB 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'] == 256*Math.pow(2,20)){quit(0)}; quit(1)" # if greater that 256MB, use 50% 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'] == 2.5*Math.pow(2,30)){quit(0)}; quit(1)" # use WIREDTIGER_CACHE_SIZE to set WT cache CONTAINER_ARGS="$common_arguments -e WIREDTIGER_CACHE_SIZE=2684354560B" ct_create_container "${name}_var" test_connection ${name}_var mongo_admin_cmd "if (db.serverStatus()['wiredTiger']['cache']['maximum bytes configured'] == 2.5*Math.pow(2,30)){quit(0)}; quit(1)" echo " Success!" echo }