123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- package test
- import (
- "fmt"
- "testing"
- "xg_dba/api"
- "xg_dba/internal/global"
- connect "xg_dba/internal/services/connect"
- )
- func TestMain(m *testing.M) {
-
-
- global.GlobalInit("C:\\Program_GT\\Code\\Go\\Work\\xugu\\xg_dba\\config")
-
- exitVal := m.Run()
- fmt.Println("exitVal:", exitVal)
-
-
-
-
- }
- func TestConnectInfo(t *testing.T) {
- connectInfo := []api.ConnectInfoRequest{
- api.ConnectInfoRequest{
-
- Ssh: api.SshInfo{
- Username: "gtong",
- Password: "845895",
- Host: "327.0.0.1",
- Port: "22",
- },
- Db: api.DbInfo{
- User: "SYSDBA",
- Password: "SYSDBA",
- Port: "5236",
- Database: "test",
- },
- },
- api.ConnectInfoRequest{
-
- Ssh: api.SshInfo{
- Username: "gtong",
- Password: "845895",
- Host: "327.0.0.2",
- Port: "22",
- },
- Db: api.DbInfo{
- User: "SYSDBA",
- Password: "SYSDBA",
- Port: "5231",
- Database: "test",
- },
- },
- }
- localPath := "C:\\Program_GT\\Code\\Go\\Work\\xugu\\xg_dba\\config/" + connectInfo[0].Ssh.Host + "/" + connectInfo[0].Ssh.Host + ".toml"
- if err := connect.SetConnectInfo_service(connectInfo, localPath); err != nil {
- t.Errorf("SetConnectInfo_service failed: %v", err)
- }
- }
|