The batch_write_command_sharded.js has a step, which directly writes to the config servers and then performs operation, which expects the data just written to be visible by mongos. This may not happen if the write has not propagated to the secondary node chosen by mongos.
We should fix the test to wait for replication.