mirror of
https://github.com/unpoller/unpoller.git
synced 2026-09-29 19:11:17 +02:00
Merge pull request #1077 from NotAFlightRisk/fix/health-check-empty-http-listen
This commit is contained in:
@@ -234,7 +234,7 @@ func (u *promUnifi) DebugOutput() (bool, error) {
|
||||
}
|
||||
|
||||
if u.HTTPListen == "" {
|
||||
return false, fmt.Errorf("invalid listen string")
|
||||
u.HTTPListen = defaultHTTPListen
|
||||
}
|
||||
|
||||
// check the port
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
//nolint:testpackage // white-box: exercises the unexported output plugin.
|
||||
package promunifi
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/unpoller/unpoller/pkg/poller"
|
||||
)
|
||||
|
||||
func TestDebugOutputAcceptsUnsetHTTPListen(t *testing.T) {
|
||||
poller.SetHealthCheckMode(true)
|
||||
t.Cleanup(func() { poller.SetHealthCheckMode(false) })
|
||||
|
||||
u := &promUnifi{Config: &Config{}}
|
||||
|
||||
ok, err := u.DebugOutput()
|
||||
require.NoError(t, err)
|
||||
assert.True(t, ok)
|
||||
assert.Equal(t, defaultHTTPListen, u.HTTPListen)
|
||||
}
|
||||
Reference in New Issue
Block a user