mirror of
https://github.com/akvorado/akvorado.git
synced 2025-12-11 22:14:02 +01:00
``` goos: linux goarch: amd64 pkg: akvorado/orchestrator/clickhouse cpu: AMD Ryzen 5 5600X 6-Core Processor BenchmarkNetworks-12 482 2.447 ms/op ```
28 lines
603 B
Go
28 lines
603 B
Go
// SPDX-FileCopyrightText: 2022 Free Mobile
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
//go:build !release
|
|
|
|
package httpserver
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"akvorado/common/daemon"
|
|
"akvorado/common/helpers"
|
|
"akvorado/common/reporter"
|
|
)
|
|
|
|
// NewMock create a new HTTP component listening on a random free port.
|
|
func NewMock(t testing.TB, r *reporter.Reporter) *Component {
|
|
t.Helper()
|
|
config := DefaultConfiguration()
|
|
config.Listen = "0.0.0.0:0"
|
|
c, err := New(r, config, Dependencies{Daemon: daemon.NewMock(t)})
|
|
if err != nil {
|
|
t.Fatalf("New() error:\n%+v", err)
|
|
}
|
|
helpers.StartStop(t, c)
|
|
return c
|
|
}
|