adding missingt test in context package

This commit is contained in:
Julien Neuhart
2019-08-18 19:24:08 +02:00
parent f695861731
commit 4f3fe28905
3 changed files with 70 additions and 2 deletions

View File

@@ -6,6 +6,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/thecodingmachine/gotenberg/internal/pkg/conf"
"github.com/thecodingmachine/gotenberg/internal/pkg/pm2"
"github.com/thecodingmachine/gotenberg/test"
)
@@ -26,6 +27,27 @@ func TestMustCastFromEchoContext(t *testing.T) {
})
}
func TestProcessesHealthcheck(t *testing.T) {
// process is viable.
ctx := New(
test.DummyEchoContext(),
test.DebugLogger(),
conf.DefaultConfig(),
pm2.NewDummyProcess(true),
)
err := ctx.ProcessesHealthcheck()
assert.Nil(t, err)
// process is not viable.
ctx = New(
test.DummyEchoContext(),
test.DebugLogger(),
conf.DefaultConfig(),
pm2.NewDummyProcess(false),
)
err = ctx.ProcessesHealthcheck()
test.AssertError(t, err)
}
func TestLogRequestResult(t *testing.T) {
ctx := New(
test.DummyEchoContext(),