From 2cedcecc386f3b161461c264e2e7b107e4f73d2b Mon Sep 17 00:00:00 2001 From: Julien Neuhart Date: Thu, 13 Dec 2018 14:46:59 +0100 Subject: [PATCH] adding concurrent testing --- build/tests/docker-entrypoint.sh | 3 ++- pkg/html_test.go | 8 ++++++++ pkg/markdown_test.go | 8 ++++++++ pkg/merge_test.go | 8 ++++++++ pkg/office_test.go | 8 ++++++++ 5 files changed, 34 insertions(+), 1 deletion(-) diff --git a/build/tests/docker-entrypoint.sh b/build/tests/docker-entrypoint.sh index 86739e26..b0e120a5 100755 --- a/build/tests/docker-entrypoint.sh +++ b/build/tests/docker-entrypoint.sh @@ -21,4 +21,5 @@ go test github.com/thecodingmachine/gotenberg/internal/pkg/pm2 -run TestUnoconvS go build -o /usr/local/bin/gotenberg cmd/gotenberg/main.go gotenberg & sleep 10 -go test -race -cover -covermode=atomic github.com/thecodingmachine/gotenberg/pkg \ No newline at end of file +go test -race -cover -covermode=atomic github.com/thecodingmachine/gotenberg/pkg +sleep 5 # allows Gotenberg to remove generated files (concurrent requests). \ No newline at end of file diff --git a/pkg/html_test.go b/pkg/html_test.go index 23cad563..1d674bdf 100644 --- a/pkg/html_test.go +++ b/pkg/html_test.go @@ -37,3 +37,11 @@ func TestHTML(t *testing.T) { err = os.RemoveAll(dirPath) assert.Nil(t, err) } + +func TestConcurrentHTML(t *testing.T) { + for i := 0; i < 10; i++ { + go func() { + TestHTML(t) + }() + } +} diff --git a/pkg/markdown_test.go b/pkg/markdown_test.go index 6a188c18..f15c883c 100644 --- a/pkg/markdown_test.go +++ b/pkg/markdown_test.go @@ -44,3 +44,11 @@ func TestMarkdown(t *testing.T) { err = os.RemoveAll(dirPath) assert.Nil(t, err) } + +func TestConcurrentMarkdown(t *testing.T) { + for i := 0; i < 10; i++ { + go func() { + TestMarkdown(t) + }() + } +} diff --git a/pkg/merge_test.go b/pkg/merge_test.go index a7221e56..7f8b578f 100644 --- a/pkg/merge_test.go +++ b/pkg/merge_test.go @@ -27,3 +27,11 @@ func TestMerge(t *testing.T) { err = os.RemoveAll(dirPath) assert.Nil(t, err) } + +func TestConcurrentMerge(t *testing.T) { + for i := 0; i < 10; i++ { + go func() { + TestMerge(t) + }() + } +} diff --git a/pkg/office_test.go b/pkg/office_test.go index e1b276b9..4f1bf682 100644 --- a/pkg/office_test.go +++ b/pkg/office_test.go @@ -28,3 +28,11 @@ func TestOffice(t *testing.T) { err = os.RemoveAll(dirPath) assert.Nil(t, err) } + +func TestConcurrentOffice(t *testing.T) { + for i := 0; i < 10; i++ { + go func() { + TestOffice(t) + }() + } +}