mirror of
https://github.com/safing/portbase
synced 2025-09-10 23:34:42 +00:00
Fix tests and linter warnings
This commit is contained in:
parent
7d2cd6c15d
commit
f59ad0357a
162 changed files with 668 additions and 696 deletions
|
@ -13,6 +13,8 @@ var (
|
|||
)
|
||||
|
||||
func registerTestModule(t *testing.T, name string, dependencies ...string) {
|
||||
t.Helper()
|
||||
|
||||
Register(
|
||||
name,
|
||||
func() error {
|
||||
|
@ -45,16 +47,15 @@ func testCleanExit() error {
|
|||
return ErrCleanExit
|
||||
}
|
||||
|
||||
func TestModules(t *testing.T) {
|
||||
func TestModules(t *testing.T) { //nolint:tparallel // Too much interference expected.
|
||||
t.Parallel() // Not really, just a workaround for running these tests last.
|
||||
|
||||
t.Run("TestModuleOrder", testModuleOrder)
|
||||
t.Run("TestModuleMgmt", testModuleMgmt)
|
||||
t.Run("TestModuleErrors", testModuleErrors)
|
||||
t.Run("TestModuleOrder", testModuleOrder) //nolint:paralleltest // Too much interference expected.
|
||||
t.Run("TestModuleMgmt", testModuleMgmt) //nolint:paralleltest // Too much interference expected.
|
||||
t.Run("TestModuleErrors", testModuleErrors) //nolint:paralleltest // Too much interference expected.
|
||||
}
|
||||
|
||||
func testModuleOrder(t *testing.T) {
|
||||
|
||||
registerTestModule(t, "database")
|
||||
registerTestModule(t, "stats", "database")
|
||||
registerTestModule(t, "service", "database")
|
||||
|
@ -88,7 +89,6 @@ func testModuleOrder(t *testing.T) {
|
|||
}
|
||||
|
||||
func testModuleErrors(t *testing.T) {
|
||||
|
||||
// test prep error
|
||||
Register("prepfail", testFail, nil, nil)
|
||||
err := Start()
|
||||
|
@ -101,7 +101,7 @@ func testModuleErrors(t *testing.T) {
|
|||
// test prep clean exit
|
||||
Register("prepcleanexit", testCleanExit, nil, nil)
|
||||
err = Start()
|
||||
if err != ErrCleanExit {
|
||||
if !errors.Is(err, ErrCleanExit) {
|
||||
t.Error("should fail with clean exit")
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue