Skip to content

Commit c607eb0

Browse files
committed
system_SUITE: Handle time-sensitive exceptions
[Why] Depending on the exit status of the writer process when a testcase calls it, the exception reason might differ. From the actual error if the writer was called before it handled the error, to `noproc` if it already exited. [How] We match against several probable exception reasons that would signify a success for the testcase.
1 parent 8093930 commit c607eb0

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

deps/amqp_client/test/system_SUITE.erl

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1347,7 +1347,13 @@ channel_writer_death(Config) ->
13471347
when ConnType =:= direct -> ok;
13481348

13491349
exit:{{infrastructure_died, {unknown_properties_record, <<>>}}, _}
1350-
when ConnType =:= network -> ok
1350+
when ConnType =:= network -> ok;
1351+
1352+
%% The writer process exited before the call and the amqp_channel_sup
1353+
%% supervisor shut the supervision tree down because the channel is
1354+
%% significant. The call happened at that shutdown time or just after.
1355+
exit:{shutdown, {gen_server, call, _}} -> ok;
1356+
exit:{noproc, {gen_server, call, _}} -> ok
13511357
end,
13521358
wait_for_death(Channel),
13531359
wait_for_death(Connection).
@@ -1435,7 +1441,12 @@ shortstr_overflow_property(Config) ->
14351441
Ret = amqp_channel:call(Channel, QoS),
14361442
throw({unexpected_success, Ret})
14371443
catch
1438-
exit:{{infrastructure_died, content_properties_shortstr_overflow}, _} -> ok
1444+
exit:{{infrastructure_died, content_properties_shortstr_overflow}, _} -> ok;
1445+
%% The writer process exited before the call and the amqp_channel_sup
1446+
%% supervisor shut the supervision tree down because the channel is
1447+
%% significant. The call happened at that shutdown time or just after.
1448+
exit:{shutdown, {gen_server, call, _}} -> ok;
1449+
exit:{noproc, {gen_server, call, _}} -> ok
14391450
end,
14401451
wait_for_death(Channel),
14411452
wait_for_death(Connection).
@@ -1457,7 +1468,12 @@ shortstr_overflow_field(Config) ->
14571468
consumer_tag = SentString}),
14581469
throw({unexpected_success, Ret})
14591470
catch
1460-
exit:{{infrastructure_died, method_field_shortstr_overflow}, _} -> ok
1471+
exit:{{infrastructure_died, method_field_shortstr_overflow}, _} -> ok;
1472+
%% The writer process exited before the call and the amqp_channel_sup
1473+
%% supervisor shut the supervision tree down because the channel is
1474+
%% significant. The call happened at that shutdown time or just after.
1475+
exit:{shutdown, {gen_server, call, _}} -> ok;
1476+
exit:{noproc, {gen_server, call, _}} -> ok
14611477
end,
14621478
wait_for_death(Channel),
14631479
wait_for_death(Connection).

0 commit comments

Comments
 (0)