Tarantool development patches archive
 help / color / mirror / Atom feed
* [tarantool-patches] [PATCH 1/1] test: fix flaky swim/errinj.test.lua
@ 2019-07-30 19:34 Vladislav Shpilevoy
  2019-07-30 22:44 ` [tarantool-patches] " Alexander Turenko
  2019-08-09 10:18 ` Kirill Yukhin
  0 siblings, 2 replies; 6+ messages in thread
From: Vladislav Shpilevoy @ 2019-07-30 19:34 UTC (permalink / raw)
  To: tarantool-patches; +Cc: alexander.turenko

In one place that test sends a packet and expects that it has
arrived two lines below. Under high load it may take more time.
The patch makes the test explicitly wait for the packet arrival.

Closes #4392
---
Issue: https://github.com/tarantool/tarantool/issues/4392
Branch: https://github.com/tarantool/tarantool/tree/gerold103/gh-4392-swim-flaky-test

 test/swim/errinj.result   | 3 +++
 test/swim/errinj.test.lua | 1 +
 2 files changed, 4 insertions(+)

diff --git a/test/swim/errinj.result b/test/swim/errinj.result
index efeab87a8..cf26b0a4a 100644
--- a/test/swim/errinj.result
+++ b/test/swim/errinj.result
@@ -60,6 +60,9 @@ errinj.set("ERRINJ_SWIM_FD_ONLY", false)
 ---
 - ok
 ...
+while s1_view:incarnation().version ~= 2 do fiber.sleep(0.01) end
+---
+...
 s1_view:payload()
 ---
 - null
diff --git a/test/swim/errinj.test.lua b/test/swim/errinj.test.lua
index cf0cb2dd4..6c73f9f3d 100644
--- a/test/swim/errinj.test.lua
+++ b/test/swim/errinj.test.lua
@@ -26,6 +26,7 @@ s1:self():incarnation()
 errinj.set("ERRINJ_SWIM_FD_ONLY", true)
 s1:probe_member(s2:self():uri())
 errinj.set("ERRINJ_SWIM_FD_ONLY", false)
+while s1_view:incarnation().version ~= 2 do fiber.sleep(0.01) end
 s1_view:payload()
 s1_view:incarnation()
 
-- 
2.20.1 (Apple Git-117)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [tarantool-patches] Re: [PATCH 1/1] test: fix flaky swim/errinj.test.lua
  2019-07-30 19:34 [tarantool-patches] [PATCH 1/1] test: fix flaky swim/errinj.test.lua Vladislav Shpilevoy
@ 2019-07-30 22:44 ` Alexander Turenko
  2019-07-30 22:58   ` Vladislav Shpilevoy
  2019-08-09 10:18 ` Kirill Yukhin
  1 sibling, 1 reply; 6+ messages in thread
From: Alexander Turenko @ 2019-07-30 22:44 UTC (permalink / raw)
  To: Vladislav Shpilevoy; +Cc: tarantool-patches, Kirill Yukhin

LGTM. Kirill, please, proceed.

On Tue, Jul 30, 2019 at 09:34:35PM +0200, Vladislav Shpilevoy wrote:
> In one place that test sends a packet and expects that it has
> arrived two lines below. Under high load it may take more time.
> The patch makes the test explicitly wait for the packet arrival.
> 
> Closes #4392
> ---
> Issue: https://github.com/tarantool/tarantool/issues/4392
> Branch: https://github.com/tarantool/tarantool/tree/gerold103/gh-4392-swim-flaky-test
> 
>  test/swim/errinj.result   | 3 +++
>  test/swim/errinj.test.lua | 1 +
>  2 files changed, 4 insertions(+)
> 
> diff --git a/test/swim/errinj.result b/test/swim/errinj.result
> index efeab87a8..cf26b0a4a 100644
> --- a/test/swim/errinj.result
> +++ b/test/swim/errinj.result
> @@ -60,6 +60,9 @@ errinj.set("ERRINJ_SWIM_FD_ONLY", false)
>  ---
>  - ok
>  ...
> +while s1_view:incarnation().version ~= 2 do fiber.sleep(0.01) end
> +---
> +...
>  s1_view:payload()
>  ---
>  - null
> diff --git a/test/swim/errinj.test.lua b/test/swim/errinj.test.lua
> index cf0cb2dd4..6c73f9f3d 100644
> --- a/test/swim/errinj.test.lua
> +++ b/test/swim/errinj.test.lua
> @@ -26,6 +26,7 @@ s1:self():incarnation()
>  errinj.set("ERRINJ_SWIM_FD_ONLY", true)
>  s1:probe_member(s2:self():uri())
>  errinj.set("ERRINJ_SWIM_FD_ONLY", false)
> +while s1_view:incarnation().version ~= 2 do fiber.sleep(0.01) end

Nit: Maybe it will be a bit better to stop after a certain time period
if a condition is not meet after, say, a minute: this will allow
test-run to continue with the test and possibly show more compact
miscompare fail and also will allow continue with other tests that was
already scheduled to the same worker. We use test_run:wait_cond() for
this. Anyway, this is a thing of preference and I don't push anyone to
one or another way: this message it just to let you know about both ways
and the difference between them. (From the other hand explicit is better
then implicit.)

>  s1_view:payload()
>  s1_view:incarnation()
>  
> -- 
> 2.20.1 (Apple Git-117)
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [tarantool-patches] Re: [PATCH 1/1] test: fix flaky swim/errinj.test.lua
  2019-07-30 22:44 ` [tarantool-patches] " Alexander Turenko
