mirror of
https://github.com/akvorado/akvorado.git
synced 2025-12-11 22:14:02 +01:00
global: split Akvorado into 3 services
This commit is contained in:
26
common/http/tests.go
Normal file
26
common/http/tests.go
Normal file
@@ -0,0 +1,26 @@
|
||||
//go:build !release
|
||||
|
||||
package http
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"akvorado/common/daemon"
|
||||
"akvorado/common/reporter"
|
||||
)
|
||||
|
||||
// NewMock create a new HTTP component listening on a random free port.
|
||||
func NewMock(t *testing.T, r *reporter.Reporter) *Component {
|
||||
t.Helper()
|
||||
config := Configuration{
|
||||
Listen: "127.0.0.1:0",
|
||||
}
|
||||
c, err := New(r, config, Dependencies{Daemon: daemon.NewMock(t)})
|
||||
if err != nil {
|
||||
t.Fatalf("New() error:\n%+v", err)
|
||||
}
|
||||
if err := c.Start(); err != nil {
|
||||
t.Fatalf("Start() error:\n%+v", err)
|
||||
}
|
||||
return c
|
||||
}
|
||||
Reference in New Issue
Block a user