* Conditionally executes func if testVersion is <= the current cassandra version. * @param {String} testVersion Minimum version of Cassandra needed. * @param {Function} func The function to conditionally execute. * @param {Array} args the arguments to apply to the function.
(testVersion, func, args)
| 1982 | * @param {Array} args the arguments to apply to the function. |
| 1983 | */ |
| 1984 | function executeIfVersion (testVersion, func, args) { |
| 1985 | const serverInfo = helper.getServerInfo(); |
| 1986 | let invokeFunction = false; |
| 1987 | |
| 1988 | if (testVersion.startsWith('dse-')) { |
| 1989 | if (serverInfo.isDse) { |
| 1990 | // Compare only if the server instance is DSE |
| 1991 | invokeFunction = helper.versionCompare(serverInfo.version, testVersion.substr(4)); |
| 1992 | } |
| 1993 | } else { |
| 1994 | // Use the C* version (of DSE or the actual C* version) |
| 1995 | invokeFunction = helper.versionCompare(helper.getCassandraVersion(), testVersion); |
| 1996 | } |
| 1997 | |
| 1998 | if (invokeFunction) { |
| 1999 | func.apply(this, args); |
| 2000 | } |
| 2001 | } |
| 2002 | |
| 2003 | /** |
| 2004 | * Policy only suitable for testing, it creates a fixed query plan containing the nodes in the same order, i.e. [a, b]. |
no test coverage detected