public ITestCluster CreateNewClusterAndAddToList(string clusterName, int dc1NodeCount, int dc2NodeCount, string keyspaceName, bool isUsingDefaultConfig, bool startCluster, int maxTries) { try { if (UseCtool) { // Create new cluster via ctool // At this point we don't have the means to create remote clusters throw new Exception("Setup FAIL: CTool cluster creation won't work until you create CToolBridge"); } else { // first stop any existing CCM clusters ShutDownAllCcmTestClusters(); // Create new cluster via ccm CcmCluster testCluster = new CcmCluster(CassandraVersionStr, TestUtils.GetTestClusterNameBasedOnCurrentEpochTime(), dc1NodeCount, dc2NodeCount, GetNextLocalIpPrefix(), DefaultKeyspaceName, isUsingDefaultConfig); testCluster.Create(startCluster); _testClusters.Add(testCluster); return testCluster; } } catch (Exception e) { Trace.TraceError("Unexpected Error occurred while trying to get test cluster with nodeCount: " + dc1NodeCount); Trace.TraceError("Error message: " + e.Message); Trace.TraceError("Stack trace: " + e.StackTrace); Trace.TraceError("Killing all Java processes and trying again ... "); } return null; }
public ITestCluster CreateNewClusterAndAddToList(string clusterName, int dc1NodeCount, int dc2NodeCount, string keyspaceName, bool isUsingDefaultConfig, bool startCluster, int maxTries) { try { if (UseCtool) { // Create new cluster via ctool // At this point we don't have the means to create remote clusters throw new Exception("Setup FAIL: CTool cluster creation won't work until you create CToolBridge"); } else { // first stop any existing CCM clusters ShutDownAllCcmTestClusters(); // Create new cluster via ccm CcmCluster testCluster = new CcmCluster(CassandraVersion, TestUtils.GetTestClusterNameBasedOnCurrentEpochTime(), dc1NodeCount, dc2NodeCount, GetNextLocalIpPrefix(), DefaultKeyspaceName, isUsingDefaultConfig); testCluster.Create(startCluster); _testClusters.Add(testCluster); return(testCluster); } } catch (Exception e) { Trace.TraceError("Unexpected Error occurred while trying to get test cluster with nodeCount: " + dc1NodeCount); Trace.TraceError("Error message: " + e.Message); Trace.TraceError("Stack trace: " + e.StackTrace); Trace.TraceError("Killing all Java processes and trying again ... "); } return(null); }
private static ITestCluster CreateNewNoRetry(int nodeLength, TestClusterOptions options, bool startCluster) { TryRemove(); options = options ?? new TestClusterOptions(); var testCluster = new CcmCluster( TestUtils.GetTestClusterNameBasedOnRandomString(), IpPrefix, DsePath, Executor, DefaultKeyspaceName, IsDse ? DseVersionString : CassandraVersionString); testCluster.Create(nodeLength, options); if (startCluster) { if (options.UseVNodes) { // workaround for https://issues.apache.org/jira/browse/CASSANDRA-16364 foreach (var i in Enumerable.Range(1, nodeLength)) { testCluster.Start(i, null, null, options.JvmArgs); } } else { testCluster.Start(options.JvmArgs); } } return(testCluster); }
/// <summary> /// Creates a new test cluster /// </summary> public static ITestCluster CreateNew(int nodeLength = 1, TestClusterOptions options = null, bool startCluster = true) { TryRemove(); options = options ?? new TestClusterOptions(); var testCluster = new CcmCluster(CassandraVersionText, TestUtils.GetTestClusterNameBasedOnTime(), IpPrefix, DefaultKeyspaceName); testCluster.Create(nodeLength, options); if (startCluster) { testCluster.Start(options.JvmArgs); } return testCluster; }
/// <summary> /// Creates a new test cluster /// </summary> public static ITestCluster CreateNew(int nodeLength = 1, TestClusterOptions options = null, bool startCluster = true) { TryRemove(); options = options ?? new TestClusterOptions(); var testCluster = new CcmCluster(CassandraVersionText, TestUtils.GetTestClusterNameBasedOnTime(), IpPrefix, DefaultKeyspaceName); testCluster.Create(nodeLength, options); if (startCluster) { testCluster.Start(options.JvmArgs); } return(testCluster); }
private void ShutDownAllCcmTestClustersExceptFor(CcmCluster ccmClusterWeDontWantToStop) { // if we are checking foreach (ITestCluster existingTestCluster in _testClusters) { if (existingTestCluster.GetType() == typeof(CcmCluster)) { CcmCluster currentlyRunningCcmCluster = (CcmCluster)existingTestCluster; if (currentlyRunningCcmCluster.Name != ccmClusterWeDontWantToStop.Name && currentlyRunningCcmCluster.CcmBridge.CcmDir != ccmClusterWeDontWantToStop.CcmBridge.CcmDir && currentlyRunningCcmCluster.IsStarted) { existingTestCluster.ShutDown(); } } } }
private static ITestCluster CreateNewNoRetry(int nodeLength, TestClusterOptions options, bool startCluster) { TryRemove(); options = options ?? new TestClusterOptions(); var testCluster = new CcmCluster( TestUtils.GetTestClusterNameBasedOnRandomString(), IpPrefix, DsePath, Executor, DefaultKeyspaceName, IsDse ? DseVersionString : CassandraVersionString); testCluster.Create(nodeLength, options); if (startCluster) { testCluster.Start(options.JvmArgs); } return(testCluster); }
/// <summary> /// Creates a new test cluster /// </summary> public static ITestCluster CreateNew(int nodeLength = 1, TestClusterOptions options = null, bool startCluster = true) { TryRemove(); options = options ?? new TestClusterOptions(); var testCluster = new CcmCluster(CassandraVersionText, TestUtils.GetTestClusterNameBasedOnTime(), IpPrefix, DefaultKeyspaceName); testCluster.Create(nodeLength, options); if (startCluster) { try { testCluster.Start(options.JvmArgs); } catch (TestInfrastructureException) when(nodeLength >= 3 && TestHelper.IsWin) { // On Windows, ccm might timeout with 3 or more nodes, give it another chance testCluster.Start(options.JvmArgs); } } LastInstance = testCluster; return(testCluster); }
private void ShutDownAllCcmTestClustersExceptFor(CcmCluster ccmClusterWeDontWantToStop) { // if we are checking foreach (ITestCluster existingTestCluster in _testClusters) { if (existingTestCluster.GetType() == typeof (CcmCluster)) { CcmCluster currentlyRunningCcmCluster = (CcmCluster) existingTestCluster; if (currentlyRunningCcmCluster.Name != ccmClusterWeDontWantToStop.Name && currentlyRunningCcmCluster.CcmBridge.CcmDir != ccmClusterWeDontWantToStop.CcmBridge.CcmDir && currentlyRunningCcmCluster.IsStarted) { existingTestCluster.ShutDown(); } } } }