forked from cschleiden/go-workflows
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmonoprocess_test.go
More file actions
52 lines (40 loc) · 1.43 KB
/
Copy pathmonoprocess_test.go
File metadata and controls
52 lines (40 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package monoprocess
import (
"context"
"errors"
"testing"
"github.com/stretchr/testify/require"
"github.com/cschleiden/go-workflows/backend"
"github.com/cschleiden/go-workflows/backend/history"
"github.com/cschleiden/go-workflows/backend/sqlite"
"github.com/cschleiden/go-workflows/backend/test"
)
func Test_MonoprocessBackend(t *testing.T) {
if testing.Short() {
t.Skip()
}
test.BackendTest(t, func(options ...backend.BackendOption) test.TestBackend {
// Disable sticky workflow behavior for the test execution
options = append(options, backend.WithStickyTimeout(0))
return NewMonoprocessBackend(sqlite.NewInMemoryBackend(sqlite.WithBackendOptions(options...)))
}, func(b test.TestBackend) {
require.NoError(t, b.Close())
})
}
func Test_EndToEndMonoprocessBackend(t *testing.T) {
if testing.Short() {
t.Skip()
}
test.EndToEndBackendTest(t, func(options ...backend.BackendOption) test.TestBackend {
// Disable sticky workflow behavior for the test execution
options = append(options, backend.WithStickyTimeout(0))
return NewMonoprocessBackend(sqlite.NewInMemoryBackend(sqlite.WithBackendOptions(options...)))
}, nil)
}
var _ test.TestBackend = (*monoprocessBackend)(nil)
func (b *monoprocessBackend) GetFutureEvents(ctx context.Context) ([]*history.Event, error) {
if testBackend, ok := b.Backend.(test.TestBackend); ok {
return testBackend.GetFutureEvents(ctx)
}
return nil, errors.New("not implemented")
}