12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- package test
- import (
- "fmt"
- "testing"
- "xg_dba/api"
- "xg_dba/internal/global"
- services "xg_dba/internal/services/system"
- _ "xg_dba/pkg/xugu"
- )
- func TestGetServerInfo(t *testing.T) {
- saveFilePath := "C:\\Program_GT\\Code\\Go\\Work\\xugu\\xg_dba\\config\\test\\"
- connectInfo := api.ServerInfoRequest{
- // Id: "1",
- Username: "gtong",
- Password: "845895",
- Host: "127.0.0.1",
- Port: "22",
- }
- connectInfo2 := api.ServerInfoRequest{
- // Id: "1",
- Username: "root",
- Password: "cdyanfa@2024",
- Host: "10.28.25.113",
- Port: "22",
- }
- progressChan := make(chan string)
- go func() {
- for progress := range progressChan {
- fmt.Println("Progress:", progress)
- }
- }()
- progressID := global.Progress.CreateProgress()
- if err := services.SetSystemInfo_service([]api.ServerInfoRequest{
- connectInfo,
- connectInfo2,
- }, saveFilePath, progressID); err != nil {
- t.Errorf("SetConnectInfo_service failed: %v", err)
- }
- }
- func TestGeDb(t *testing.T) {
- services.GetDb()
- }
|