From 3c2c1a14c54a25a90d409183675d81519c0fd0f9 Mon Sep 17 00:00:00 2001
From: gakin <gakin>
Date: Mon, 31 Oct 2016 15:29:03 +0000
Subject: [PATCH] SSDM-4318: test_openbis_sync :copy harvester_config.txt to
 openbis2 folder and create log monitor for synchronization.log

SVN: 37223
---
 integration-tests/test_openbis_sync.py | 30 +++++++++++++++++---------
 1 file changed, 20 insertions(+), 10 deletions(-)

diff --git a/integration-tests/test_openbis_sync.py b/integration-tests/test_openbis_sync.py
index 1903d5a0d02..dce624c5290 100755
--- a/integration-tests/test_openbis_sync.py
+++ b/integration-tests/test_openbis_sync.py
@@ -48,16 +48,23 @@ class TestCase(systemtest.testcase.TestCase):
         
         #openbis1.dropAndWait("ENTITY_REGISTRATION", "openbis-sync-entity-reg")
 
-        #=======================================================================
-        # openbis2_port = '8445'
-        # openbis2 = self.createOpenbisController(instanceName = 'openbis2', port = openbis2_port, dropDatabases=False)
-        # openbis2.setDataStoreServerPort('8446')
-        # openbis2.setOpenbisPortDataStoreServer(openbis2_port)
-        # self.installHarvesterPlugin(openbis2)
-        # openbis2.setDummyAuthentication()
-        # openbis2.setDataStoreServerUsername('etlserver2')
-        # openbis2.allUp()
-        #=======================================================================
+        openbis2_port = '8445'
+        openbis2 = self.createOpenbisController(instanceName = 'openbis2', port = openbis2_port, dropDatabases=False)
+        openbis2.setDataStoreServerPort('8446')
+        openbis2.setOpenbisPortDataStoreServer(openbis2_port)
+        self.installHarvesterPlugin(openbis2)
+        openbis2.setDummyAuthentication()
+        openbis2.setDataStoreServerUsername('etlserver2')
+        source = self.getHarvesterConfigFolder()
+        destination = openbis2.installPath
+        util.printAndFlush("Copying harvester config file from %s to %s"% (source, destination))
+        util.copyFromTo(source, destination, "harvester-config.txt")
+        openbis2.allUp()
+        
+        monitor = util.LogMonitor("%s syncronization.log" % openbis2.instanceName,
+                                  "%s/syncronization.log" % openbis2.installPath) # "%s/servers/datastore_server/log/datastore_server_log.txt" % openbis2.installPath
+        monitor.addNotificationCondition(util.RegexCondition('OPERATION.DataSetRegistrationTask'))
+        monitor.waitUntilEvent(util.RegexCondition('Sync failed'))
         
 
     def installPlugin(self, openbisController, plugin_name):
@@ -77,6 +84,9 @@ class TestCase(systemtest.testcase.TestCase):
     def installHarvesterPlugin(self, openbisController):
         self.installPlugin(openbisController, "harvester")
 
+    def getHarvesterConfigFolder(self):
+        return systemtest.testcase.TEMPLATES + "/" + self.name + "/harvester_config"
+    
 class GitLabArtifactRepository(GitArtifactRepository):
     """
     Artifact repository for a gitlab projects.
-- 
GitLab