@@ -110,6 +110,78 @@ async def test_watch_buffer(
110
110
)
111
111
112
112
113
+ @pytest .mark .asyncio
114
+ @mock .patch ('src.pipeline_watchdog.run.watch_ingress' )
115
+ @mock .patch ('src.pipeline_watchdog.run.watch_egress' )
116
+ @mock .patch ('src.pipeline_watchdog.run.watch_queue' )
117
+ @mock .patch ('src.pipeline_watchdog.run.DockerClient' )
118
+ async def test_watch_buffer_queue_only (
119
+ docker_client_mock ,
120
+ watch_queue_mock ,
121
+ watch_egress_mock ,
122
+ watch_ingress_mock ,
123
+ config_with_queue_only ,
124
+ ):
125
+ docker_client = docker_client_mock ()
126
+
127
+ watch_config = config_with_queue_only .watch_configs [0 ]
128
+
129
+ await watch_buffer (docker_client , watch_config )
130
+ watch_queue_mock .assert_awaited_once_with (
131
+ docker_client , watch_config .buffer , watch_config .queue
132
+ )
133
+ watch_egress_mock .assert_not_awaited ()
134
+ watch_ingress_mock .assert_not_awaited ()
135
+
136
+
137
+ @pytest .mark .asyncio
138
+ @mock .patch ('src.pipeline_watchdog.run.watch_ingress' )
139
+ @mock .patch ('src.pipeline_watchdog.run.watch_egress' )
140
+ @mock .patch ('src.pipeline_watchdog.run.watch_queue' )
141
+ @mock .patch ('src.pipeline_watchdog.run.DockerClient' )
142
+ async def test_watch_buffer_egress_only (
143
+ docker_client_mock ,
144
+ watch_queue_mock ,
145
+ watch_egress_mock ,
146
+ watch_ingress_mock ,
147
+ config_with_egress_only ,
148
+ ):
149
+ docker_client = docker_client_mock ()
150
+
151
+ watch_config = config_with_egress_only .watch_configs [0 ]
152
+
153
+ await watch_buffer (docker_client , watch_config )
154
+ watch_egress_mock .assert_awaited_once_with (
155
+ docker_client , watch_config .buffer , watch_config .egress
156
+ )
157
+ watch_queue_mock .assert_not_awaited ()
158
+ watch_ingress_mock .assert_not_awaited ()
159
+
160
+
161
+ @pytest .mark .asyncio
162
+ @mock .patch ('src.pipeline_watchdog.run.watch_ingress' )
163
+ @mock .patch ('src.pipeline_watchdog.run.watch_egress' )
164
+ @mock .patch ('src.pipeline_watchdog.run.watch_queue' )
165
+ @mock .patch ('src.pipeline_watchdog.run.DockerClient' )
166
+ async def test_watch_buffer_ingress_only (
167
+ docker_client_mock ,
168
+ watch_queue_mock ,
169
+ watch_egress_mock ,
170
+ watch_ingress_mock ,
171
+ config_with_ingress_only ,
172
+ ):
173
+ docker_client = docker_client_mock ()
174
+
175
+ watch_config = config_with_ingress_only .watch_configs [0 ]
176
+
177
+ await watch_buffer (docker_client , watch_config )
178
+ watch_ingress_mock .assert_awaited_once_with (
179
+ docker_client , watch_config .buffer , watch_config .ingress
180
+ )
181
+ watch_queue_mock .assert_not_awaited ()
182
+ watch_egress_mock .assert_not_awaited ()
183
+
184
+
113
185
@pytest .mark .asyncio
114
186
@mock .patch ('src.pipeline_watchdog.run.watch_ingress' )
115
187
@mock .patch ('src.pipeline_watchdog.run.watch_egress' )
0 commit comments