feat: publish standalone worker
Separate worker packaging and service lifecycle from the control plane.
Этот коммит содержится в:
24
app/models/telegram_bot_test.go
Обычный файл
24
app/models/telegram_bot_test.go
Обычный файл
@@ -0,0 +1,24 @@
|
||||
package models_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"rsgit.ru/rsmon/rsmon/app/models"
|
||||
)
|
||||
|
||||
func TestTelegramBotCurrentStatusMarksStaleOffline(t *testing.T) {
|
||||
models.Drop()
|
||||
models.Migrate()
|
||||
|
||||
seen := time.Now().Add(-3 * time.Minute)
|
||||
status := models.TelegramBotStatus{Name: models.TelegramBotStatusMain, Online: true, LastSeen: &seen}
|
||||
require.NoError(t, models.DB().Create(&status).Error)
|
||||
|
||||
got, err := models.TelegramBotCurrentStatus()
|
||||
require.NoError(t, err)
|
||||
assert.False(t, got.Online)
|
||||
}
|
||||
Ссылка в новой задаче
Block a user