MCPcopy Create free account
hub / github.com/apache/cassandra-nodejs-driver / executeIfVersion

Function executeIfVersion

test/test-helper.js:1984–2001  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

1982 * @param {Array} args the arguments to apply to the function.
1983 */
1984function 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].

Callers 1

test-helper.jsFile · 0.85

Calls 1

getCassandraVersionMethod · 0.65

Tested by

no test coverage detected