[PATCH] Tests: stream_udp_proxy_requests adjusted

Thorvaldur Thorvaldsson thorvaldur.thorvaldsson at gmail.com
Tue Jul 16 22:04:10 UTC 2024


Unsubscribe.

On Mon, Jul 15, 2024 at 12:02 PM Oksana Deeva <o.deeva at wbsrv.ru> wrote:
>
> # HG changeset patch
> # User Oksana Deeva <o.deeva at wbsrv.ru>
> # Date 1721044584 -10800
> #      Mon Jul 15 14:56:24 2024 +0300
> # Node ID 50fc19b32628b1c5a2a49c127b013e15e4083dd6
> # Parent  0e9c1a8aa1d49e57b211e2c8ece94e00bf032ed7
> Tests: stream_udp_proxy_requests adjusted.
>
> The test occasionally failed due to the fact that the order of packets
> could change. Now the order of packets will be ignored.
>
> diff -r 0e9c1a8aa1d4 -r 50fc19b32628 stream_udp_proxy_requests.t
> --- a/stream_udp_proxy_requests.t       Fri Jul 12 01:19:15 2024 +0400
> +++ b/stream_udp_proxy_requests.t       Mon Jul 15 14:56:24 2024 +0300
> @@ -160,14 +160,23 @@
>
>  $s = dgram('127.0.0.1:' . port(8985));
>  $s->write('1') for 1 .. 5;
> -$b = join ' ', map { $s->read() } (1 .. 10);
> +
> +my @parts = map { $s->read() } (1 .. 10);
> +
> +my $res = {};
> +for (my $i = 0; $i < scalar @parts; $i++) {
> +       my $part = $parts[$i];
>
> -SKIP: {
> -skip 'session could early terminate', 1 unless $ENV{TEST_NGINX_UNSAFE};
> +       if ($i % 2 == 0) {
> +               $res->{$part} //= 0;
> +       } else {
> +               $res->{$parts[$i-1]} += $part;
> +       }
> +}
>
> -like($b, qr/^(\d+ 1) \1 (?!\1)(\d+ 1) \2 (?!\2)\d+ 1$/, 'requests - responses');
> +$b = join ' ', sort values %$res;
>
> -}
> +is($b, '1 2 2', 'requests - responses');
>
>  $t->stop();
>
> _______________________________________________
> nginx-devel mailing list
> nginx-devel at nginx.org
> https://mailman.nginx.org/mailman/listinfo/nginx-devel


More information about the nginx-devel mailing list