This repository was archived by the owner on Nov 8, 2022. It is now read-only.
File tree 1 file changed +0
-40
lines changed
integration_tests/pkg/executor
1 file changed +0
-40
lines changed Original file line number Diff line number Diff line change 15
15
package executor
16
16
17
17
import (
18
- "os/exec"
19
- "strings"
20
18
"testing"
21
19
22
20
. "github.com/intelsdi-x/swan/pkg/executor"
@@ -39,41 +37,3 @@ func TestRemote(t *testing.T) {
39
37
})
40
38
})
41
39
}
42
-
43
- func got (t * testing.T ) {
44
- Convey ("I should be able to execute remote command and see the processes running" , t , func () {
45
- config := DefaultRemoteConfig ()
46
- remote , err := NewRemote ("127.0.0.1" , config )
47
- if err != nil {
48
- t .Skip ("Skipping remote executor test: " + err .Error ())
49
- }
50
-
51
- handle , err := remote .Execute ("sleep inf & sleep inf" )
52
- So (err , ShouldBeNil )
53
-
54
- sleepProcCount := findProcessCount ("sleep" )
55
- So (sleepProcCount , ShouldEqual , 2 )
56
-
57
- Convey ("I should be able to stop remote task and all the processes should be terminated" , func () {
58
- err = handle .Stop ()
59
- So (err , ShouldBeNil )
60
-
61
- sleepProcCountAfterStop := findProcessCount ("sleep" )
62
- So (sleepProcCountAfterStop , ShouldEqual , 0 )
63
- })
64
- })
65
- }
66
-
67
- func findProcessCount (processName string ) int {
68
- const separator = ","
69
-
70
- cmd := exec .Command ("pgrep" , processName , "-d " + separator )
71
- output , _ := cmd .Output ()
72
-
73
- if len (output ) == 0 {
74
- return 0
75
- }
76
-
77
- pids := strings .Split (string (output ), "," )
78
- return len (pids )
79
- }
You can’t perform that action at this time.
0 commit comments