BFergerson commented on a change in pull request #3139:
URL: https://github.com/apache/apisix/pull/3139#discussion_r549770858



##########
File path: t/plugin/proxy-rewrite.t
##########
@@ -1249,3 +1249,41 @@ version: nginx_var_does_not_exist
 x-real-ip: 127.0.0.1
 --- no_error_log
 [error]
+
+
+
+=== TEST 42: set route(rewrite uri based on ctx.var)

Review comment:
       Thanks for the help. I'm still not sure how your tests cover anything 
more than what my test covers though.
   
   Based on your tests it appears tests are executed sequentially and share a 
context between them. The first test creates a route with the `proxy-rewrite` 
plugin rewriting the uri to `$arg_new_uri`. This appears to be the same thing 
my test covers with just a different variable to subsitute.
   
   Your second test then appears to continue work from the first test and now 
hits `/test?new_uri=hello` and expects `hello world` as a response. That 
doesn't make sense to me. Where does `hello world` come from and how does 
hitting `/test?new_uri=hello` verify that `proxy-rewrite` has worked correctly? 
There should be some way to set the value of `$arg_new_uri` and verify the 
resulting value of uri after `proxy-rewrite` is equiavlent. Also, if 
`$arg_new_uri` is really the value of `new_uri` that is a bit confusing. I 
wouldn't have guessed adding `arg_` makes a variable come from url get params.
   
   Apologies if I'm making this more difficult than it needs to be. I've tried 
reading the 
[documention](https://github.com/apache/apisix/blob/master/doc/plugin-develop.md#write-test-case)
 but it doesn't really explain to me how testing works.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to