package test import ( "testing" "xg_dba/api" connect "xg_dba/internal/services/connect" system "xg_dba/internal/services/system" ) func TestConnectInfo(t *testing.T) { connectInfo := api.ConnectInfoRequest{ Id: "1", Ssh: api.SshInfo{ Username: "gtong", Password: "845895", Host: "127.0.0.1", Port: "22", }, Db: api.DbInfo{ User: "SYSDBA", Password: "SYSDBA", Port: "5236", Database: "test", }, } localPath := "C:\\Program_GT\\Code\\Go\\Work\\xugu\\xg_dba\\config/" + connectInfo.Ssh.Host + "/" + connectInfo.Ssh.Host + ".toml" if err := connect.SetConnectInfo_service(connectInfo, localPath); err != nil { t.Errorf("SetConnectInfo_service failed: %v", err) } } func TestGetServerInfo(t *testing.T) { saveFilePath := "C:\\Program_GT\\Code\\Go\\Work\\xugu\\xg_dba\\config\\test\\" connectInfo := api.ConnectInfoRequest{ Id: "1", Ssh: api.SshInfo{ Username: "gtong", Password: "845895", Host: "127.0.0.1", Port: "22", }, } if err := system.SetSystemInfo_service(connectInfo, saveFilePath); err != nil { t.Errorf("SetConnectInfo_service failed: %v", err) } }