changeset 135:cdd62284c125

fixing StorageSmokeTest testsuite
author Jana Fabrikova <jfabriko@redhat.com>
date Mon, 02 Dec 2013 17:20:12 +0100
parents 2ba976993b66
children 741b6763baad
files ChangeLog scripts/ps_mongo_daemon.sh src/org/thermostat/qa/testsuites/StorageSmokeTest.java
diffstat 3 files changed, 22 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Dec 02 15:49:06 2013 +0100
+++ b/ChangeLog	Mon Dec 02 17:20:12 2013 +0100
@@ -1,3 +1,12 @@
+2013-12-02  Jana Fabrikova  <jfabriko@redhat.com>
+
+	* scripts/ps_mongo_deamon.sh:
+	modification of the script so it does not count scl enable mongodb24... into
+	running mongo processes
+	* src/org/thermostat/qa/testsuites/StorageSmokeTest.java:
+	modifying the testcases so they can be run in any order (especially they
+	must not relay on having running storage from the previous testcase)
+
 2013-12-02  Jana Fabrikova  <jfabriko@redhat.com>
 
 	* src/org/thermostat/qa/testsuites/CliClientDBModificationsSmokeTest.java:
--- a/scripts/ps_mongo_daemon.sh	Mon Dec 02 15:49:06 2013 +0100
+++ b/scripts/ps_mongo_daemon.sh	Mon Dec 02 17:20:12 2013 +0100
@@ -1,2 +1,2 @@
-ps x | grep "[m]ongod"
+ps x | grep "[m]ongod" | grep -v mongodb24
 
--- a/src/org/thermostat/qa/testsuites/StorageSmokeTest.java	Mon Dec 02 15:49:06 2013 +0100
+++ b/src/org/thermostat/qa/testsuites/StorageSmokeTest.java	Mon Dec 02 17:20:12 2013 +0100
@@ -111,7 +111,7 @@
 
     /**
      * Method testStartStorage starts thermostat storage and
-     * tests that the output is not null.
+     * tests that the output is not null. Then the storage is stopped again.
      * 
      * @throws IOException
      */
@@ -119,17 +119,20 @@
     {
         List<String> processOutput = startStorageAndGetOutput();
         sleep(ONE_SEC);
+        stopStorage();
         Assert.assertNotNull(processOutput, "error getting standard output");
     }
 
     /**
-     * Method testStopStorage stops thermostat storage and
-     * tests if the output is not null. 
+     * Method testStopStorage starts thermostat storage, then it stops 
+     * the storage and tests if the output is not null. 
      * 
      * @throws IOException
      */
     public void testStopStorage() throws IOException
     {
+        startStorage();
+        sleep(ONE_SEC);
         List<String> processOutput = stopStorageAndGetOutput();
         sleep(ONE_SEC);
         Assert.assertNotNull(processOutput, "error getting standard output");
@@ -149,9 +152,9 @@
         startStorage();
         List<String> out = runHelperBashScript("ps_mongo_daemon.sh");
         sleep(ONE_SEC);
+        stopStorage();
         Assert.assertNotNull(out, "test script 'scripts/ps_mongo_daemon.sh' can't be started");
         Assert.assertEquals(out.size(), 1, "mongod was not started");
-        stopStorage();
     }
 
     /**
@@ -166,13 +169,14 @@
     public void testStartStorageMessage() throws IOException
     {
         List<String> processOutput = startStorageAndGetOutput();
+        sleep(ONE_SEC);
+        stopStorage();
         for (String message : processOutput)
         {
             logInfo("testStartStorageMessage", message);
         }
         Assert.assertNotNull(processOutput, "error getting standard output");
         Assert.assertTrue(processOutput.size()>=3, "error getting standard output");
-        sleep(ONE_SEC);
         compareTwoLines(processOutput.get(0), "starting storage server...");
         compareTwoLines(processOutput.get(1), "server listening on ip: mongodb://127.0.0.1:27518");
         compareTwoLines(processOutput.get(2).substring(0, STORAGE_MESSAGE_LOG_FILE.length()), STORAGE_MESSAGE_LOG_FILE);
@@ -189,13 +193,15 @@
      */
     public void testStopStorageMessage() throws IOException
     {
+        startStorage();
+        sleep(ONE_SEC);
         List<String> processOutput = stopStorageAndGetOutput();
+        sleep(ONE_SEC);
         for (String message : processOutput)
         {
             logInfo("testStopStorageMessage", message);
         }
         Assert.assertNotNull(processOutput, "error getting standard output");
-        sleep(ONE_SEC);
         compareTwoLines(processOutput.get(0).substring(0, STORAGE_MESSAGE_SERVER_SHUTDOWN_COMPLETE.length()), STORAGE_MESSAGE_SERVER_SHUTDOWN_COMPLETE);
         compareTwoLines(processOutput.get(1).substring(0, STORAGE_MESSAGE_LOG_FILE.length()), STORAGE_MESSAGE_LOG_FILE);
     }