summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXiangyu Yao <xiangyu.yao@mongodb.com>2019-02-25 14:38:18 -0500
committerXiangyu Yao <xiangyu.yao@mongodb.com>2019-02-25 18:34:13 -0500
commit89ac0ad62309ee4103cadb0a1d56581923b51d1e (patch)
tree827b8d0d277e357d1b0e777c87d50ea882b05238
parent2151d1d219bbaff918db0d43fcb812231c20d53a (diff)
downloadmongo-89ac0ad62309ee4103cadb0a1d56581923b51d1e.tar.gz
SERVER-35732 Test dbStats.fsUsedSize behavior for database with hyphenated names
(cherry picked from commit 2e206b90bde9e41263d4073522248091c49437fa)
-rw-r--r--jstests/noPassthrough/hyphenated_database_name.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/jstests/noPassthrough/hyphenated_database_name.js b/jstests/noPassthrough/hyphenated_database_name.js
new file mode 100644
index 00000000000..6387e8f167f
--- /dev/null
+++ b/jstests/noPassthrough/hyphenated_database_name.js
@@ -0,0 +1,24 @@
+/**
+ * Test that hyphenated database name can work with dbStats when directoryperdb is turned on.
+ *
+ * @tags: [requires_persistence]
+ */
+(function() {
+ "use strict";
+ var isDirectoryPerDBSupported = jsTest.options().storageEngine == "wiredTiger" ||
+ jsTest.options().storageEngine == "mmapv1" || !jsTest.options().storageEngine;
+ if (!isDirectoryPerDBSupported)
+ return;
+
+ const dbName = "test-hyphen";
+ let conn = MongoRunner.runMongod({directoryperdb: ''});
+
+ conn.getDB(dbName).a.insert({x: 1});
+ let res = conn.getDB(dbName).runCommand({dbStats: 1, scale: 1});
+ jsTestLog("dbStats: " + tojson(res));
+ assert(res.db == "test-hyphen");
+ assert(res.fsUsedSize > 0);
+ assert(res.fsTotalSize > 0);
+
+ MongoRunner.stopMongod(conn);
+})();