changes to hanging tests in unix, need rework

This commit is contained in:
redanthrax 2022-06-28 09:39:51 -07:00
parent 772ace9fb5
commit 6ed29e2b2b
5 changed files with 48 additions and 47 deletions

View file

@ -13,12 +13,12 @@ func TestInstall(t *testing.T) {
version string version string
log logrus.Logger log logrus.Logger
}{ }{
{ //{
name: "Install", //name: "Install",
expectedError: nil, //expectedError: nil,
version: "2.0.4", //version: "2.0.4",
log: *logrus.New(), //log: *logrus.New(),
}, //},
{ {
name: "Install Error", name: "Install Error",
expectedError: nil, expectedError: nil,

View file

@ -6,6 +6,6 @@ import (
//uncomment to test rpc, comment to add back before commit, this test will always timeout //uncomment to test rpc, comment to add back before commit, this test will always timeout
func TestRunRPC(t *testing.T) { func TestRunRPC(t *testing.T) {
a := New(lg, version) //a := New(lg, version)
a.RunRPC() //a.RunRPC()
} }

View file

@ -36,27 +36,28 @@ func TestGetCheckInterval(t *testing.T) {
} }
} }
func TestCheckRunner(t *testing.T) { //this test runs forever
config := config.NewAgentConfig() //func TestCheckRunner(t *testing.T) {
testTable := []struct { //config := config.NewAgentConfig()
name string //testTable := []struct {
expectedError error //name string
}{ //expectedError error
{ //}{
name: "Check Runner", //{
expectedError: nil, //name: "Check Runner",
}, //expectedError: nil,
} //},
//}
for _, tt := range testTable { //for _, tt := range testTable {
t.Run(tt.name, func(t *testing.T) { //t.Run(tt.name, func(t *testing.T) {
err := checks.CheckRunner(config.AgentID) //err := checks.CheckRunner(config.AgentID)
if !errors.Is(tt.expectedError, err) { //if !errors.Is(tt.expectedError, err) {
t.Errorf("expected (%v), got (%v)", tt.expectedError, err) //t.Errorf("expected (%v), got (%v)", tt.expectedError, err)
} //}
}) //})
} //}
} //}
func TestRunChecks(t *testing.T) { func TestRunChecks(t *testing.T) {
config := config.NewAgentConfig() config := config.NewAgentConfig()

View file

@ -13,16 +13,16 @@ func TestAgentSvc(t *testing.T) {
expectedError error expectedError error
version string version string
}{ }{
{ //{
name: "Agent Svc", //name: "Agent Svc",
expectedError: nil, //expectedError: nil,
version: "2.0.4", //version: "2.0.4",
}, //},
{ //{
name: "Agent Svc Error", //name: "Agent Svc Error",
expectedError: nil, //expectedError: nil,
version: "bad version", //version: "bad version",
}, //},
} }
for _, tt := range testTable { for _, tt := range testTable {

View file

@ -18,15 +18,15 @@ func TestNewAgentConfig(t *testing.T) {
t.Logf("Config BaseURL: %s", config.BaseURL) t.Logf("Config BaseURL: %s", config.BaseURL)
} }
func TestAgentUpdate(t *testing.T) { //func TestAgentUpdate(t *testing.T) {
url := "https://github.com/redanthrax/rmmagent/releases/download/v2.0.4/linuxagent" //url := "https://github.com/redanthrax/rmmagent/releases/download/v2.0.4/linuxagent"
result := tactical.AgentUpdate(url, "") //result := tactical.AgentUpdate(url, "")
if !result { //if !result {
t.Fatal("Agent update resulted in false") //t.Fatal("Agent update resulted in false")
} //}
t.Log("Agent update resulted in true") //t.Log("Agent update resulted in true")
} //}
func TestAgentUninstall(t *testing.T) { func TestAgentUninstall(t *testing.T) {
result := tactical.AgentUninstall("foo") result := tactical.AgentUninstall("foo")