@@ -8,35 +8,46 @@ import (
8
8
"github.com/cschleiden/go-workflows/backend"
9
9
"github.com/cschleiden/go-workflows/backend/test"
10
10
"github.com/go-redis/redis/v8"
11
- "github.com/stretchr/testify/require"
12
11
)
13
12
14
13
func Test_RedisBackend (t * testing.T ) {
15
14
if testing .Short () {
16
15
t .Skip ()
17
16
}
18
17
19
- test .BackendTest (t , func () backend.Backend {
20
- address := "localhost:6379"
21
- user := ""
22
- password := "RedisPassw0rd"
23
-
24
- // Flush database
25
- client := redis .NewUniversalClient (& redis.UniversalOptions {
26
- Addrs : []string {address },
27
- Username : user ,
28
- Password : password ,
29
- DB : 0 ,
30
- })
31
-
32
- if err := client .FlushDB (context .Background ()).Err (); err != nil {
33
- panic (err )
34
- }
35
-
36
- // Disable sticky workflow behavior for the test execution
37
- b , err := NewRedisBackend (address , user , password , 0 , WithBlockTimeout (time .Millisecond * 2 ))
38
- require .NoError (t , err )
39
-
40
- return b
41
- }, nil )
18
+ test .BackendTest (t , createBackend , nil )
19
+ }
20
+
21
+ func Test_EndToEndRedisBackend (t * testing.T ) {
22
+ if testing .Short () {
23
+ t .Skip ()
24
+ }
25
+
26
+ test .EndToEndBackendTest (t , createBackend , nil )
27
+ }
28
+
29
+ func createBackend () backend.Backend {
30
+ address := "localhost:6379"
31
+ user := ""
32
+ password := "RedisPassw0rd"
33
+
34
+ // Flush database
35
+ client := redis .NewUniversalClient (& redis.UniversalOptions {
36
+ Addrs : []string {address },
37
+ Username : user ,
38
+ Password : password ,
39
+ DB : 0 ,
40
+ })
41
+
42
+ if err := client .FlushDB (context .Background ()).Err (); err != nil {
43
+ panic (err )
44
+ }
45
+
46
+ // Disable sticky workflow behavior for the test execution
47
+ b , err := NewRedisBackend (address , user , password , 0 , WithBlockTimeout (time .Millisecond * 2 ))
48
+ if err != nil {
49
+ panic (err )
50
+ }
51
+
52
+ return b
42
53
}
0 commit comments