@ 2019-07-30 22:58   ` Vladislav Shpilevoy
  2019-07-31  8:23     ` Alexander Turenko
  0 siblings, 1 reply; 6+ messages in thread
From: Vladislav Shpilevoy @ 2019-07-30 22:58 UTC (permalink / raw)
  To: Alexander Turenko; +Cc: tarantool-patches, Kirill Yukhin



On 31/07/2019 00:44, Alexander Turenko wrote:
> LGTM. Kirill, please, proceed.
> 
> On Tue, Jul 30, 2019 at 09:34:35PM +0200, Vladislav Shpilevoy wrote:
>> In one place that test sends a packet and expects that it has
>> arrived two lines below. Under high load it may take more time.
>> The patch makes the test explicitly wait for the packet arrival.
>>
>> Closes #4392
>> ---
>> Issue: https://github.com/tarantool/tarantool/issues/4392
>> Branch: https://github.com/tarantool/tarantool/tree/gerold103/gh-4392-swim-flaky-test
>>
>>  test/swim/errinj.result   | 3 +++
>>  test/swim/errinj.test.lua | 1 +
>>  2 files changed, 4 insertions(+)
>>
>> diff --git a/test/swim/errinj.result b/test/swim/errinj.result
>> index efeab87a8..cf26b0a4a 100644
>> --- a/test/swim/errinj.result
>> +++ b/test/swim/errinj.result
>> @@ -60,6 +60,9 @@ errinj.set("ERRINJ_SWIM_FD_ONLY", false)
>>  ---
>>  - ok
>>  ...
>> +while s1_view:incarnation().version ~= 2 do fiber.sleep(0.01) end
>> +---
>> +...
>>  s1_view:payload()
>>  ---
>>  - null
>> diff --git a/test/swim/errinj.test.lua b/test/swim/errinj.test.lua
>> index cf0cb2dd4..6c73f9f3d 100644
>> --- a/test/swim/errinj.test.lua
>> +++ b/test/swim/errinj.test.lua
>> @@ -26,6 +26,7 @@ s1:self():incarnation()
>>  errinj.set("ERRINJ_SWIM_FD_ONLY", true)
>>  s1:probe_member(s2:self():uri())
>>  errinj.set("ERRINJ_SWIM_FD_ONLY", false)
>> +while s1_view:incarnation().version ~= 2 do fiber.sleep(0.01) end
> 
> Nit: Maybe it will be a bit better to stop after a certain time period
> if a condition is not meet after, say, a minute: this will allow
> test-run to continue with the test and possibly show more compact
> miscompare fail and also will allow continue with other tests that was
> already scheduled to the same worker. We use test_run:wait_cond() for
> this. Anyway, this is a thing of preference and I don't push anyone to
> one or another way: this message it just to let you know about both ways
> and the difference between them. (From the other hand explicit is better
> then implicit.)

Such places are widespread in our tests. Perhaps it is worth introducing
a test-run helper for that. For example:

    test_run:wait(function() ... end, timeout)

The function should return true, when the condition is met. This case
would look like this:

    test_run:wait(function()                                \
        return s1_view:incarnation().version == 2           \
    end, 60)

>>  s1_view:payload()
>>  s1_view:incarnation()
>>  
>> -- 
>> 2.20.1 (Apple Git-117)
>>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [tarantool-patches] Re: [PATCH 1/1] test: fix flaky swim/errinj.test.lua
  2019-07-30 22:58   ` Vladislav Shpilevoy
@ 2019-07-31  8:23     ` Alexander Turenko
  0 siblings, 0 replies; 6+ messages in thread
From: Alexander Turenko @ 2019-07-31  8:23 UTC (permalink / raw)
  To: Vladislav Shpilevoy; +Cc: tarantool-patches, Kirill Yukhin

