@@ -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,17 @@ 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 ()
65
- Expect (err ).NotTo (HaveOccurred ())
66
- Expect (resultAdd ).To (BeEquivalentTo ("OK" ))
67
- resultAdd , err = client .TFunctionLoad (ctx , libCode ("libtfli2" )).Result ()
62
+ resultAdd , err := client .TFunctionLoad (ctx , libCode ("lib1" )).Result ()
68
63
Expect (err ).NotTo (HaveOccurred ())
69
64
Expect (resultAdd ).To (BeEquivalentTo ("OK" ))
70
65
resultList , err := client .TFunctionList (ctx ).Result ()
@@ -73,67 +68,49 @@ var _ = Describe("RedisGears commands", Label("gears"), func() {
73
68
opt := & redis.TFunctionListOptions {Withcode : true , Verbose : 2 }
74
69
resultListArgs , err := client .TFunctionListArgs (ctx , opt ).Result ()
75
70
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 ()
81
- Expect (err ).NotTo (HaveOccurred ())
82
- Expect (resultAdd ).To (BeEquivalentTo ("OK" ))
71
+ Expect (resultListArgs [0 ]["code" ]).NotTo (BeEquivalentTo ("" ))
83
72
})
84
73
85
74
It ("should TFCall" , Label ("gears" , "tfcall" ), func () {
86
75
var resultAdd interface {}
87
- resultAdd , err := client .TFunctionLoad (ctx , libCode ("libtfc1 " )).Result ()
76
+ resultAdd , err := client .TFunctionLoad (ctx , libCode ("lib1 " )).Result ()
88
77
Expect (err ).NotTo (HaveOccurred ())
89
78
Expect (resultAdd ).To (BeEquivalentTo ("OK" ))
90
- resultAdd , err = client .TFCall (ctx , "libtfc1 " , "foo" , 0 ).Result ()
79
+ resultAdd , err = client .TFCall (ctx , "lib1 " , "foo" , 0 ).Result ()
91
80
Expect (err ).NotTo (HaveOccurred ())
92
81
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
82
})
97
83
98
84
It ("should TFCallArgs" , Label ("gears" , "tfcallargs" ), func () {
99
85
var resultAdd interface {}
100
- resultAdd , err := client .TFunctionLoad (ctx , libCode ("libtfca1 " )).Result ()
86
+ resultAdd , err := client .TFunctionLoad (ctx , libCode ("lib1 " )).Result ()
101
87
Expect (err ).NotTo (HaveOccurred ())
102
88
Expect (resultAdd ).To (BeEquivalentTo ("OK" ))
103
89
opt := & redis.TFCallOptions {Arguments : []string {"foo" , "bar" }}
104
- resultAdd , err = client .TFCallArgs (ctx , "libtfca1 " , "foo" , 0 , opt ).Result ()
90
+ resultAdd , err = client .TFCallArgs (ctx , "lib1 " , "foo" , 0 , opt ).Result ()
105
91
Expect (err ).NotTo (HaveOccurred ())
106
92
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
93
})
111
94
112
95
It ("should TFCallASYNC" , Label ("gears" , "TFCallASYNC" ), func () {
113
96
var resultAdd interface {}
114
- resultAdd , err := client .TFunctionLoad (ctx , libCode ("libtfc1 " )).Result ()
97
+ resultAdd , err := client .TFunctionLoad (ctx , libCode ("lib1 " )).Result ()
115
98
Expect (err ).NotTo (HaveOccurred ())
116
99
Expect (resultAdd ).To (BeEquivalentTo ("OK" ))
117
- resultAdd , err = client .TFCallASYNC (ctx , "libtfc1 " , "foo" , 0 ).Result ()
100
+ resultAdd , err = client .TFCallASYNC (ctx , "lib1 " , "foo" , 0 ).Result ()
118
101
Expect (err ).NotTo (HaveOccurred ())
119
102
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
103
})
124
104
125
105
It ("should TFCallASYNCArgs" , Label ("gears" , "TFCallASYNCargs" ), func () {
126
106
var resultAdd interface {}
127
- resultAdd , err := client .TFunctionLoad (ctx , libCode ("libtfca1 " )).Result ()
107
+ resultAdd , err := client .TFunctionLoad (ctx , libCode ("lib1 " )).Result ()
128
108
Expect (err ).NotTo (HaveOccurred ())
129
109
Expect (resultAdd ).To (BeEquivalentTo ("OK" ))
130
110
opt := & redis.TFCallOptions {Arguments : []string {"foo" , "bar" }}
131
- resultAdd , err = client .TFCallASYNCArgs (ctx , "libtfca1 " , "foo" , 0 , opt ).Result ()
111
+ resultAdd , err = client .TFCallASYNCArgs (ctx , "lib1 " , "foo" , 0 , opt ).Result ()
132
112
Expect (err ).NotTo (HaveOccurred ())
133
113
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
114
})
138
115
139
116
})
0 commit comments