From 7cb09a694ae9d57243a5408662902524800658ba Mon Sep 17 00:00:00 2001 From: Piyush Bisen Date: Tue, 30 Jul 2019 12:57:59 +0530 Subject: [PATCH 1/3] Added environment varibale for enable/disable ODBC Tests for run them use -Pnative.enable=true --- core/build.gradle | 3 +++ .../io/snappydata/CommandLineToolsSuite.scala | 22 +++++++++---------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/core/build.gradle b/core/build.gradle index f69a3c04d7..ed405f6572 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -143,6 +143,9 @@ if (rootProject.hasProperty('enablePublish')) { } scalaTest { + if (rootProject.hasProperty('native.enabled')) { + environment 'SNAPPY_NATIVE_ENABLED': rootProject.property('native.enabled') + } dependsOn ':cleanScalaTest' doFirst { // cleanup files since scalatest plugin does not honour workingDir yet diff --git a/core/src/test/scala/io/snappydata/CommandLineToolsSuite.scala b/core/src/test/scala/io/snappydata/CommandLineToolsSuite.scala index 6446154a3c..4e95ccedcb 100644 --- a/core/src/test/scala/io/snappydata/CommandLineToolsSuite.scala +++ b/core/src/test/scala/io/snappydata/CommandLineToolsSuite.scala @@ -288,25 +288,25 @@ class CommandLineToolsSuite extends SnappyTestRunner { s"-locators option still displayed in run command's usage text!") } - ignore("ODBC_FailOverTest_NEWSERVER"){ - try { + test("ODBC_FailOverTest_AddServer_BeforeConn") { + val flag = System.getenv("SNAPPY_NATIVE_ENABLED") + if (flag.equalsIgnoreCase("true")) { var scriptPath = s"$snappyNativeTestDir/failoverTest_NewServer.sh" var consoleOutput = s"$scriptPath $snappyProductDir $snappyNativeTestDir".!! - assert(consoleOutput.contains("Test executed successfully"), + assert(consoleOutput.contains("Test executed successfully connected to"), s"FailOver failed $consoleOutput") - } finally { - + System.out.println(consoleOutput) } } - ignore("ODBC_FailOverTest_NONE"){ - try { + test("ODBC_FailOverTest_AddServer_AfterConn") { + val flag = System.getenv("SNAPPY_NATIVE_ENABLED") + if (flag.equalsIgnoreCase("true")) { 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 { - + assert(consoleOutput.contains("Test executed successfully connected to"), + s"Failed to create new connection $consoleOutput") + System.out.println(consoleOutput) } } } From 93693366eb9f1bb00c39a5ea1325614219a8c7a1 Mon Sep 17 00:00:00 2001 From: Piyush Bisen Date: Tue, 30 Jul 2019 13:22:33 +0530 Subject: [PATCH 2/3] Changed the shell script names For run this test use -Pnative.enabled=true --- core/src/test/scala/io/snappydata/CommandLineToolsSuite.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/test/scala/io/snappydata/CommandLineToolsSuite.scala b/core/src/test/scala/io/snappydata/CommandLineToolsSuite.scala index 4e95ccedcb..c69eaf0008 100644 --- a/core/src/test/scala/io/snappydata/CommandLineToolsSuite.scala +++ b/core/src/test/scala/io/snappydata/CommandLineToolsSuite.scala @@ -291,7 +291,7 @@ class CommandLineToolsSuite extends SnappyTestRunner { test("ODBC_FailOverTest_AddServer_BeforeConn") { val flag = System.getenv("SNAPPY_NATIVE_ENABLED") if (flag.equalsIgnoreCase("true")) { - var scriptPath = s"$snappyNativeTestDir/failoverTest_NewServer.sh" + var scriptPath = s"$snappyNativeTestDir/failoverTest_AddServer_BeforeConn.sh" var consoleOutput = s"$scriptPath $snappyProductDir $snappyNativeTestDir".!! assert(consoleOutput.contains("Test executed successfully connected to"), s"FailOver failed $consoleOutput") @@ -302,7 +302,7 @@ class CommandLineToolsSuite extends SnappyTestRunner { test("ODBC_FailOverTest_AddServer_AfterConn") { val flag = System.getenv("SNAPPY_NATIVE_ENABLED") if (flag.equalsIgnoreCase("true")) { - var scriptPath = s"$snappyNativeTestDir/failoverTest_None.sh" + var scriptPath = s"$snappyNativeTestDir/failoverTest_AddServer_AfterConn.sh" var consoleOutput = s"$scriptPath $snappyProductDir $snappyNativeTestDir".!! assert(consoleOutput.contains("Test executed successfully connected to"), s"Failed to create new connection $consoleOutput") From f9e8b4ef2cb12eba28273b0c1f87d22e0cb6ef32 Mon Sep 17 00:00:00 2001 From: Piyush Bisen Date: Wed, 31 Jul 2019 11:23:21 +0530 Subject: [PATCH 3/3] Added null check condition in tests --- core/src/test/scala/io/snappydata/CommandLineToolsSuite.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/test/scala/io/snappydata/CommandLineToolsSuite.scala b/core/src/test/scala/io/snappydata/CommandLineToolsSuite.scala index c69eaf0008..da55452a9c 100644 --- a/core/src/test/scala/io/snappydata/CommandLineToolsSuite.scala +++ b/core/src/test/scala/io/snappydata/CommandLineToolsSuite.scala @@ -290,7 +290,7 @@ class CommandLineToolsSuite extends SnappyTestRunner { test("ODBC_FailOverTest_AddServer_BeforeConn") { val flag = System.getenv("SNAPPY_NATIVE_ENABLED") - if (flag.equalsIgnoreCase("true")) { + if (flag != null && flag.equalsIgnoreCase("true")) { var scriptPath = s"$snappyNativeTestDir/failoverTest_AddServer_BeforeConn.sh" var consoleOutput = s"$scriptPath $snappyProductDir $snappyNativeTestDir".!! assert(consoleOutput.contains("Test executed successfully connected to"), @@ -301,7 +301,7 @@ class CommandLineToolsSuite extends SnappyTestRunner { test("ODBC_FailOverTest_AddServer_AfterConn") { val flag = System.getenv("SNAPPY_NATIVE_ENABLED") - if (flag.equalsIgnoreCase("true")) { + if (flag != null && flag.equalsIgnoreCase("true")) { var scriptPath = s"$snappyNativeTestDir/failoverTest_AddServer_AfterConn.sh" var consoleOutput = s"$scriptPath $snappyProductDir $snappyNativeTestDir".!! assert(consoleOutput.contains("Test executed successfully connected to"),