summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
authorBernard Gorman <bernard.gorman@gmail.com>2017-07-31 00:33:31 +0100
committerBernard Gorman <bernard.gorman@gmail.com>2017-08-02 17:09:37 +0100
commitcccb34c66a14bb335c60fe57ed8376ada8b0326c (patch)
tree75f53e5a425130f42929e0b76b73ed49bbb99b18 /jstests
parent443a8f1af11374d8d8e3a35492415f8464987d54 (diff)
downloadmongo-cccb34c66a14bb335c60fe57ed8376ada8b0326c.tar.gz
SERVER-30084 Validate that at least one shard is present when running collectionless aggregations on mongos
Diffstat (limited to 'jstests')
-rw-r--r--jstests/aggregation/bugs/server30084.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/jstests/aggregation/bugs/server30084.js b/jstests/aggregation/bugs/server30084.js
new file mode 100644
index 00000000000..926b032e229
--- /dev/null
+++ b/jstests/aggregation/bugs/server30084.js
@@ -0,0 +1,18 @@
+/**
+ * Test that running a $currentOp aggregation on a cluster with no shards returns an empty result
+ * set, and does not cause the mongoS floating point failure described in SERVER-30084.
+ */
+(function() {
+ const st = new ShardingTest({shards: 0, config: 1});
+
+ const adminDB = st.s.getDB("admin");
+
+ assert.commandWorked(
+ adminDB.runCommand({aggregate: 1, pipeline: [{$currentOp: {}}], cursor: {}}));
+ assert.commandWorked(adminDB.currentOp());
+
+ assert.eq(adminDB.aggregate([{$currentOp: {}}]).itcount(), 0);
+ assert.eq(adminDB.currentOp().inprog.length, 0);
+
+ st.stop();
+})(); \ No newline at end of file