feat: publish standalone worker

Separate worker packaging and service lifecycle from the control plane.
Этот коммит содержится в:
Gleb Tv
2026-07-13 17:55:14 +03:00
Коммит 2c7a0236da
309 изменённых файлов: 44004 добавлений и 0 удалений

34
internal/sender/context_test.go Обычный файл
Просмотреть файл

@@ -0,0 +1,34 @@
package sender
import (
"context"
"errors"
"net/http"
"net/http/httptest"
"testing"
"time"
"github.com/stretchr/testify/require"
)
func TestMattermostContextDeadlineInterruptsBlockingRequest(t *testing.T) {
started := make(chan struct{})
release := make(chan struct{})
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
close(started)
<-release
}))
defer server.Close()
ctx, cancel := context.WithTimeout(context.Background(), 25*time.Millisecond)
defer cancel()
_, err := SendMattermostWithCredentialContext(ctx, server.URL, "maintenance_start", "subject", "body", nil)
select {
case <-started:
case <-time.After(time.Second):
t.Fatal("request did not reach blocking server")
}
close(release)
require.Error(t, err)
require.True(t, errors.Is(err, context.DeadlineExceeded))
}