Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-36066

"sleep" command not available with mongos with enableTestCommands=1

    • Sharding NYC

      As part of out test suite, we use enableTestCommands to be able to use things like the sleep command. When running our tests, we verify for tests that make use of sleep that enableTestCommands is enabled by running getParameter against the (primary) server.

      I've recently extended our test suite to also cover a sharded cluster, and now have run into the problem. Even though calling {{ getParameter : 1, parameter: "enableTestCommands" }} on mongos returns {{ ok: 1 }}, the sleep command is not available, and I get the following error when attempting to run it.

      This is my full command transcript of what the test internally would run:

      mongos> db.runCommand( { getParameter: 1, 'enableTestCommands' : 1 } );
      {
      	"enableTestCommands" : true,
      	"ok" : 1,
      	"operationTime" : Timestamp(1531318115, 1),
      	"$clusterTime" : {
      		"clusterTime" : Timestamp(1531318115, 1),
      		"signature" : {
      			"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
      			"keyId" : NumberLong(0)
      		}
      	}
      }
      mongos> db.runCommand( { sleep: 1 } );
      {
      	"ok" : 0,
      	"errmsg" : "no such cmd: sleep",
      	"code" : 59,
      	"codeName" : "CommandNotFound",
      	"operationTime" : Timestamp(1531318125, 1),
      	"$clusterTime" : {
      		"clusterTime" : Timestamp(1531318125, 1),
      		"signature" : {
      			"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
      			"keyId" : NumberLong(0)
      		}
      	}
      }
      

      When connecting to a standalone node, the following is returned (as expected):

      > db.runCommand( { getParameter: 1, 'enableTestCommands' : 1 } );
      {
      	"enableTestCommands" : true,
      	"ok" : 1,
      	"$configServerState" : {
      		"opTime" : {
      			"ts" : Timestamp(1531318185, 1),
      			"t" : NumberLong(1)
      		}
      	}
      }
      > db.runCommand( { sleep: 1 } );
      {
      	"ok" : 1,
      	"$configServerState" : {
      		"opTime" : {
      			"ts" : Timestamp(1531318201, 1),
      			"t" : NumberLong(1)
      		}
      	}
      }
      
      

            Assignee:
            backlog-server-sharding-nyc [DO NOT USE] Backlog - Sharding NYC
            Reporter:
            derick Derick Rethans
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: