updated tests and methods

This commit is contained in:
redanthrax 2022-06-23 16:04:48 -07:00
parent de8e795254
commit da1e250ce9
8 changed files with 94 additions and 40 deletions

View file

@ -0,0 +1,44 @@
package tactical_test
import (
"testing"
"github.com/amidaware/rmmagent/agent/tactical"
)
func TestNewAgentConfig(t *testing.T) {
config := tactical.NewAgentConfig()
if config.BaseURL == "" {
t.Fatal("Could not get config")
}
t.Logf("Config BaseURL: %s", config.BaseURL)
}
func TestAgentUpdate(t *testing.T) {
url := "https://github.com/redanthrax/rmmagent/releases/download/v2.0.4/linuxagent"
result := tactical.AgentUpdate(url, "")
if !result {
t.Fatal("Agent update resulted in false")
}
t.Log("Agent update resulted in true")
}
func TestAgentUninstall(t *testing.T) {
result := tactical.AgentUninstall("foo")
if !result {
t.Fatal("Agent uninstall resulted in error")
}
t.Log("Agent uninstall was true")
}
func TestNixMeshNodeID(t *testing.T) {
nodeid := tactical.NixMeshNodeID()
if nodeid == "" {
t.Fatal("Unable to get mesh node id")
}
t.Logf("MeshNodeID: %s", nodeid)
}