Fw: Use Test::Nginx with etcproxy and/or valgrind (Was Re: Test::Nginx::LWP vs. Test::Nginx::Socket)

Antoine Bonavita (personal) antoine.bonavita at gmail.com
Wed Mar 16 12:38:05 MSK 2011


Thanks a lot for your time and openness.
I started thinking a little about all this and here are 3 suggestions
which I'm willing to work on if you think they are worth it:

1 - Regarding the ability to chain multiple requests in requests, the
only way I can think of is to make request and
error_code/response_body/response_body_like/etc. potential arrays and
adapt the code to handle arrays/strings. There is probably a lot of
impact on the code but I cannot think of any other way.
2 - Regarding the restart of nginx, I had two ideas:
2.1 - Add a section (--- NO_RESTART). This is probably a very simple
solution but it relies on the order tests are run, so I think it can
be quite error-prone (especially if you shuffle tests and have
different configs).
2.2 - Restart only when the config changes between two tests. This
behavior can even be controlled by something like
TEST_NGINX_FORCE_RESTART_ON_TEST which would happen to default to true
(to preserve current behavior).
3 - Regarding the documentation, I was thinking of improving the doc
of Socket.pm by putting a small example next to each item (at least
the ones I know, I could not figure out the syntax of skip_nginx and
skip_nginx2). And maybe completely removing request_eval.

Let me know what you think.

Antoine,

--
Antoine Bonavita.
Follow my progress with nginx at: <a
href="http://www.nginx-discovery.com">http://www.nginx-discovery.com</a>

On Wed, Mar 16, 2011 at 8:06 AM, agentzh <agentzh at gmail.com> wrote:
> On Tue, Mar 15, 2011 at 11:13 PM, Antoine Bonavita (personal)
> <antoine.bonavita at gmail.com> wrote:
>>
>> I actually wrote a few posts on the migration to Test::Nginx:
>> * http://www.nginx-discovery.com/2011/03/day-32-moving-to-testnginx.html
>> * http://www.nginx-discovery.com/2011/03/day-33-testnginx-pipelinedrequests.html
>>
>
> I've just read through your posts. And I do understand all those
> frustrations involved ;)
>
> You're very welcome to provide patches for bug fixes, new features,
> and documentation and I'm very willing to give you a commit bit to the
> test-nginx repository :)
>
>> * Being able to run multiple requests in one test. The
>> pipelined_requests use the same connection which might not be what I
>> want. I was thinking of something more natural like : send request 1,
>> wait for response 1, check response 1, send request 2, wait for
>> response 2, check response 2, etc.
>>
>
> After reading your posts, I now understand your actual requirement
> here a bit more. In our tests, we usually make use of nginx
> subrequests to achieve similar results, though not exactly the same
> ones:
>
>    === TEST 1:
>    --- config
>         location /foo { ... }
>         location /main {
>              echo_subrequest POST /foo -b 'correct value';
>              echo_subrequest POST /foo -b 'bad value';
>              echo_subrequest POST /foo -b 'correct value';
>         }
>    --- request
>         GET /main
>    --- response_body
>    OK
>    ERROR
>    OK
>
> I agree this is not ideal though ;) We've been using this paradigm extensively.
>
> Cheers,
> -agentzh
>



More information about the nginx-devel mailing list