1
0
Fork 0
mirror of https://github.com/postmannen/ctrl.git synced 2025-01-05 20:09:16 +00:00

rewrote test for processList

This commit is contained in:
postmannen 2021-11-16 20:18:32 +01:00
parent f8491df388
commit 49a88b83ce

View file

@ -80,7 +80,7 @@ func TestStewardServer(t *testing.T) {
// Specify all the test funcs to run in the slice. // Specify all the test funcs to run in the slice.
funcs := []testFunc{ funcs := []testFunc{
checkREQOpCommandTest, checkREQOpProcessListTest,
checkREQCliCommandTest, checkREQCliCommandTest,
checkREQCliCommandContTest, checkREQCliCommandContTest,
// checkREQToConsoleTest(conf, t), NB: No tests will be made for console ouput. // checkREQToConsoleTest(conf, t), NB: No tests will be made for console ouput.
@ -117,17 +117,14 @@ func TestStewardServer(t *testing.T) {
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// Testing op (operator) Commands. // Testing op (operator) Commands.
func checkREQOpCommandTest(stewardServer *server, conf *Configuration, t *testing.T) error { func checkREQOpProcessListTest(stewardServer *server, conf *Configuration, t *testing.T) error {
m := `[ m := `[
{ {
"directory":"opCommand", "directory":"opCommand",
"fileName": "fileName.result", "fileName": "fileName.result",
"toNode": "central", "toNode": "central",
"data": [], "data": [],
"method":"REQOpCommand", "method":"REQOpProcessList",
"operation":{
"opCmd":"ps"
},
"replyMethod":"REQToFile", "replyMethod":"REQToFile",
"ACKTimeout":3, "ACKTimeout":3,
"retries":3, "retries":3,
@ -140,9 +137,9 @@ func checkREQOpCommandTest(stewardServer *server, conf *Configuration, t *testin
writeToSocketTest(conf, m, t) writeToSocketTest(conf, m, t)
resultFile := filepath.Join(conf.SubscribersDataFolder, "opCommand", "central", "fileName.result") resultFile := filepath.Join(conf.SubscribersDataFolder, "opCommand", "central", "fileName.result")
_, err := findStringInFileTest("central.REQOpCommand.CommandACK", resultFile, conf, t) _, err := findStringInFileTest("central.REQHttpGet.CommandACK", resultFile, conf, t)
if err != nil { if err != nil {
return fmt.Errorf(" \U0001F631 [FAILED] : checkREQOpCommandTest: %v", err) return fmt.Errorf(" \U0001F631 [FAILED] : checkREQOpProcessListTest: %v", err)
} }
t.Logf(" \U0001f600 [SUCCESS] : checkREQOpCommandTest\n") t.Logf(" \U0001f600 [SUCCESS] : checkREQOpCommandTest\n")