proper-testing / proper

PropEr: a QuickCheck-inspired property-based testing tool for Erlang
http://proper-testing.github.io
GNU General Public License v3.0
882 stars 167 forks source link

{var,2} instead of the correct variable during shrink #286

Open lhoguin opened 2 years ago

lhoguin commented 2 years ago

I got the following output exactly once in many many tests this week-end:

Result: {exception,exit,
            {{function_clause,
                 [{gen,do_for_proc,
                      [{var,2},#Fun<gen.0.49329122>],
                      [{file,"gen.erl"},{line,363}]},

I would not expect PropEr to give me {var,2} for a function call.

As you can see from the output the {var,2} set was dropped during shrinking but it is present in the state. Should I take this to mean that the variables PropEr needs should be given directly instead of passing the state as a whole to the command, to avoid this issue?

The test suite is at https://github.com/rabbitmq/rabbitmq-server/blob/modern-classic-queue-index/deps/rabbit/test/classic_queue_SUITE.erl with only minor changes added on my machine.

*** System report during classic_queue_SUITE:classic_queue_v2/1 in classic_queue_tests 2022-01-10 03:56:57.458 ***
=ERROR REPORT==== 10-Jan-2022::03:56:57.458120 ===
[[{init,
      {cq,undefined,prop_classic_queue_v2,default,2,#{},false,false,[],[],[],
          [{rmq_nodes,
               [[{nodename,'rmq-ct-classic_queue_tests-1-21000@localhost'},
                 {channels_manager,<0.145.0>}]]}],
          #{}}},
  {set,
      {var,1},
      {call,classic_queue_SUITE,cmd_setup_queue,
          [{cq,undefined,prop_classic_queue_v2,default,2,#{},false,false,[],
               [],[],
               [{rmq_nodes,
                    [[{nodename,
                          'rmq-ct-classic_queue_tests-1-21000@localhost'},
                      {channels_manager,<0.145.0>}]]}],
               #{}}]}},
  {set,
      {var,7},
      {call,classic_queue_SUITE,cmd_restart_queue_dirty,
          [{cq,{var,1},
               prop_classic_queue_v2,default,2,
               #{{var,4} => {[{var,5}],[]}},
               false,false,[],[],[],
               [{rmq_nodes,
                    [[{nodename,
                          'rmq-ct-classic_queue_tests-1-21000@localhost'},
                      {channels_manager,<0.145.0>}]]}],
               #{{var,2} => #{confirms => true,consumer => none},
                 {var,4} => #{confirms => false,consumer => {var,6}}}}]}}]]

*** System report during classic_queue_SUITE:classic_queue_v2/1 in classic_queue_tests 2022-01-10 03:56:57.459 ***
=ERROR REPORT==== 10-Jan-2022::03:56:57.458463 ===
History: [{{cq,undefined,prop_classic_queue_v2,default,2,#{},false,false,[],
               [],[],
               [{rmq_nodes,
                    [[{nodename,
                          'rmq-ct-classic_queue_tests-1-21000@localhost'},
                      {channels_manager,<0.145.0>}]]}],
               #{}},
           {amqqueue,
               {resource,<<"/">>,queue,<<"prop_classic_queue_v2_111858">>},
               true,false,none,[],<13103.20402.1>,[],[],[],
               [{vhost,<<"/">>},
                {name,<<"queue-mode-version-policy">>},
                {pattern,<<".*">>},
                {'apply-to',<<"queues">>},
                {definition,
                    [{<<"queue-mode">>,<<"default">>},
                     {<<"queue-version">>,2}]},
                {priority,0}],
               undefined,[],[],live,0,[],<<"/">>,
               #{user => <<"acting-user">>},
               rabbit_classic_queue,#{}}}]
State: {cq,{amqqueue,{resource,<<"/">>,queue,
                               <<"prop_classic_queue_v2_111858">>},
                     true,false,none,[],<13103.20402.1>,[],[],[],
                     [{vhost,<<"/">>},
                      {name,<<"queue-mode-version-policy">>},
                      {pattern,<<".*">>},
                      {'apply-to',<<"queues">>},
                      {definition,[{<<"queue-mode">>,<<"default">>},
                                   {<<"queue-version">>,2}]},
                      {priority,0}],
                     undefined,[],[],live,0,[],<<"/">>,
                     #{user => <<"acting-user">>},
                     rabbit_classic_queue,#{}},
           prop_classic_queue_v2,default,2,#{},false,false,[],[],[],
           [{rmq_nodes,[[{nodename,'rmq-ct-classic_queue_tests-1-21000@localhost'},
                         {channels_manager,<0.145.0>}]]}],
           #{}}
Result: {exception,exit,
            {{function_clause,
                 [{gen,do_for_proc,
                      [{var,2},#Fun<gen.0.49329122>],
                      [{file,"gen.erl"},{line,363}]},
                  {gen_server,call,3,[{file,"gen_server.erl"},{line,243}]},
                  {amqp_channel,do_wait_for_confirms,2,
                      [{file,"amqp_channel.erl"},{line,978}]},
                  {classic_queue_SUITE,
                      '-cmd_restart_queue_dirty/1-lc$^0/1-0-',1,
                      [{file,"classic_queue_SUITE.erl"},{line,977}]},
                  {classic_queue_SUITE,cmd_restart_queue_dirty,1,
                      [{file,"classic_queue_SUITE.erl"},{line,978}]},
                  {proper_statem,safe_apply,3,
                      [{file,"src/proper_statem.erl"},{line,696}]},
                  {proper_statem,run_commands,5,
                      [{file,"src/proper_statem.erl"},{line,652}]},
                  {proper_statem,run_commands,3,
                      [{file,"src/proper_statem.erl"},{line,621}]},
                  {classic_queue_SUITE,'-prop_common/1-fun-2-',1,
                      [{file,"classic_queue_SUITE.erl"},{line,475}]},
                  {proper,apply_args,4,[{file,"src/proper.erl"},{line,1834}]},
                  {proper,child,4,[{file,"src/proper.erl"},{line,1870}]},
                  {proper,'-spawn_link_migrate/2-fun-1-',2,
                      [{file,"src/proper.erl"},{line,816}]}]},
             {gen_server,call,[{var,2},{wait_for_confirms,1000},70000]}},
            [{gen_server,call,3,[{file,"gen_server.erl"},{line,247}]},
             {amqp_channel,do_wait_for_confirms,2,
                 [{file,"amqp_channel.erl"},{line,978}]},
             {classic_queue_SUITE,'-cmd_restart_queue_dirty/1-lc$^0/1-0-',1,
                 [{file,"classic_queue_SUITE.erl"},{line,977}]},
             {classic_queue_SUITE,cmd_restart_queue_dirty,1,
                 [{file,"classic_queue_SUITE.erl"},{line,978}]},
             {proper_statem,safe_apply,3,
                 [{file,"src/proper_statem.erl"},{line,696}]},
             {proper_statem,run_commands,5,
                 [{file,"src/proper_statem.erl"},{line,652}]},
             {proper_statem,run_commands,3,
                 [{file,"src/proper_statem.erl"},{line,621}]},
             {classic_queue_SUITE,'-prop_common/1-fun-2-',1,
                 [{file,"classic_queue_SUITE.erl"},{line,475}]},
             {proper,apply_args,4,[{file,"src/proper.erl"},{line,1834}]},
             {proper,child,4,[{file,"src/proper.erl"},{line,1870}]},
             {proper,'-spawn_link_migrate/2-fun-1-',2,
                 [{file,"src/proper.erl"},{line,816}]}]}