feat: notification service

This commit is contained in:
Ilia Denisov
2026-04-22 08:49:45 +02:00
committed by GitHub
parent 5b7593e6f6
commit 32dc29359a
135 changed files with 21828 additions and 130 deletions
+16 -5
View File
@@ -32,8 +32,9 @@ type Process struct {
logsMu sync.Mutex
logs bytes.Buffer
doneCh chan struct{}
waitErr error
doneCh chan struct{}
waitErr error
allowUnexpectedExit bool
}
// StartProcess starts binaryPath with envOverrides and registers cleanup that
@@ -82,7 +83,7 @@ func (p *Process) Stop(t testing.TB) {
select {
case <-p.doneCh:
err := p.waitErr
if err != nil && !isExpectedProcessExit(err) {
if err != nil && !isExpectedProcessExit(err) && !p.allowUnexpectedExit {
t.Errorf("%s exited unexpectedly: %v", p.name, err)
}
return
@@ -96,7 +97,7 @@ func (p *Process) Stop(t testing.TB) {
select {
case <-p.doneCh:
err := p.waitErr
if err != nil && !isExpectedProcessExit(err) {
if err != nil && !isExpectedProcessExit(err) && !p.allowUnexpectedExit {
t.Errorf("%s exited unexpectedly: %v", p.name, err)
}
case <-time.After(defaultStopWait):
@@ -105,12 +106,22 @@ func (p *Process) Stop(t testing.TB) {
}
<-p.doneCh
err := p.waitErr
if err != nil && !isExpectedProcessExit(err) {
if err != nil && !isExpectedProcessExit(err) && !p.allowUnexpectedExit {
t.Errorf("%s exited unexpectedly: %v", p.name, err)
}
}
}
// AllowUnexpectedExit marks a process exit as expected for tests that
// deliberately trigger a fatal runtime dependency failure.
func (p *Process) AllowUnexpectedExit() {
if p == nil {
return
}
p.allowUnexpectedExit = true
}
// Logs returns the captured combined stdout/stderr output of the process.
func (p *Process) Logs() string {
if p == nil {