Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added automated test for ODBC FailOver functionality #1371

Merged
merged 8 commits into from
Jul 27, 2019
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions core/src/test/scala/io/snappydata/util/ODBCDriverTestSuite.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@

package io.snappydata
import java.io._

import scala.language.{implicitConversions, postfixOps}
import scala.sys.process._


class ODBCDriverTestSuite extends SnappyTestRunner {
val snappyProductDir = System.getenv("SNAPPY_HOME")
val snappyNativeTestDir = s"$snappyProductDir/../../../store/native/tests"

test("ODBC_FailOverTest_NEWSERVER"){
try {
var scriptPath = s"$snappyNativeTestDir/failoverTest_NewServer.sh"
var consoleOutput = s"$scriptPath $snappyProductDir $snappyNativeTestDir".!!
assert(consoleOutput.contains("Test executed successfully"),
s"FailOver failed $consoleOutput")
} finally {

}
}

test("ODBC_FailOverTest_NONE"){
try {
var scriptPath = s"$snappyNativeTestDir/failoverTest_None.sh"
var consoleOutput = s"$scriptPath $snappyProductDir $snappyNativeTestDir".!!
assert(consoleOutput.contains("Test executed successfully, no failover tried"),
s"There failover tried but failed $consoleOutput")
} finally {

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,11 @@ public class SnappyPrms extends BasePrms {
*/
public static Long isUserConfTest;

/**
* (boolean) - whether to run the CPP script in hydra.
*/
public static Long isCppTest;

/**
* (boolean) - whether TPCH schema is used in test for running the queries concurrently.
*/
Expand Down
201 changes: 105 additions & 96 deletions dtests/src/test/java/io/snappydata/hydra/cluster/SnappyTest.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
io.snappydata.hydra.cluster.SnappyPrms-serverLauncherProps = " -heap-size=4g -memory-size=8g ";
//io.snappydata.hydra.cluster.SnappyPrms-serverLauncherProps += " -J-Dgemfire.VersionVector.VERBOSE=true -J-Dgemfirexd.debug.true=TraceTran,TraceQuery ";

io.snappydata.hydra.cluster.SnappyPrms-executorMemory = 4g;
io.snappydata.hydra.cluster.SnappyPrms-leadMemory = 4g;
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
io/snappydata/hydra/rowTableCPP/rowTableCPPTest.conf
A=snappyStore snappyStoreHosts=1 snappyStoreVMsPerHost=1 snappyStoreThreadsPerVM=4
B=lead leadHosts=1 leadVMsPerHost=1 leadThreadsPerVM=4
C=locator locatorHosts=1 locatorVMsPerHost=1 locatorThreadsPerVM=1
persistenceMode="sync" redundantCopies=1
dataFilesLocation="$GEMFIRE/../../../tests/common/src/main/resources/northwind/"
scriptLocation="$GEMFIRE/../../../store/native/tests/failoverTest_Retry.sh"
tableType="PartitionedRow"
timeduration=60
scriptPWD="$GEMFIRE/../../../store/native/tests/"
numVMsToStop=1

Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// INCLUDE $JTESTS/io/snappydata/hydra/connectionPool/connPool.inc;

INCLUDE $JTESTS/io/snappydata/hydra/northwind/startEmbeddedModeCluster.conf;

INCLUDE $JTESTS/io/snappydata/hydra/rowTableCPP/serverHA.inc;
INCLUDE $JTESTS/io/snappydata/hydra/northwind/backUpServerConfig.inc;

INITTASK taskClass = io.snappydata.hydra.cluster.SnappyTest taskMethod = HydraTask_executeSQLScripts
io.snappydata.hydra.cluster.SnappyPrms-sqlScriptNames = create_and_load_partitionedRowTables_persistent.sql
io.snappydata.hydra.cluster.SnappyPrms-dataLocation = ${dataFilesLocation}
threadGroups = snappyThreads
;

TASK taskClass = io.snappydata.hydra.cluster.SnappyTest taskMethod = HydraTask_executeScripts
io.snappydata.hydra.cluster.SnappyPrms-scriptNames = ${scriptLocation}
io.snappydata.hydra.cluster.SnappyPrms-scriptArgs = ${timeduration},${scriptPWD}
threadGroups = snappyStoreThreads
maxThreads = 1
;

hydra.Prms-totalTaskTimeSec = 900;
hydra.Prms-maxResultWaitSec = 1200;
io.snappydata.hydra.cluster.SnappyPrms-isCppTest = true;
/*

bisenpiyush marked this conversation as resolved.
Show resolved Hide resolved
connectionPool.SnappyConnectionPoolPrms-connectionProperties = "route-query=false";*/
19 changes: 19 additions & 0 deletions dtests/src/test/java/io/snappydata/hydra/rowTableCPP/serverHA.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
io.snappydata.hydra.cluster.SnappyPrms-waitTimeBeforeNextCycleVM = 120; //how long to wait before

io.snappydata.hydra.cluster.SnappyPrms-cycleVms = true;

util.StopStartPrms-stopModes = NICE_KILL;
util.StopStartPrms-numVMsToStop = RANGE 1 ${numVMsToStop} EGNAR;

INITTASK taskClass = util.StopStartVMs taskMethod = StopStart_initTask
threadGroups = snappyThreads, locatorThreads, snappyStoreThreads, leadThreads;

TASK taskClass = io.snappydata.hydra.cluster.SnappyTest taskMethod = HydraTask_cycleStoreVms
maxThreads = 1
startInterval = 60
threadGroups = snappyThreads
maxTimesToRun = 5
;

CLOSETASK taskClass = io.snappydata.hydra.cluster.SnappyTest taskMethod = restoreServerConfigData
threadGroups = snappyThreads;