mirror of
https://github.com/ManyakRus/starter.git
synced 2025-02-14 15:00:08 +02:00
сделал CheckPort()
This commit is contained in:
parent
0c5ee45514
commit
3c32dfb9ad
@ -6,7 +6,7 @@ import (
|
||||
"github.com/ManyakRus/starter/contextmain"
|
||||
"github.com/ManyakRus/starter/logger"
|
||||
"github.com/ManyakRus/starter/micro"
|
||||
"github.com/ManyakRus/starter/ping"
|
||||
"github.com/ManyakRus/starter/port_checker"
|
||||
"github.com/ManyakRus/starter/stopapp"
|
||||
"github.com/camunda/zeebe/clients/go/v8/pkg/entities"
|
||||
"github.com/camunda/zeebe/clients/go/v8/pkg/worker"
|
||||
@ -81,7 +81,7 @@ func Connect() {
|
||||
FillSettings()
|
||||
}
|
||||
|
||||
ping.Ping(Settings.CAMUNDA_HOST, Settings.CAMUNDA_PORT)
|
||||
port_checker.CheckPort(Settings.CAMUNDA_HOST, Settings.CAMUNDA_PORT)
|
||||
|
||||
Client, err = zbc.NewClient(&zbc.ClientConfig{
|
||||
GatewayAddress: GetURL(),
|
||||
@ -256,13 +256,13 @@ loop:
|
||||
log.Warn("Context app is canceled. camunda_connect.ping")
|
||||
break loop
|
||||
case <-ticker.C:
|
||||
err := ping.Ping_err(Settings.CAMUNDA_HOST, Settings.CAMUNDA_PORT)
|
||||
err := port_checker.CheckPort_err(Settings.CAMUNDA_HOST, Settings.CAMUNDA_PORT)
|
||||
// log.Debug("ticker, ping err: ", err) //удалить
|
||||
if err != nil {
|
||||
NeedReconnect = true
|
||||
log.Warn("CAMUNDA Ping(", addr, ") error: ", err)
|
||||
log.Warn("CAMUNDA CheckPort(", addr, ") error: ", err)
|
||||
} else if NeedReconnect == true {
|
||||
log.Warn("CAMUNDA Ping(", addr, ") OK. Start Reconnect()")
|
||||
log.Warn("CAMUNDA CheckPort(", addr, ") OK. Start Reconnect()")
|
||||
NeedReconnect = false
|
||||
Connect()
|
||||
}
|
||||
|
@ -10,14 +10,14 @@ import (
|
||||
"github.com/camunda/zeebe/clients/go/v8/pkg/pb"
|
||||
//"github.com/camunda_connect/zeebe/clients/go/v8/pkg/worker"
|
||||
|
||||
"github.com/ManyakRus/starter/config"
|
||||
"github.com/ManyakRus/starter/config_main"
|
||||
//"gitlab.aescorp.ru/dsp_dev/claim/stack_exchange/internal/v0/app/programdir"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestFillSettings(t *testing.T) {
|
||||
//ProgramDir := micro.ProgramDir_Common()
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
FillSettings()
|
||||
|
||||
if Settings.CAMUNDA_HOST == "" {
|
||||
@ -28,7 +28,7 @@ func TestFillSettings(t *testing.T) {
|
||||
|
||||
func TestConnect(t *testing.T) {
|
||||
//ProgramDir := micro.ProgramDir_Common()
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
FillSettings()
|
||||
|
||||
Connect()
|
||||
@ -45,7 +45,7 @@ func TestConnect(t *testing.T) {
|
||||
|
||||
func TestCloseConnection(t *testing.T) {
|
||||
//ProgramDir := micro.ProgramDir_Common()
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
FillSettings()
|
||||
|
||||
Connect()
|
||||
@ -60,7 +60,7 @@ func TestCloseConnection(t *testing.T) {
|
||||
|
||||
func TestGetURL(t *testing.T) {
|
||||
//ProgramDir := micro.ProgramDir_Common()
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
FillSettings()
|
||||
|
||||
URL := GetURL()
|
||||
@ -98,7 +98,7 @@ func createJob() entities.Job {
|
||||
|
||||
func Test_workComplete(t *testing.T) {
|
||||
//ProgramDir := micro.ProgramDir_Common()
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
FillSettings()
|
||||
|
||||
Connect()
|
||||
@ -115,7 +115,7 @@ func Test_workComplete(t *testing.T) {
|
||||
|
||||
func Test_workFails(t *testing.T) {
|
||||
//ProgramDir := micro.ProgramDir_Common()
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
FillSettings()
|
||||
|
||||
Connect()
|
||||
|
@ -5,7 +5,7 @@ import (
|
||||
|
||||
//log "github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/ManyakRus/starter/config"
|
||||
"github.com/ManyakRus/starter/config_main"
|
||||
"github.com/ManyakRus/starter/contextmain"
|
||||
"github.com/ManyakRus/starter/micro"
|
||||
|
||||
@ -17,7 +17,7 @@ func TestConnect_err(t *testing.T) {
|
||||
//Connect_Panic()
|
||||
|
||||
//ProgramDir := micro.ProgramDir_Common()
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
err := Connect_err()
|
||||
if err != nil {
|
||||
t.Error("TestConnect error: ", err)
|
||||
@ -43,7 +43,7 @@ func TestWaitStop(t *testing.T) {
|
||||
|
||||
func TestStartDB(t *testing.T) {
|
||||
//ProgramDir := micro.ProgramDir_Common()
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
Start()
|
||||
err := CloseConnection_err()
|
||||
if err != nil {
|
||||
@ -53,7 +53,7 @@ func TestStartDB(t *testing.T) {
|
||||
|
||||
func TestConnect(t *testing.T) {
|
||||
//ProgramDir := micro.ProgramDir_Common()
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
Connect()
|
||||
|
||||
CloseConnection()
|
||||
@ -61,7 +61,7 @@ func TestConnect(t *testing.T) {
|
||||
|
||||
func TestSendMessage(t *testing.T) {
|
||||
//ProgramDir := micro.ProgramDir_Common()
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
|
||||
Text := "Is ChatGPT enabled now ?"
|
||||
Otvet, err := SendMessage(Text, "")
|
||||
|
@ -1,6 +1,6 @@
|
||||
// модуль для загрузки переменных окружения в структуру
|
||||
|
||||
package config
|
||||
package config_main
|
||||
|
||||
import (
|
||||
"github.com/ManyakRus/starter/logger"
|
@ -1,4 +1,4 @@
|
||||
package config
|
||||
package config_main
|
||||
|
||||
import (
|
||||
"github.com/ManyakRus/starter/micro"
|
@ -1,13 +1,13 @@
|
||||
package email
|
||||
|
||||
import (
|
||||
"github.com/ManyakRus/starter/config"
|
||||
"github.com/ManyakRus/starter/config_main"
|
||||
mail "github.com/xhit/go-simple-mail/v2"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestSendMessage(t *testing.T) {
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
Connect()
|
||||
EMAIL_SEND_TO_TEST := Settings.EMAIL_SEND_TO_TEST
|
||||
text := "TEST ТЕСТ utf8 русский язык"
|
||||
@ -21,7 +21,7 @@ func TestSendMessage(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSendEmail(t *testing.T) {
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
Connect()
|
||||
EMAIL_SEND_TO_TEST := Settings.EMAIL_SEND_TO_TEST
|
||||
//EMAIL_SEND_TO_TEST = EMAIL_SEND_TO_TEST + ",noreply@note.atomsbt.ru"
|
||||
|
@ -2,7 +2,7 @@ package kafka_connect
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/ManyakRus/starter/config"
|
||||
"github.com/ManyakRus/starter/config_main"
|
||||
"github.com/ManyakRus/starter/contextmain"
|
||||
"github.com/ManyakRus/starter/micro"
|
||||
"testing"
|
||||
@ -16,7 +16,7 @@ var TEXT_CONTEXT_DEADLINE = "context deadline exceeded"
|
||||
|
||||
func TestConnect_err(t *testing.T) {
|
||||
//ProgramDir := micro.ProgramDir_Common()
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
err := Connect_err()
|
||||
if err != nil {
|
||||
t.Error("nats_connect.TestConnect_err() error: ", err)
|
||||
@ -26,14 +26,14 @@ func TestConnect_err(t *testing.T) {
|
||||
|
||||
func TestCloseConnection(t *testing.T) {
|
||||
//ProgramDir := micro.ProgramDir_Common()
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
Connect()
|
||||
CloseConnection()
|
||||
}
|
||||
|
||||
func TestStartNats(t *testing.T) {
|
||||
//ProgramDir := micro.ProgramDir_Common()
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
StartKafka()
|
||||
micro.Pause(20)
|
||||
|
||||
@ -60,13 +60,13 @@ func TestWaitStop(t *testing.T) {
|
||||
|
||||
func TestConnect(t *testing.T) {
|
||||
//ProgramDir := micro.ProgramDir_Common()
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
Connect()
|
||||
defer CloseConnection()
|
||||
}
|
||||
|
||||
func TestReadTopic(t *testing.T) {
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
FillSettings()
|
||||
//Connect()
|
||||
//defer CloseConnection()
|
||||
|
@ -12,7 +12,7 @@ import (
|
||||
"github.com/ManyakRus/starter/contextmain"
|
||||
"github.com/ManyakRus/starter/logger"
|
||||
"github.com/ManyakRus/starter/micro"
|
||||
"github.com/ManyakRus/starter/ping"
|
||||
"github.com/ManyakRus/starter/port_checker"
|
||||
"github.com/ManyakRus/starter/stopapp"
|
||||
|
||||
miniogo "github.com/minio/minio-go/v7"
|
||||
@ -49,7 +49,7 @@ func Connect() {
|
||||
FillSettings()
|
||||
}
|
||||
|
||||
//ping.Ping(Settings.MINIO_HOST, Settings.MINIO_PORT)
|
||||
//ping.CheckPort(Settings.MINIO_HOST, Settings.MINIO_PORT)
|
||||
|
||||
err := Connect_err()
|
||||
if err != nil {
|
||||
@ -80,7 +80,7 @@ func Connect_err() error {
|
||||
}
|
||||
Conn, err = miniogo.New(addr, options)
|
||||
if err == nil {
|
||||
ping.Ping(Settings.MINIO_HOST, Settings.MINIO_PORT)
|
||||
port_checker.CheckPort(Settings.MINIO_HOST, Settings.MINIO_PORT)
|
||||
}
|
||||
|
||||
return err
|
||||
@ -246,13 +246,13 @@ loop:
|
||||
log.Warn("Context app is canceled. minio_connect.ping")
|
||||
break loop
|
||||
case <-ticker.C:
|
||||
err := ping.Ping_err(Settings.MINIO_HOST, Settings.MINIO_PORT)
|
||||
err := port_checker.CheckPort_err(Settings.MINIO_HOST, Settings.MINIO_PORT)
|
||||
//log.Debug("ticker, ping err: ", err) //удалить
|
||||
if err != nil {
|
||||
NeedReconnect = true
|
||||
log.Warn("minio_connect Ping(", addr, ") error: ", err)
|
||||
log.Warn("minio_connect CheckPort(", addr, ") error: ", err)
|
||||
} else if NeedReconnect == true {
|
||||
log.Warn("minio_connect Ping(", addr, ") OK. Start Reconnect()")
|
||||
log.Warn("minio_connect CheckPort(", addr, ") OK. Start Reconnect()")
|
||||
NeedReconnect = false
|
||||
Connect()
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ import (
|
||||
|
||||
//log "github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/ManyakRus/starter/config"
|
||||
"github.com/ManyakRus/starter/config_main"
|
||||
"github.com/ManyakRus/starter/contextmain"
|
||||
"github.com/ManyakRus/starter/micro"
|
||||
|
||||
@ -19,7 +19,7 @@ func TestConnect_err(t *testing.T) {
|
||||
//Connect_Panic()
|
||||
|
||||
//ProgramDir := micro.ProgramDir_Common()
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
err := Connect_err()
|
||||
if err != nil {
|
||||
t.Error("TestConnect() error: ", err)
|
||||
@ -33,7 +33,7 @@ func TestConnect_err(t *testing.T) {
|
||||
|
||||
func TestIsClosed(t *testing.T) {
|
||||
//ProgramDir := micro.ProgramDir_Common()
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
|
||||
err := Connect_err()
|
||||
if err != nil {
|
||||
@ -54,7 +54,7 @@ func TestIsClosed(t *testing.T) {
|
||||
|
||||
func TestReconnect(t *testing.T) {
|
||||
//ProgramDir := micro.ProgramDir_Common()
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
err := Connect_err()
|
||||
if err != nil {
|
||||
t.Error("TestReconnect() Connect_err() error: ", err)
|
||||
@ -84,7 +84,7 @@ func TestWaitStop(t *testing.T) {
|
||||
|
||||
func TestStartMinio(t *testing.T) {
|
||||
//ProgramDir := micro.ProgramDir_Common()
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
StartMinio()
|
||||
err := CloseConnection_err()
|
||||
if err != nil {
|
||||
@ -93,7 +93,7 @@ func TestStartMinio(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestConnect(t *testing.T) {
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
Connect()
|
||||
defer CloseConnection()
|
||||
}
|
||||
@ -101,7 +101,7 @@ func TestConnect(t *testing.T) {
|
||||
func TestCreateBucketCtx(t *testing.T) {
|
||||
//t.SkipNow()
|
||||
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
Connect()
|
||||
defer CloseConnection()
|
||||
|
||||
@ -113,7 +113,7 @@ func TestCreateBucketCtx(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUploadFileCtx(t *testing.T) {
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
Connect()
|
||||
defer CloseConnection()
|
||||
|
||||
@ -132,7 +132,7 @@ func TestUploadFileCtx(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDownloadFileCtx(t *testing.T) {
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
Connect()
|
||||
defer CloseConnection()
|
||||
|
||||
|
@ -6,7 +6,7 @@ import (
|
||||
|
||||
//log "github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/ManyakRus/starter/config"
|
||||
"github.com/ManyakRus/starter/config_main"
|
||||
"github.com/ManyakRus/starter/contextmain"
|
||||
"github.com/ManyakRus/starter/micro"
|
||||
|
||||
@ -18,7 +18,7 @@ func TestConnect_err(t *testing.T) {
|
||||
//Connect_Panic()
|
||||
|
||||
//ProgramDir := micro.ProgramDir_Common()
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
err := Connect_err()
|
||||
if err != nil {
|
||||
t.Error("TestConnect error: ", err)
|
||||
@ -32,7 +32,7 @@ func TestConnect_err(t *testing.T) {
|
||||
|
||||
func TestIsClosed(t *testing.T) {
|
||||
//ProgramDir := micro.ProgramDir_Common()
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
|
||||
err := Connect_err()
|
||||
if err != nil {
|
||||
@ -53,7 +53,7 @@ func TestIsClosed(t *testing.T) {
|
||||
|
||||
func TestReconnect(t *testing.T) {
|
||||
//ProgramDir := micro.ProgramDir_Common()
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
err := Connect_err()
|
||||
if err != nil {
|
||||
t.Error("TestIsClosed Connect() error: ", err)
|
||||
@ -83,7 +83,7 @@ func TestWaitStop(t *testing.T) {
|
||||
|
||||
func TestStartDB(t *testing.T) {
|
||||
//ProgramDir := micro.ProgramDir_Common()
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
StartDB()
|
||||
err := CloseConnection_err()
|
||||
if err != nil {
|
||||
@ -93,7 +93,7 @@ func TestStartDB(t *testing.T) {
|
||||
|
||||
func TestConnect(t *testing.T) {
|
||||
//ProgramDir := micro.ProgramDir_Common()
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
Connect()
|
||||
|
||||
CloseConnection()
|
||||
|
@ -6,7 +6,7 @@ import (
|
||||
|
||||
//log "github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/ManyakRus/starter/config"
|
||||
"github.com/ManyakRus/starter/config_main"
|
||||
"github.com/ManyakRus/starter/contextmain"
|
||||
"github.com/ManyakRus/starter/micro"
|
||||
|
||||
@ -18,7 +18,7 @@ func TestConnect_err(t *testing.T) {
|
||||
//Connect_Panic()
|
||||
|
||||
//ProgramDir := micro.ProgramDir_Common()
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
err := Connect_err()
|
||||
if err != nil {
|
||||
t.Error("TestConnect error: ", err)
|
||||
@ -32,7 +32,7 @@ func TestConnect_err(t *testing.T) {
|
||||
|
||||
func TestIsClosed(t *testing.T) {
|
||||
//ProgramDir := micro.ProgramDir_Common()
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
|
||||
err := Connect_err()
|
||||
if err != nil {
|
||||
@ -53,7 +53,7 @@ func TestIsClosed(t *testing.T) {
|
||||
|
||||
func TestReconnect(t *testing.T) {
|
||||
//ProgramDir := micro.ProgramDir_Common()
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
err := Connect_err()
|
||||
if err != nil {
|
||||
t.Error("TestIsClosed Connect() error: ", err)
|
||||
@ -83,7 +83,7 @@ func TestWaitStop(t *testing.T) {
|
||||
|
||||
func TestStartDB(t *testing.T) {
|
||||
//ProgramDir := micro.ProgramDir_Common()
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
StartDB()
|
||||
err := CloseConnection_err()
|
||||
if err != nil {
|
||||
@ -93,7 +93,7 @@ func TestStartDB(t *testing.T) {
|
||||
|
||||
func TestConnect(t *testing.T) {
|
||||
//ProgramDir := micro.ProgramDir_Common()
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
Connect()
|
||||
|
||||
CloseConnection()
|
||||
@ -101,7 +101,7 @@ func TestConnect(t *testing.T) {
|
||||
|
||||
func TestGetConnection(t *testing.T) {
|
||||
//ProgramDir := micro.ProgramDir_Common()
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
GetConnection(7)
|
||||
|
||||
CloseConnection()
|
||||
|
@ -1,7 +1,7 @@
|
||||
package mssql_stek
|
||||
|
||||
import (
|
||||
"github.com/ManyakRus/starter/config"
|
||||
"github.com/ManyakRus/starter/config_main"
|
||||
"github.com/ManyakRus/starter/mssql_gorm"
|
||||
"gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/object_model/entities/connections"
|
||||
"testing"
|
||||
@ -11,7 +11,7 @@ var CONNECTION = connections.Connection{ID: 3, BranchID: 2, IsLegal: true}
|
||||
|
||||
func TestFindDateClosedMonth(t *testing.T) {
|
||||
//ProgramDir := micro.ProgramDir_Common()
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
mssql_gorm.Connect()
|
||||
defer mssql_gorm.CloseConnection()
|
||||
|
||||
@ -25,7 +25,7 @@ func TestFindDateClosedMonth(t *testing.T) {
|
||||
|
||||
func TestFindDateFromTo(t *testing.T) {
|
||||
//ProgramDir := micro.ProgramDir_Common()
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
mssql_gorm.Connect()
|
||||
defer mssql_gorm.CloseConnection()
|
||||
|
||||
|
@ -4,7 +4,7 @@ import (
|
||||
"context"
|
||||
"github.com/ManyakRus/starter/logger"
|
||||
"github.com/ManyakRus/starter/micro"
|
||||
"github.com/ManyakRus/starter/ping"
|
||||
"github.com/ManyakRus/starter/port_checker"
|
||||
"github.com/nats-io/nats.go"
|
||||
"os"
|
||||
//"github.com/ManyakRus/starter/common/v0/micro"
|
||||
@ -49,7 +49,7 @@ func Connect_err() error {
|
||||
FillSettings()
|
||||
}
|
||||
|
||||
ping.Ping(Settings.NATS_HOST, Settings.NATS_PORT)
|
||||
port_checker.CheckPort(Settings.NATS_HOST, Settings.NATS_PORT)
|
||||
|
||||
sNATS_PORT := Settings.NATS_PORT
|
||||
URL := "nats://" + Settings.NATS_HOST + ":" + sNATS_PORT
|
||||
|
@ -2,7 +2,7 @@ package nats_connect
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/ManyakRus/starter/config"
|
||||
"github.com/ManyakRus/starter/config_main"
|
||||
"github.com/ManyakRus/starter/contextmain"
|
||||
"github.com/ManyakRus/starter/micro"
|
||||
"testing"
|
||||
@ -14,7 +14,7 @@ import (
|
||||
|
||||
func TestConnect_err(t *testing.T) {
|
||||
//ProgramDir := micro.ProgramDir_Common()
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
err := Connect_err()
|
||||
if err != nil {
|
||||
t.Error("nats_connect.TestConnect_err() error: ", err)
|
||||
@ -24,14 +24,14 @@ func TestConnect_err(t *testing.T) {
|
||||
|
||||
func TestCloseConnection(t *testing.T) {
|
||||
//ProgramDir := micro.ProgramDir_Common()
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
Connect()
|
||||
CloseConnection()
|
||||
}
|
||||
|
||||
func TestStartNats(t *testing.T) {
|
||||
//ProgramDir := micro.ProgramDir_Common()
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
StartNats()
|
||||
micro.Pause(20)
|
||||
|
||||
@ -57,14 +57,14 @@ func TestWaitStop(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestConnect(t *testing.T) {
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
Connect()
|
||||
defer CloseConnection()
|
||||
}
|
||||
|
||||
func TestSendMessageCtx(t *testing.T) {
|
||||
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
Connect()
|
||||
defer CloseConnection()
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package nats_liveness
|
||||
|
||||
import (
|
||||
"github.com/ManyakRus/starter/config"
|
||||
"github.com/ManyakRus/starter/config_main"
|
||||
"github.com/ManyakRus/starter/micro"
|
||||
"testing"
|
||||
)
|
||||
@ -9,7 +9,7 @@ import (
|
||||
var SERVICE_NAME_TEST = "NIKITIN"
|
||||
|
||||
func TestConnect(t *testing.T) {
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
FillSettings(SERVICE_NAME_TEST)
|
||||
Connect()
|
||||
CloseConnection()
|
||||
@ -17,7 +17,7 @@ func TestConnect(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSendMessage(t *testing.T) {
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
FillSettings(SERVICE_NAME_TEST)
|
||||
Connect()
|
||||
SendMessage()
|
||||
@ -27,7 +27,7 @@ func TestSendMessage(t *testing.T) {
|
||||
func TestStart(t *testing.T) {
|
||||
//t.SkipNow() //убрать
|
||||
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
Start(SERVICE_NAME_TEST)
|
||||
|
||||
micro.Pause(60000)
|
||||
|
42
ping/ping.go
42
ping/ping.go
@ -1,42 +0,0 @@
|
||||
package ping
|
||||
|
||||
import (
|
||||
"github.com/ManyakRus/starter/logger"
|
||||
"net"
|
||||
"time"
|
||||
)
|
||||
|
||||
// log - глобальный логгер
|
||||
var log = logger.GetLog()
|
||||
|
||||
func Ping_err(IP, Port string) error {
|
||||
var err error
|
||||
|
||||
var timeout time.Duration
|
||||
timeout = time.Second * 3
|
||||
network := IP + ":" + Port
|
||||
|
||||
conn, err := net.DialTimeout("tcp", network, timeout)
|
||||
|
||||
if err != nil {
|
||||
//log.Warn("PingPort() error: ", err)
|
||||
} else {
|
||||
defer conn.Close()
|
||||
//log.Debug("ping OK: ", network)
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
func Ping(IP, Port string) {
|
||||
var err error
|
||||
|
||||
network := IP + ":" + Port
|
||||
|
||||
err = Ping_err(IP, Port)
|
||||
if err != nil {
|
||||
log.Panic("Ping() error: ", err)
|
||||
} else {
|
||||
log.Debug("Ping() OK: ", network)
|
||||
}
|
||||
}
|
43
port_checker/port_checker.go
Normal file
43
port_checker/port_checker.go
Normal file
@ -0,0 +1,43 @@
|
||||
package port_checker
|
||||
|
||||
import (
|
||||
"github.com/ManyakRus/starter/logger"
|
||||
"net"
|
||||
"time"
|
||||
)
|
||||
|
||||
// log - глобальный логгер
|
||||
var log = logger.GetLog()
|
||||
|
||||
// CheckPort_err - проверяет доступность порта, возвращает ошибку
|
||||
func CheckPort_err(IP, Port string) error {
|
||||
var err error
|
||||
|
||||
var timeout time.Duration
|
||||
timeout = time.Second * 3
|
||||
network := IP + ":" + Port
|
||||
|
||||
conn, err := net.DialTimeout("tcp", network, timeout)
|
||||
|
||||
if err != nil {
|
||||
} else {
|
||||
defer conn.Close()
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// CheckPort - проверяет доступность порта
|
||||
// создаёт панику при ошибке
|
||||
func CheckPort(IP, Port string) {
|
||||
var err error
|
||||
|
||||
network := IP + ":" + Port
|
||||
|
||||
err = CheckPort_err(IP, Port)
|
||||
if err != nil {
|
||||
log.Panic("CheckPort() error: ", err)
|
||||
} else {
|
||||
log.Debug("CheckPort() OK: ", network)
|
||||
}
|
||||
}
|
@ -1,24 +1,24 @@
|
||||
package ping
|
||||
package port_checker
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestPingPort(t *testing.T) {
|
||||
func TestCheckPort(t *testing.T) {
|
||||
|
||||
IP := "10.1.9.151"
|
||||
Port := "26500"
|
||||
TimeStart := time.Now()
|
||||
|
||||
err := Ping_err(IP, Port)
|
||||
err := CheckPort_err(IP, Port)
|
||||
|
||||
t.Log("Прошло время: ", time.Since(TimeStart))
|
||||
|
||||
if err != nil {
|
||||
t.Error("PingPort() error: ", err)
|
||||
t.Error("TestCheckPort() error: ", err)
|
||||
} else {
|
||||
t.Log("PingPort() OK.")
|
||||
t.Log("TestCheckPort() OK.")
|
||||
}
|
||||
|
||||
}
|
@ -6,7 +6,7 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"github.com/ManyakRus/starter/logger"
|
||||
"github.com/ManyakRus/starter/ping"
|
||||
"github.com/ManyakRus/starter/port_checker"
|
||||
"github.com/jmoiron/sqlx"
|
||||
_ "github.com/lib/pq"
|
||||
"os"
|
||||
@ -50,7 +50,7 @@ func Connect() {
|
||||
FillSettings()
|
||||
}
|
||||
|
||||
ping.Ping(Settings.DB_HOST, Settings.DB_PORT)
|
||||
port_checker.CheckPort(Settings.DB_HOST, Settings.DB_PORT)
|
||||
|
||||
err := Connect_err()
|
||||
if err != nil {
|
||||
@ -274,13 +274,13 @@ loop:
|
||||
log.Warn("Context app is canceled. postgres_connect.ping")
|
||||
break loop
|
||||
case <-ticker.C:
|
||||
err := ping.Ping_err(Settings.DB_HOST, Settings.DB_PORT)
|
||||
err := port_checker.CheckPort_err(Settings.DB_HOST, Settings.DB_PORT)
|
||||
//log.Debug("ticker, ping err: ", err) //удалить
|
||||
if err != nil {
|
||||
NeedReconnect = true
|
||||
log.Warn("postgres_connect Ping(", addr, ") error: ", err)
|
||||
log.Warn("postgres_connect CheckPort(", addr, ") error: ", err)
|
||||
} else if NeedReconnect == true {
|
||||
log.Warn("postgres_connect Ping(", addr, ") OK. Start Reconnect()")
|
||||
log.Warn("postgres_connect CheckPort(", addr, ") OK. Start Reconnect()")
|
||||
NeedReconnect = false
|
||||
Connect()
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ import (
|
||||
|
||||
//log "github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/ManyakRus/starter/config"
|
||||
"github.com/ManyakRus/starter/config_main"
|
||||
"github.com/ManyakRus/starter/contextmain"
|
||||
"github.com/ManyakRus/starter/micro"
|
||||
|
||||
@ -18,7 +18,7 @@ func TestConnect_err(t *testing.T) {
|
||||
//Connect_Panic()
|
||||
|
||||
//ProgramDir := micro.ProgramDir_Common()
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
err := Connect_err()
|
||||
if err != nil {
|
||||
t.Error("TestConnect() error: ", err)
|
||||
@ -32,7 +32,7 @@ func TestConnect_err(t *testing.T) {
|
||||
|
||||
func TestIsClosed(t *testing.T) {
|
||||
//ProgramDir := micro.ProgramDir_Common()
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
|
||||
err := Connect_err()
|
||||
if err != nil {
|
||||
@ -53,7 +53,7 @@ func TestIsClosed(t *testing.T) {
|
||||
|
||||
func TestReconnect(t *testing.T) {
|
||||
//ProgramDir := micro.ProgramDir_Common()
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
err := Connect_err()
|
||||
if err != nil {
|
||||
t.Error("TestReconnect() Connect_err() error: ", err)
|
||||
@ -83,7 +83,7 @@ func TestWaitStop(t *testing.T) {
|
||||
|
||||
func TestStartDB(t *testing.T) {
|
||||
//ProgramDir := micro.ProgramDir_Common()
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
StartDB()
|
||||
err := CloseConnection_err()
|
||||
if err != nil {
|
||||
@ -93,7 +93,7 @@ func TestStartDB(t *testing.T) {
|
||||
|
||||
func TestConnect(t *testing.T) {
|
||||
//ProgramDir := micro.ProgramDir_Common()
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
Connect()
|
||||
|
||||
CloseConnection()
|
||||
|
@ -7,7 +7,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/ManyakRus/starter/logger"
|
||||
"github.com/ManyakRus/starter/ping"
|
||||
"github.com/ManyakRus/starter/port_checker"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@ -61,7 +61,7 @@ func Connect() {
|
||||
FillSettings()
|
||||
}
|
||||
|
||||
ping.Ping(Settings.DB_HOST, Settings.DB_PORT)
|
||||
port_checker.CheckPort(Settings.DB_HOST, Settings.DB_PORT)
|
||||
|
||||
err := Connect_err()
|
||||
if err != nil {
|
||||
@ -138,7 +138,7 @@ func IsClosed() bool {
|
||||
|
||||
err = DB.Ping()
|
||||
if err != nil {
|
||||
log.Error("DB.Ping() error: ", err)
|
||||
log.Error("DB.CheckPort() error: ", err)
|
||||
return true
|
||||
}
|
||||
return otvet
|
||||
@ -374,13 +374,13 @@ loop:
|
||||
log.Warn("Context app is canceled. postgres_gorm.ping")
|
||||
break loop
|
||||
case <-ticker.C:
|
||||
err := ping.Ping_err(Settings.DB_HOST, Settings.DB_PORT)
|
||||
err := port_checker.CheckPort_err(Settings.DB_HOST, Settings.DB_PORT)
|
||||
//log.Debug("ticker, ping err: ", err) //удалить
|
||||
if err != nil {
|
||||
NeedReconnect = true
|
||||
log.Warn("postgres_gorm Ping(", addr, ") error: ", err)
|
||||
log.Warn("postgres_gorm CheckPort(", addr, ") error: ", err)
|
||||
} else if NeedReconnect == true {
|
||||
log.Warn("postgres_gorm Ping(", addr, ") OK. Start Reconnect()")
|
||||
log.Warn("postgres_gorm CheckPort(", addr, ") OK. Start Reconnect()")
|
||||
NeedReconnect = false
|
||||
Connect()
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ import (
|
||||
|
||||
//log "github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/ManyakRus/starter/config"
|
||||
"github.com/ManyakRus/starter/config_main"
|
||||
"github.com/ManyakRus/starter/contextmain"
|
||||
"github.com/ManyakRus/starter/micro"
|
||||
|
||||
@ -15,7 +15,7 @@ import (
|
||||
)
|
||||
|
||||
func TestConnect_err(t *testing.T) {
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
err := Connect_err()
|
||||
if err != nil {
|
||||
t.Error("TestConnect error: ", err)
|
||||
@ -29,7 +29,7 @@ func TestConnect_err(t *testing.T) {
|
||||
|
||||
func TestIsClosed(t *testing.T) {
|
||||
//ProgramDir := micro.ProgramDir_Common()
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
|
||||
err := Connect_err()
|
||||
if err != nil {
|
||||
@ -50,7 +50,7 @@ func TestIsClosed(t *testing.T) {
|
||||
|
||||
func TestReconnect(t *testing.T) {
|
||||
//ProgramDir := micro.ProgramDir_Common()
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
err := Connect_err()
|
||||
if err != nil {
|
||||
t.Error("TestIsClosed Connect() error: ", err)
|
||||
@ -80,7 +80,7 @@ func TestWaitStop(t *testing.T) {
|
||||
|
||||
func TestStartDB(t *testing.T) {
|
||||
//ProgramDir := micro.ProgramDir_Common()
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
StartDB()
|
||||
err := CloseConnection_err()
|
||||
if err != nil {
|
||||
@ -90,7 +90,7 @@ func TestStartDB(t *testing.T) {
|
||||
|
||||
func TestConnect(t *testing.T) {
|
||||
//ProgramDir := micro.ProgramDir_Common()
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
Connect()
|
||||
|
||||
CloseConnection()
|
||||
@ -98,7 +98,7 @@ func TestConnect(t *testing.T) {
|
||||
|
||||
func TestGetConnection(t *testing.T) {
|
||||
//ProgramDir := micro.ProgramDir_Common()
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
GetConnection()
|
||||
|
||||
CloseConnection()
|
||||
@ -106,7 +106,7 @@ func TestGetConnection(t *testing.T) {
|
||||
|
||||
func TestConnect_WithApplicationName_err(t *testing.T) {
|
||||
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
err := Connect_WithApplicationName_err("starter test")
|
||||
if err != nil {
|
||||
t.Error("TestConnect_WithApplicationName_err error: ", err)
|
||||
@ -121,7 +121,7 @@ func TestConnect_WithApplicationName_err(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRawMultipleSQL(t *testing.T) {
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
GetConnection()
|
||||
defer CloseConnection()
|
||||
|
||||
|
@ -6,7 +6,7 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"github.com/ManyakRus/starter/logger"
|
||||
"github.com/ManyakRus/starter/ping"
|
||||
"github.com/ManyakRus/starter/port_checker"
|
||||
"github.com/jackc/pgx/v4"
|
||||
"strings"
|
||||
"time"
|
||||
@ -59,7 +59,7 @@ func Connect() {
|
||||
FillSettings()
|
||||
}
|
||||
|
||||
ping.Ping(Settings.DB_HOST, Settings.DB_PORT)
|
||||
port_checker.CheckPort(Settings.DB_HOST, Settings.DB_PORT)
|
||||
|
||||
err := Connect_err()
|
||||
if err != nil {
|
||||
@ -312,13 +312,13 @@ loop:
|
||||
log.Warn("Context app is canceled. postgres_gorm.ping")
|
||||
break loop
|
||||
case <-ticker.C:
|
||||
err := ping.Ping_err(Settings.DB_HOST, Settings.DB_PORT)
|
||||
err := port_checker.CheckPort_err(Settings.DB_HOST, Settings.DB_PORT)
|
||||
//log.Debug("ticker, ping err: ", err) //удалить
|
||||
if err != nil {
|
||||
NeedReconnect = true
|
||||
log.Warn("postgres_gorm Ping(", addr, ") error: ", err)
|
||||
log.Warn("postgres_gorm CheckPort(", addr, ") error: ", err)
|
||||
} else if NeedReconnect == true {
|
||||
log.Warn("postgres_gorm Ping(", addr, ") OK. Start Reconnect()")
|
||||
log.Warn("postgres_gorm CheckPort(", addr, ") OK. Start Reconnect()")
|
||||
NeedReconnect = false
|
||||
Connect()
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ import (
|
||||
|
||||
//log "github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/ManyakRus/starter/config"
|
||||
"github.com/ManyakRus/starter/config_main"
|
||||
"github.com/ManyakRus/starter/contextmain"
|
||||
"github.com/ManyakRus/starter/micro"
|
||||
|
||||
@ -18,7 +18,7 @@ func TestConnect_err(t *testing.T) {
|
||||
//Connect_Panic()
|
||||
|
||||
//ProgramDir := micro.ProgramDir_Common()
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
err := Connect_err()
|
||||
if err != nil {
|
||||
t.Error("TestConnect error: ", err)
|
||||
@ -32,7 +32,7 @@ func TestConnect_err(t *testing.T) {
|
||||
|
||||
func TestIsClosed(t *testing.T) {
|
||||
//ProgramDir := micro.ProgramDir_Common()
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
|
||||
err := Connect_err()
|
||||
if err != nil {
|
||||
@ -53,7 +53,7 @@ func TestIsClosed(t *testing.T) {
|
||||
|
||||
func TestReconnect(t *testing.T) {
|
||||
//ProgramDir := micro.ProgramDir_Common()
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
err := Connect_err()
|
||||
if err != nil {
|
||||
t.Error("TestIsClosed Connect() error: ", err)
|
||||
@ -84,7 +84,7 @@ func TestWaitStop(t *testing.T) {
|
||||
|
||||
func TestStartDB(t *testing.T) {
|
||||
//ProgramDir := micro.ProgramDir_Common()
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
StartDB()
|
||||
err := CloseConnection_err()
|
||||
if err != nil {
|
||||
@ -94,7 +94,7 @@ func TestStartDB(t *testing.T) {
|
||||
|
||||
func TestConnect(t *testing.T) {
|
||||
//ProgramDir := micro.ProgramDir_Common()
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
Connect()
|
||||
|
||||
CloseConnection()
|
||||
@ -102,7 +102,7 @@ func TestConnect(t *testing.T) {
|
||||
|
||||
func TestConnect_WithApplicationName_err(t *testing.T) {
|
||||
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
err := Connect_WithApplicationName_err("test_starter_postgres_pgx")
|
||||
if err != nil {
|
||||
t.Error("TestConnect_WithApplicationName_err error: ", err)
|
||||
|
@ -6,7 +6,7 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"github.com/ManyakRus/starter/logger"
|
||||
"github.com/ManyakRus/starter/ping"
|
||||
"github.com/ManyakRus/starter/port_checker"
|
||||
"gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/object_model/entities/connections"
|
||||
"time"
|
||||
|
||||
@ -54,7 +54,7 @@ func Connect(Connection connections.Connection) {
|
||||
log.Panicln("Need fill Connection.Server")
|
||||
}
|
||||
|
||||
ping.Ping(Connection.Server, Connection.Port)
|
||||
port_checker.CheckPort(Connection.Server, Connection.Port)
|
||||
|
||||
err := Connect_err(Connection)
|
||||
if err != nil {
|
||||
@ -125,7 +125,7 @@ func IsClosed(Connection connections.Connection) bool {
|
||||
|
||||
err = DB.Ping()
|
||||
if err != nil {
|
||||
log.Error("DB.Ping() error: ", err)
|
||||
log.Error("DB.CheckPort() error: ", err)
|
||||
return true
|
||||
}
|
||||
return otvet
|
||||
@ -322,13 +322,13 @@ loop:
|
||||
log.Warn("Context app is canceled. postgres_stek.ping")
|
||||
break loop
|
||||
case <-ticker.C:
|
||||
err := ping.Ping_err(Connection.Server, Connection.Port)
|
||||
err := port_checker.CheckPort_err(Connection.Server, Connection.Port)
|
||||
//log.Debug("ticker, ping err: ", err) //удалить
|
||||
if err != nil {
|
||||
NeedReconnect = true
|
||||
log.Warn("postgres_stek Ping(", addr, ") error: ", err)
|
||||
log.Warn("postgres_stek CheckPort(", addr, ") error: ", err)
|
||||
} else if NeedReconnect == true {
|
||||
log.Warn("postgres_stek Ping(", addr, ") OK. Start Reconnect()")
|
||||
log.Warn("postgres_stek CheckPort(", addr, ") OK. Start Reconnect()")
|
||||
NeedReconnect = false
|
||||
Connect(Connection)
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ import (
|
||||
|
||||
//log "github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/ManyakRus/starter/config"
|
||||
"github.com/ManyakRus/starter/config_main"
|
||||
"github.com/ManyakRus/starter/contextmain"
|
||||
"github.com/ManyakRus/starter/micro"
|
||||
|
||||
@ -19,7 +19,7 @@ func TestConnect_err(t *testing.T) {
|
||||
//Connect_Panic()
|
||||
|
||||
//ProgramDir := micro.ProgramDir_Common()
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
err := Connect_err(constants.CONNECTION)
|
||||
if err != nil {
|
||||
t.Error("TestConnect error: ", err)
|
||||
@ -33,7 +33,7 @@ func TestConnect_err(t *testing.T) {
|
||||
|
||||
func TestIsClosed(t *testing.T) {
|
||||
//ProgramDir := micro.ProgramDir_Common()
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
|
||||
err := Connect_err(constants.CONNECTION)
|
||||
if err != nil {
|
||||
@ -54,7 +54,7 @@ func TestIsClosed(t *testing.T) {
|
||||
|
||||
func TestReconnect(t *testing.T) {
|
||||
//ProgramDir := micro.ProgramDir_Common()
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
err := Connect_err(constants.CONNECTION)
|
||||
if err != nil {
|
||||
t.Error("TestIsClosed Connect() error: ", err)
|
||||
@ -84,7 +84,7 @@ func TestWaitStop(t *testing.T) {
|
||||
|
||||
func TestStartDB(t *testing.T) {
|
||||
//ProgramDir := micro.ProgramDir_Common()
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
StartDB(constants.CONNECTION)
|
||||
err := CloseConnection_err(constants.CONNECTION)
|
||||
if err != nil {
|
||||
@ -94,7 +94,7 @@ func TestStartDB(t *testing.T) {
|
||||
|
||||
func TestConnect(t *testing.T) {
|
||||
//ProgramDir := micro.ProgramDir_Common()
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
Connect(constants.CONNECTION)
|
||||
|
||||
CloseConnection(constants.CONNECTION)
|
||||
@ -102,7 +102,7 @@ func TestConnect(t *testing.T) {
|
||||
|
||||
func TestGetConnection(t *testing.T) {
|
||||
//ProgramDir := micro.ProgramDir_Common()
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
GetConnection(constants.CONNECTION)
|
||||
|
||||
CloseConnection(constants.CONNECTION)
|
||||
|
@ -1,7 +1,7 @@
|
||||
package sync_exchange_connect
|
||||
|
||||
import (
|
||||
"github.com/ManyakRus/starter/config"
|
||||
"github.com/ManyakRus/starter/config_main"
|
||||
"github.com/ManyakRus/starter/contextmain"
|
||||
"github.com/ManyakRus/starter/micro"
|
||||
"github.com/ManyakRus/starter/stopapp"
|
||||
@ -11,7 +11,7 @@ import (
|
||||
var SERVICE_NAME_TEST = "test_nikitin"
|
||||
|
||||
func TestConnect(t *testing.T) {
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
Connect(SERVICE_NAME_TEST)
|
||||
defer CloseConnection()
|
||||
|
||||
@ -20,7 +20,7 @@ func TestConnect(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestStartNats(t *testing.T) {
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
Start(SERVICE_NAME_TEST)
|
||||
defer CloseConnection()
|
||||
|
||||
@ -31,7 +31,7 @@ func TestStartNats(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCloseConnection(t *testing.T) {
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
Connect(SERVICE_NAME_TEST)
|
||||
defer CloseConnection()
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ import (
|
||||
|
||||
"github.com/gotd/td/tg"
|
||||
|
||||
"github.com/ManyakRus/starter/config"
|
||||
"github.com/ManyakRus/starter/config_main"
|
||||
"github.com/ManyakRus/starter/contextmain"
|
||||
"github.com/ManyakRus/starter/micro"
|
||||
"github.com/ManyakRus/starter/stopapp"
|
||||
@ -19,7 +19,7 @@ import (
|
||||
|
||||
func TestCreateTelegramClient(t *testing.T) {
|
||||
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
|
||||
//ctx := contextmain.GetContext()
|
||||
CreateTelegramClient(nil)
|
||||
@ -36,7 +36,7 @@ func TestTimeLimit(t *testing.T) {
|
||||
|
||||
func TestSendMessage(t *testing.T) {
|
||||
var err error
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
//stopapp.StartWaitStop()
|
||||
|
||||
ctx := contextmain.GetContext()
|
||||
@ -91,7 +91,7 @@ func TestSendMessage(t *testing.T) {
|
||||
//}
|
||||
|
||||
func TestConnectTelegram(t *testing.T) {
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
|
||||
//ctx := contextmain.GetContext()
|
||||
|
||||
@ -117,7 +117,7 @@ func Test_termAuth_Phone(t *testing.T) {
|
||||
|
||||
func TestSendMessage_Many(t *testing.T) {
|
||||
t.SkipNow() //убрать комментарий
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
stopapp.StartWaitStop()
|
||||
|
||||
CreateTelegramClient(nil)
|
||||
|
@ -4,7 +4,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/ManyakRus/starter/config"
|
||||
"github.com/ManyakRus/starter/config_main"
|
||||
"github.com/ManyakRus/starter/micro"
|
||||
)
|
||||
|
||||
@ -13,7 +13,7 @@ func TestCreateClient(t *testing.T) {
|
||||
|
||||
//ProgramDir := programdir.ProgramDir()
|
||||
//ProgramDir := micro.ProgramDir_Common()
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
FillSettings()
|
||||
|
||||
err := Connect_err(eventHandler_test)
|
||||
@ -29,7 +29,7 @@ func TestSendMessage(t *testing.T) {
|
||||
|
||||
//ProgramDir := programdir.ProgramDir()
|
||||
//ProgramDir := micro.ProgramDir_Common()
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
FillSettings()
|
||||
|
||||
err := Connect_err(eventHandler_test)
|
||||
@ -65,7 +65,7 @@ func TestParseJID(t *testing.T) {
|
||||
|
||||
func TestMessageWhatsapp_String(t *testing.T) {
|
||||
//ProgramDir := micro.ProgramDir_Common()
|
||||
config.LoadEnv()
|
||||
config_main.LoadEnv()
|
||||
FillSettings()
|
||||
|
||||
m := MessageWhatsapp{}
|
||||
|
Loading…
x
Reference in New Issue
Block a user