rmmagent/agent/install_test.go

44 lines
1.1 KiB
Go
Raw Normal View History

2022-06-15 23:37:35 +00:00
package agent
import (
"testing"
"github.com/sirupsen/logrus"
"github.com/spf13/viper"
)
func TestInstall(t *testing.T) {
var (
version = "2.0.4"
log = logrus.New()
)
a := New(log, version)
viper.SetConfigName("testargs.json")
viper.SetConfigType("json")
viper.AddConfigPath(".")
2022-06-16 01:26:10 +00:00
viper.ReadInConfig()
2022-06-15 23:37:35 +00:00
installer := Installer {
RMM: viper.GetString("api"),
2022-06-16 01:26:10 +00:00
ClientID: viper.GetInt("clientid"),
SiteID: viper.GetInt("siteid"),
Description: viper.GetString("description"),
AgentType: viper.GetString("agenttype"),
Power: viper.GetBool("power"),
RDP: viper.GetBool("rdp"),
Ping: viper.GetBool("ping"),
Token: viper.GetString("token"),
LocalMesh: viper.GetString("localmesh"),
Cert: viper.GetString("cert"),
Proxy: viper.GetString("proxy"),
Timeout: viper.GetDuration("timeout"),
Silent: viper.GetBool("silent"),
NoMesh: viper.GetBool("nomesh"),
MeshDir: viper.GetString("meshdir"),
MeshNodeID: viper.GetString("meshnodeid"),
2022-06-15 23:37:35 +00:00
}
a.Install(&installer)
}