> >> diff --git a/test/swim/errinj.test.lua b/test/swim/errinj.test.lua
> >> index cf0cb2dd4..6c73f9f3d 100644
> >> --- a/test/swim/errinj.test.lua
> >> +++ b/test/swim/errinj.test.lua
> >> @@ -26,6 +26,7 @@ s1:self():incarnation()
> >>  errinj.set("ERRINJ_SWIM_FD_ONLY", true)
> >>  s1:probe_member(s2:self():uri())
> >>  errinj.set("ERRINJ_SWIM_FD_ONLY", false)
> >> +while s1_view:incarnation().version ~= 2 do fiber.sleep(0.01) end
> > 
> > Nit: Maybe it will be a bit better to stop after a certain time period
> > if a condition is not meet after, say, a minute: this will allow
> > test-run to continue with the test and possibly show more compact
> > miscompare fail and also will allow continue with other tests that was
> > already scheduled to the same worker. We use test_run:wait_cond() for
> > this. Anyway, this is a thing of preference and I don't push anyone to
> > one or another way: this message it just to let you know about both ways
> > and the difference between them. (From the other hand explicit is better
> > then implicit.)
> 
> Such places are widespread in our tests. Perhaps it is worth introducing
> a test-run helper for that. For example:
> 
>     test_run:wait(function() ... end, timeout)
> 
> The function should return true, when the condition is met. This case
> would look like this:
> 
>     test_run:wait(function()                                \
>         return s1_view:incarnation().version == 2           \
>     end, 60)

I have mentioned it above: test_run:wait_cond(func, timeout, delay).
https://github.com/tarantool/test-run/blob/947c65cda7f26ceb5f601bbf154e70f9c3f755e9/test_run.lua#L387

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [tarantool-patches] Re: [PATCH 1/1] test: fix flaky swim/errinj.test.lua
  2019-07-30 19:34 [tarantool-patches] [PATCH 1/1] test: fix flaky swim/errinj.test.lua Vladislav Shpilevoy
  2019-07-30 22:44 ` [tarantool-patches] " Alexander Turenko
@ 2019-08-09 10:18 ` Kirill Yukhin
  2019-08-11 22:42   ` Alexander Turenko
  1 sibling, 1 reply; 6+ messages in thread
From: Kirill Yukhin @ 2019-08-09 10:18 UTC (permalink / raw)
  To: tarantool-patches; +Cc: alexander.turenko

Hello,

On 30 Jul 21:34, Vladislav Shpilevoy wrote:
> In one place that test sends a packet and expects that it has
> arrived two lines below. Under high load it may take more time.
> The patch makes the test explicitly wait for the packet arrival.
> 
> Closes #4392
> ---
> Issue: https://github.com/tarantool/tarantool/issues/4392
> Branch: https://github.com/tarantool/tarantool/tree/gerold103/gh-4392-swim-flaky-test

I've checked the patch into 2.2 and master.

--
Regards, Kirill Yukhin

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [tarantool-patches] Re: [PATCH 1/1] test: fix flaky swim/errinj.test.lua
  2019-08-09 10:18 ` Kirill Yukhin
@ 2019-08-11 22:42   ` Alexander Turenko
  0 siblings, 0 replies; 6+ messages in thread
From: Alexander Turenko @ 2019-08-11 22:42 UTC (permalink / raw)
  To: Kirill Yukhin; +Cc: tarantool-patches, Vladislav Shpilevoy

On Fri, Aug 09, 2019 at 01:18:34PM +0300, Kirill Yukhin wrote:
> Hello,
> 
> On 30 Jul 21:34, Vladislav Shpilevoy wrote:
> > In one place that test sends a packet and expects that it has
> > arrived two lines below. Under high load it may take more time.
> > The patch makes the test explicitly wait for the packet arrival.
> > 
> > Closes #4392
> > ---
> > Issue: https://github.com/tarantool/tarantool/issues/4392
> > Branch: https://github.com/tarantool/tarantool/tree/gerold103/gh-4392-swim-flaky-test
> 
> I've checked the patch into 2.2 and master.

I don't see this commit in 2.2.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-08-11 22:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-30 19:34 [tarantool-patches] [PATCH 1/1] test: fix flaky swim/errinj.test.lua Vladislav Shpilevoy
2019-07-30 22:44 ` [tarantool-patches] " Alexander Turenko
2019-07-30 22:58   ` Vladislav Shpilevoy
2019-07-31  8:23     ` Alexander Turenko
2019-08-09 10:18 ` Kirill Yukhin
2019-08-11 22:42   ` Alexander Turenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox