mirror of
https://github.com/ManyakRus/starter.git
synced 2025-11-25 23:02:22 +02:00
67 lines
1.3 KiB
Go
67 lines
1.3 KiB
Go
package sync_exchange_connect
|
|
|
|
import (
|
|
"github.com/ManyakRus/starter/config_main"
|
|
"github.com/ManyakRus/starter/contextmain"
|
|
"github.com/ManyakRus/starter/micro"
|
|
"github.com/ManyakRus/starter/pkg/version"
|
|
"github.com/ManyakRus/starter/stopapp"
|
|
"testing"
|
|
)
|
|
|
|
var SERVICE_NAME_TEST = "starter_test"
|
|
|
|
func TestConnect(t *testing.T) {
|
|
config_main.LoadEnv()
|
|
Connect(SERVICE_NAME_TEST, version.Version)
|
|
defer CloseConnection()
|
|
|
|
micro.Pause(100)
|
|
|
|
}
|
|
|
|
func TestStartNats(t *testing.T) {
|
|
config_main.LoadEnv()
|
|
Start(SERVICE_NAME_TEST, version.Version)
|
|
defer CloseConnection()
|
|
|
|
micro.Pause(100)
|
|
|
|
contextmain.CancelContext()
|
|
contextmain.GetNewContext()
|
|
}
|
|
|
|
func TestCloseConnection(t *testing.T) {
|
|
config_main.LoadEnv()
|
|
Connect(SERVICE_NAME_TEST, version.Version)
|
|
defer CloseConnection()
|
|
}
|
|
|
|
func TestWaitStop(t *testing.T) {
|
|
|
|
stopapp.GetWaitGroup_Main().Add(1)
|
|
go WaitStop()
|
|
|
|
_ = contextmain.GetContext()
|
|
contextmain.CancelContext()
|
|
|
|
stopapp.GetWaitGroup_Main().Wait()
|
|
|
|
contextmain.GetNewContext()
|
|
}
|
|
|
|
func TestPprofNats1(t *testing.T) {
|
|
config_main.LoadEnvTest()
|
|
Connect(SERVICE_NAME_TEST, version.Version)
|
|
defer CloseConnection()
|
|
|
|
PprofNats1()
|
|
}
|
|
|
|
func TestTextTestOrEmpty(t *testing.T) {
|
|
Otvet := TextTestOrEmpty()
|
|
if Otvet != "" && Otvet != "_test" {
|
|
t.Errorf("TextTestOrEmpty() error: Otvet=%v", Otvet)
|
|
}
|
|
}
|