@@ -40,6 +40,7 @@ var _ = Describe("RedisGears commands", Label("gears"), func() {
4040 BeforeEach (func () {
4141 client = redis .NewClient (& redis.Options {Addr : ":6379" })
4242 Expect (client .FlushDB (ctx ).Err ()).NotTo (HaveOccurred ())
43+ client .TFunctionDelete (ctx , "lib1" )
4344 })
4445
4546 AfterEach (func () {
@@ -48,23 +49,21 @@ var _ = Describe("RedisGears commands", Label("gears"), func() {
4849
4950 It ("should TFunctionLoad, TFunctionLoadArgs and TFunctionDelete " , Label ("gears" , "tfunctionload" ), func () {
5051
51- resultAdd , err := client .TFunctionLoad (ctx , libCode ("libtflo1 " )).Result ()
52+ resultAdd , err := client .TFunctionLoad (ctx , libCode ("lib1 " )).Result ()
5253 Expect (err ).NotTo (HaveOccurred ())
5354 Expect (resultAdd ).To (BeEquivalentTo ("OK" ))
5455 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 ()
5957 Expect (err ).NotTo (HaveOccurred ())
6058 Expect (resultAdd ).To (BeEquivalentTo ("OK" ))
6159
6260 })
6361 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 ()
6564 Expect (err ).NotTo (HaveOccurred ())
6665 Expect (resultAdd ).To (BeEquivalentTo ("OK" ))
67- resultAdd , err = client .TFunctionLoad (ctx , libCode ("libtfli2 " )).Result ()
66+ resultAdd , err = client .TFunctionLoad (ctx , libCode ("lib2 " )).Result ()
6867 Expect (err ).NotTo (HaveOccurred ())
6968 Expect (resultAdd ).To (BeEquivalentTo ("OK" ))
7069 resultList , err := client .TFunctionList (ctx ).Result ()
@@ -73,67 +72,52 @@ var _ = Describe("RedisGears commands", Label("gears"), func() {
7372 opt := & redis.TFunctionListOptions {Withcode : true , Verbose : 2 }
7473 resultListArgs , err := client .TFunctionListArgs (ctx , opt ).Result ()
7574 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 ()
8177 Expect (err ).NotTo (HaveOccurred ())
8278 Expect (resultAdd ).To (BeEquivalentTo ("OK" ))
8379 })
8480
8581 It ("should TFCall" , Label ("gears" , "tfcall" ), func () {
8682 var resultAdd interface {}
87- resultAdd , err := client .TFunctionLoad (ctx , libCode ("libtfc1 " )).Result ()
83+ resultAdd , err := client .TFunctionLoad (ctx , libCode ("lib1 " )).Result ()
8884 Expect (err ).NotTo (HaveOccurred ())
8985 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 ()
9187 Expect (err ).NotTo (HaveOccurred ())
9288 Expect (resultAdd ).To (BeEquivalentTo ("bar" ))
93- resultAdd , err = client .TFunctionDelete (ctx , "libtfc1" ).Result ()
94- Expect (err ).NotTo (HaveOccurred ())
95- Expect (resultAdd ).To (BeEquivalentTo ("OK" ))
9689 })
9790
9891 It ("should TFCallArgs" , Label ("gears" , "tfcallargs" ), func () {
9992 var resultAdd interface {}
100- resultAdd , err := client .TFunctionLoad (ctx , libCode ("libtfca1 " )).Result ()
93+ resultAdd , err := client .TFunctionLoad (ctx , libCode ("lib1 " )).Result ()
10194 Expect (err ).NotTo (HaveOccurred ())
10295 Expect (resultAdd ).To (BeEquivalentTo ("OK" ))
10396 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 ()
10598 Expect (err ).NotTo (HaveOccurred ())
10699 Expect (resultAdd ).To (BeEquivalentTo ("bar" ))
107- resultAdd , err = client .TFunctionDelete (ctx , "libtfca1" ).Result ()
108- Expect (err ).NotTo (HaveOccurred ())
109- Expect (resultAdd ).To (BeEquivalentTo ("OK" ))
110100 })
111101
112102 It ("should TFCallASYNC" , Label ("gears" , "TFCallASYNC" ), func () {
113103 var resultAdd interface {}
114- resultAdd , err := client .TFunctionLoad (ctx , libCode ("libtfc1 " )).Result ()
104+ resultAdd , err := client .TFunctionLoad (ctx , libCode ("lib1 " )).Result ()
115105 Expect (err ).NotTo (HaveOccurred ())
116106 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 ()
118108 Expect (err ).NotTo (HaveOccurred ())
119109 Expect (resultAdd ).To (BeEquivalentTo ("bar" ))
120- resultAdd , err = client .TFunctionDelete (ctx , "libtfc1" ).Result ()
121- Expect (err ).NotTo (HaveOccurred ())
122- Expect (resultAdd ).To (BeEquivalentTo ("OK" ))
123110 })
124111
125112 It ("should TFCallASYNCArgs" , Label ("gears" , "TFCallASYNCargs" ), func () {
126113 var resultAdd interface {}
127- resultAdd , err := client .TFunctionLoad (ctx , libCode ("libtfca1 " )).Result ()
114+ resultAdd , err := client .TFunctionLoad (ctx , libCode ("lib1 " )).Result ()
128115 Expect (err ).NotTo (HaveOccurred ())
129116 Expect (resultAdd ).To (BeEquivalentTo ("OK" ))
130117 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 ()
132119 Expect (err ).NotTo (HaveOccurred ())
133120 Expect (resultAdd ).To (BeEquivalentTo ("bar" ))
134- resultAdd , err = client .TFunctionDelete (ctx , "libtfca1" ).Result ()
135- Expect (err ).NotTo (HaveOccurred ())
136- Expect (resultAdd ).To (BeEquivalentTo ("OK" ))
137121 })
138122
139123})
0 commit comments