@@ -40,6 +40,7 @@ var _ = Describe("RedisGears commands", Label("gears"), func() {
40
40
BeforeEach (func () {
41
41
client = redis .NewClient (& redis.Options {Addr : ":6379" })
42
42
Expect (client .FlushDB (ctx ).Err ()).NotTo (HaveOccurred ())
43
+ client .TFunctionDelete (ctx , "lib1" )
43
44
})
44
45
45
46
AfterEach (func () {
@@ -48,23 +49,21 @@ var _ = Describe("RedisGears commands", Label("gears"), func() {
48
49
49
50
It ("should TFunctionLoad, TFunctionLoadArgs and TFunctionDelete " , Label ("gears" , "tfunctionload" ), func () {
50
51
51
- resultAdd , err := client .TFunctionLoad (ctx , libCode ("libtflo1 " )).Result ()
52
+ resultAdd , err := client .TFunctionLoad (ctx , libCode ("lib1 " )).Result ()
52
53
Expect (err ).NotTo (HaveOccurred ())
53
54
Expect (resultAdd ).To (BeEquivalentTo ("OK" ))
54
55
opt := & redis.TFunctionLoadOptions {Replace : true , Config : `{"last_update_field_name":"last_update"}` }
55
- resultAdd , err = client .TFunctionLoadArgs (ctx , libCodeWithConfig ("libtflo1" ), opt ).Result ()
56
- Expect (err ).NotTo (HaveOccurred ())
57
- Expect (resultAdd ).To (BeEquivalentTo ("OK" ))
58
- resultAdd , err = client .TFunctionDelete (ctx , "libtflo1" ).Result ()
56
+ resultAdd , err = client .TFunctionLoadArgs (ctx , libCodeWithConfig ("lib1" ), opt ).Result ()
59
57
Expect (err ).NotTo (HaveOccurred ())
60
58
Expect (resultAdd ).To (BeEquivalentTo ("OK" ))
61
59
62
60
})
63
61
It ("should TFunctionList" , Label ("gears" , "tfunctionlist" ), func () {
64
- resultAdd , err := client .TFunctionLoad (ctx , libCode ("libtfli1" )).Result ()
62
+ client .TFunctionDelete (ctx , "lib2" ).Result ()
63
+ resultAdd , err := client .TFunctionLoad (ctx , libCode ("lib1" )).Result ()
65
64
Expect (err ).NotTo (HaveOccurred ())
66
65
Expect (resultAdd ).To (BeEquivalentTo ("OK" ))
67
- resultAdd , err = client .TFunctionLoad (ctx , libCode ("libtfli2 " )).Result ()
66
+ resultAdd , err = client .TFunctionLoad (ctx , libCode ("lib2 " )).Result ()
68
67
Expect (err ).NotTo (HaveOccurred ())
69
68
Expect (resultAdd ).To (BeEquivalentTo ("OK" ))
70
69
resultList , err := client .TFunctionList (ctx ).Result ()
@@ -73,67 +72,52 @@ var _ = Describe("RedisGears commands", Label("gears"), func() {
73
72
opt := & redis.TFunctionListOptions {Withcode : true , Verbose : 2 }
74
73
resultListArgs , err := client .TFunctionListArgs (ctx , opt ).Result ()
75
74
Expect (err ).NotTo (HaveOccurred ())
76
- Expect (resultListArgs [0 ]["code" ]).To (BeEquivalentTo (libCode ("libtfli1" )))
77
- resultAdd , err = client .TFunctionDelete (ctx , "libtfli1" ).Result ()
78
- Expect (err ).NotTo (HaveOccurred ())
79
- Expect (resultAdd ).To (BeEquivalentTo ("OK" ))
80
- resultAdd , err = client .TFunctionDelete (ctx , "libtfli2" ).Result ()
75
+ Expect (resultListArgs [0 ]["code" ]).To (BeEquivalentTo (libCode ("lib1" )))
76
+ resultAdd , err = client .TFunctionDelete (ctx , "lib2" ).Result ()
81
77
Expect (err ).NotTo (HaveOccurred ())
82
78
Expect (resultAdd ).To (BeEquivalentTo ("OK" ))
83
79
})
84
80
85
81
It ("should TFCall" , Label ("gears" , "tfcall" ), func () {
86
82
var resultAdd interface {}
87
- resultAdd , err := client .TFunctionLoad (ctx , libCode ("libtfc1 " )).Result ()
83
+ resultAdd , err := client .TFunctionLoad (ctx , libCode ("lib1 " )).Result ()
88
84
Expect (err ).NotTo (HaveOccurred ())
89
85
Expect (resultAdd ).To (BeEquivalentTo ("OK" ))
90
- resultAdd , err = client .TFCall (ctx , "libtfc1 " , "foo" , 0 ).Result ()
86
+ resultAdd , err = client .TFCall (ctx , "lib1 " , "foo" , 0 ).Result ()
91
87
Expect (err ).NotTo (HaveOccurred ())
92
88
Expect (resultAdd ).To (BeEquivalentTo ("bar" ))
93
- resultAdd , err = client .TFunctionDelete (ctx , "libtfc1" ).Result ()
94
- Expect (err ).NotTo (HaveOccurred ())
95
- Expect (resultAdd ).To (BeEquivalentTo ("OK" ))
96
89
})
97
90
98
91
It ("should TFCallArgs" , Label ("gears" , "tfcallargs" ), func () {
99
92
var resultAdd interface {}
100
- resultAdd , err := client .TFunctionLoad (ctx , libCode ("libtfca1 " )).Result ()
93
+ resultAdd , err := client .TFunctionLoad (ctx , libCode ("lib1 " )).Result ()
101
94
Expect (err ).NotTo (HaveOccurred ())
102
95
Expect (resultAdd ).To (BeEquivalentTo ("OK" ))
103
96
opt := & redis.TFCallOptions {Arguments : []string {"foo" , "bar" }}
104
- resultAdd , err = client .TFCallArgs (ctx , "libtfca1 " , "foo" , 0 , opt ).Result ()
97
+ resultAdd , err = client .TFCallArgs (ctx , "lib1 " , "foo" , 0 , opt ).Result ()
105
98
Expect (err ).NotTo (HaveOccurred ())
106
99
Expect (resultAdd ).To (BeEquivalentTo ("bar" ))
107
- resultAdd , err = client .TFunctionDelete (ctx , "libtfca1" ).Result ()
108
- Expect (err ).NotTo (HaveOccurred ())
109
- Expect (resultAdd ).To (BeEquivalentTo ("OK" ))
110
100
})
111
101
112
102
It ("should TFCallASYNC" , Label ("gears" , "TFCallASYNC" ), func () {
113
103
var resultAdd interface {}
114
- resultAdd , err := client .TFunctionLoad (ctx , libCode ("libtfc1 " )).Result ()
104
+ resultAdd , err := client .TFunctionLoad (ctx , libCode ("lib1 " )).Result ()
115
105
Expect (err ).NotTo (HaveOccurred ())
116
106
Expect (resultAdd ).To (BeEquivalentTo ("OK" ))
117
- resultAdd , err = client .TFCallASYNC (ctx , "libtfc1 " , "foo" , 0 ).Result ()
107
+ resultAdd , err = client .TFCallASYNC (ctx , "lib1 " , "foo" , 0 ).Result ()
118
108
Expect (err ).NotTo (HaveOccurred ())
119
109
Expect (resultAdd ).To (BeEquivalentTo ("bar" ))
120
- resultAdd , err = client .TFunctionDelete (ctx , "libtfc1" ).Result ()
121
- Expect (err ).NotTo (HaveOccurred ())
122
- Expect (resultAdd ).To (BeEquivalentTo ("OK" ))
123
110
})
124
111
125
112
It ("should TFCallASYNCArgs" , Label ("gears" , "TFCallASYNCargs" ), func () {
126
113
var resultAdd interface {}
127
- resultAdd , err := client .TFunctionLoad (ctx , libCode ("libtfca1 " )).Result ()
114
+ resultAdd , err := client .TFunctionLoad (ctx , libCode ("lib1 " )).Result ()
128
115
Expect (err ).NotTo (HaveOccurred ())
129
116
Expect (resultAdd ).To (BeEquivalentTo ("OK" ))
130
117
opt := & redis.TFCallOptions {Arguments : []string {"foo" , "bar" }}
131
- resultAdd , err = client .TFCallASYNCArgs (ctx , "libtfca1 " , "foo" , 0 , opt ).Result ()
118
+ resultAdd , err = client .TFCallASYNCArgs (ctx , "lib1 " , "foo" , 0 , opt ).Result ()
132
119
Expect (err ).NotTo (HaveOccurred ())
133
120
Expect (resultAdd ).To (BeEquivalentTo ("bar" ))
134
- resultAdd , err = client .TFunctionDelete (ctx , "libtfca1" ).Result ()
135
- Expect (err ).NotTo (HaveOccurred ())
136
- Expect (resultAdd ).To (BeEquivalentTo ("OK" ))
137
121
})
138
122
139
123
})
0 commit comments