executeCommand function add at configuremgr_test.go
authorjaehoon.hyun <jaehoon.hyun@samsung.com>
Tue, 2 Apr 2019 06:25:17 +0000 (15:25 +0900)
committerjaehoon.hyun <jaehoon.hyun@samsung.com>
Tue, 2 Apr 2019 06:25:17 +0000 (15:25 +0900)
src/configuremgr/configuremgr_test.go

index 538510d..fd073e8 100644 (file)
@@ -24,8 +24,7 @@ func TestBasicMockConfigureMgr(t *testing.T){
 
   //test object
   configuremgrObj  := configuremgr.Init()
-  configuremgrObj.IDeviceDiscoveryMgr.PushConfPath = mockconfiguremgr.PushConfPathDiscoveryDeviceMock
-  configuremgrObj.IAppExecuteMgr.PushConfPath      = mockconfiguremgr.PushConfPathAppExecuteMock
+  configuremgrObj.IDiscoveryMgr.PushConfPath = mockconfiguremgr.PushConfPathDiscoveryDeviceMock
   configuremgrObj.IScoringMgr.PushLibPath          = mockconfiguremgr.PushLibPathScoringAppMock
   
 
@@ -34,15 +33,25 @@ func TestBasicMockConfigureMgr(t *testing.T){
   //TODO : push /tmp/foo/simple directory using Cmd package
   time.Sleep(time.Duration(1 * time.Second))
   
-  command := fmt.Sprintf("cp -r %s %s", src, dst)
-  configuremgr.DLog.Println(command)
+  
+  //init scenario
+  execCommand("rm -rf /tmp/foo/mysum")
+  time.Sleep(time.Duration(1) * time.Second)
+
+  //user scenario
+  execCommand(fmt.Sprintf("cp -ar %s %s", src, dst))
+  time.Sleep(time.Duration(5) * time.Second)
+
+  configuremgrObj.Done <- true
+}
 
+
+func execCommand(command string) {
+  configuremgr.DLog.Println(command)
   cmd := exec.Command("sh", "-c", command)
   stdoutStderr, err := cmd.CombinedOutput()
   configuremgr.DLog.Printf("%s", stdoutStderr)
   if err != nil {
     configuremgr.ELog.Fatal(err)
   }
-
-  configuremgrObj.Done <- true
 }
\ No newline at end of file