@@ -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,17 @@ 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 ()
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 ()
6863 Expect (err ).NotTo (HaveOccurred ())
6964 Expect (resultAdd ).To (BeEquivalentTo ("OK" ))
7065 resultList , err := client .TFunctionList (ctx ).Result ()
@@ -73,67 +68,49 @@ var _ = Describe("RedisGears commands", Label("gears"), func() {
7368 opt := & redis.TFunctionListOptions {Withcode : true , Verbose : 2 }
7469 resultListArgs , err := client .TFunctionListArgs (ctx , opt ).Result ()
7570 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 ("" ))
8372 })
8473
8574 It ("should TFCall" , Label ("gears" , "tfcall" ), func () {
8675 var resultAdd interface {}
87- resultAdd , err := client .TFunctionLoad (ctx , libCode ("libtfc1 " )).Result ()
76+ resultAdd , err := client .TFunctionLoad (ctx , libCode ("lib1 " )).Result ()
8877 Expect (err ).NotTo (HaveOccurred ())
8978 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 ()
9180 Expect (err ).NotTo (HaveOccurred ())
9281 Expect (resultAdd ).To (BeEquivalentTo ("bar" ))
93- resultAdd , err = client .TFunctionDelete (ctx , "libtfc1" ).Result ()
94- Expect (err ).NotTo (HaveOccurred ())
95- Expect (resultAdd ).To (BeEquivalentTo ("OK" ))
9682 })
9783
9884 It ("should TFCallArgs" , Label ("gears" , "tfcallargs" ), func () {
9985 var resultAdd interface {}
100- resultAdd , err := client .TFunctionLoad (ctx , libCode ("libtfca1 " )).Result ()
86+ resultAdd , err := client .TFunctionLoad (ctx , libCode ("lib1 " )).Result ()
10187 Expect (err ).NotTo (HaveOccurred ())
10288 Expect (resultAdd ).To (BeEquivalentTo ("OK" ))
10389 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 ()
10591 Expect (err ).NotTo (HaveOccurred ())
10692 Expect (resultAdd ).To (BeEquivalentTo ("bar" ))
107- resultAdd , err = client .TFunctionDelete (ctx , "libtfca1" ).Result ()
108- Expect (err ).NotTo (HaveOccurred ())
109- Expect (resultAdd ).To (BeEquivalentTo ("OK" ))
11093 })
11194
11295 It ("should TFCallASYNC" , Label ("gears" , "TFCallASYNC" ), func () {
11396 var resultAdd interface {}
114- resultAdd , err := client .TFunctionLoad (ctx , libCode ("libtfc1 " )).Result ()
97+ resultAdd , err := client .TFunctionLoad (ctx , libCode ("lib1 " )).Result ()
11598 Expect (err ).NotTo (HaveOccurred ())
11699 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 ()
118101 Expect (err ).NotTo (HaveOccurred ())
119102 Expect (resultAdd ).To (BeEquivalentTo ("bar" ))
120- resultAdd , err = client .TFunctionDelete (ctx , "libtfc1" ).Result ()
121- Expect (err ).NotTo (HaveOccurred ())
122- Expect (resultAdd ).To (BeEquivalentTo ("OK" ))
123103 })
124104
125105 It ("should TFCallASYNCArgs" , Label ("gears" , "TFCallASYNCargs" ), func () {
126106 var resultAdd interface {}
127- resultAdd , err := client .TFunctionLoad (ctx , libCode ("libtfca1 " )).Result ()
107+ resultAdd , err := client .TFunctionLoad (ctx , libCode ("lib1 " )).Result ()
128108 Expect (err ).NotTo (HaveOccurred ())
129109 Expect (resultAdd ).To (BeEquivalentTo ("OK" ))
130110 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 ()
132112 Expect (err ).NotTo (HaveOccurred ())
133113 Expect (resultAdd ).To (BeEquivalentTo ("bar" ))
134- resultAdd , err = client .TFunctionDelete (ctx , "libtfca1" ).Result ()
135- Expect (err ).NotTo (HaveOccurred ())
136- Expect (resultAdd ).To (BeEquivalentTo ("OK" ))
137114 })
138115
139116})
0 commit comments