[SERVER-14220] MongoRunner jstest helpers do not support array of command line options Created: 10/Jun/14  Updated: 06/Dec/22  Resolved: 11/May/20

Status: Closed
Project: Core Server
Component/s: Testing Infrastructure
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Shaun Verch Assignee: Backlog - Server Tooling and Methods (STM) (Inactive)
Resolution: Won't Fix Votes: 0
Labels: community-team, neweng, stm, tig-mongorunner
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Server Tooling & Methods
Operating System: ALL
Participants:

 Description   

The MongoRunner test helpers take a "configuration object" rather than an array, which means for example that you cannot test passing the same command line option twice.

This line here, in the function that does the option conversion:
https://github.com/mongodb/mongo/blob/r2.7.1/src/mongo/shell/servers.js#L280
seems to be in place to test for the array case. However, we fall into the typical javascript trap where typeof an
array is "object", so it doesn't work at all:
https://github.com/mongodb/mongo/blob/r2.7.1/src/mongo/shell/types.js#L660

We should either delete this code or fix "isObject" so that it returns the correct thing. As it is now, this is effectively dead and misleading code. As part of this we need to decide whether MongoRunner should support arrays for configuration or not.



 Comments   
Comment by Ryan Timmons [ 11/May/20 ]

Closing as wont-fix to indicate that there is currently no intention of doing this. Please re-open if there is priority for this. Perhaps this change could self-service by an appropriate server team if this is necessary rather than having to go thru the STM prioritization queue.

Comment by Matt Cotter [ 27/Sep/16 ]

How does the isArray (below) work?

var isArray = Array.isArray || function(value) {
  return Object.prototype.toString.call(value) === '[object Array]';
};

Why is it not:

var isArray = function(value) {
  return Array.isArray(value) || Object.prototype.toString.call(value) === '[object Array]';
};

Comment by Lucas Hrabovsky (Inactive) [ 16/Apr/15 ]

Proper way to check types:

var isObject = function(value) {
  return Object.prototype.toString.call(value) === '[object Object]';
};
 
var isNull = function(value) {
  return Object.prototype.toString.call(value) === '[object Null]';
};
 
var isArray = Array.isArray || function(value) {
  return Object.prototype.toString.call(value) === '[object Array]';
};

Generated at Thu Feb 08 03:34:12 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.