|
38 | 38 |
|
39 | 39 | %% Test cases |
40 | 40 | -export([ t_acks_during_revoke/1 |
| 41 | + , t_commit_offsets_without_connection/1 |
41 | 42 | , t_update_topics_triggers_rebalance/1 |
42 | 43 | , t_offset_fetch_minus_one_falls_back_to_reset_policy/1 |
43 | 44 | , t_member_id_required_dynamic_member/1 |
@@ -134,6 +135,33 @@ t_acks_during_revoke(Config) when is_list(Config) -> |
134 | 135 |
|
135 | 136 | ok. |
136 | 137 |
|
| 138 | +t_commit_offsets_without_connection(Config) when is_list(Config) -> |
| 139 | + GroupId = list_to_binary( |
| 140 | + "brod-grp-coord-no-connection-" ++ |
| 141 | + integer_to_list(erlang:unique_integer([positive]))), |
| 142 | + {ok, CoordinatorPid} = |
| 143 | + brod_group_coordinator:start_link(?CLIENT_ID, GroupId, [?TOPIC], |
| 144 | + _Config = [], ?MODULE, {self(), 1}), |
| 145 | + unlink(CoordinatorPid), |
| 146 | + try |
| 147 | + ?assert_receive({assignments_revoked, 1}, ok), |
| 148 | + CoordinatorPid ! continue, |
| 149 | + ?assert_receive({assignments_received, 1, _, _}, ok), |
| 150 | + %% `connection` is the seventh state record field, at tuple index 8. |
| 151 | + _ = sys:replace_state( |
| 152 | + CoordinatorPid, fun(State) -> setelement(8, State, undefined) end), |
| 153 | + ?assertEqual( |
| 154 | + {error, {connection_down, noproc}}, |
| 155 | + brod_group_coordinator:commit_offsets( |
| 156 | + CoordinatorPid, [{{?TOPIC, ?PARTITION}, 0}])), |
| 157 | + ?assert(is_process_alive(CoordinatorPid)), |
| 158 | + ?assert_receive({assignments_revoked, 1}, ok) |
| 159 | + after |
| 160 | + MRef = erlang:monitor(process, CoordinatorPid), |
| 161 | + exit(CoordinatorPid, kill), |
| 162 | + receive {'DOWN', MRef, process, CoordinatorPid, _} -> ok end |
| 163 | + end. |
| 164 | + |
137 | 165 | t_update_topics_triggers_rebalance(Config) when is_list(Config) -> |
138 | 166 | {ok, GroupCoordinatorPid} = |
139 | 167 | brod_group_coordinator:start_link(?CLIENT_ID, ?GROUP, [?TOPIC], |
|
0 commit comments