@@ -1266,3 +1266,38 @@ async def test_bad_requests(self, client: aiokatcp.Client, n_ants: int) -> None:
12661266 await client .request ("beam-delays" , "beam_0x" , "0:0" , "1:1" , "2:2" , "3:3:3" ) # Too many :'s
12671267 with pytest .raises (aiokatcp .FailReply ):
12681268 await client .request ("beam-delays" , "beam_0x" , "0:0" , "1:1" , "2:2" , "3:2j" ) # Not float
1269+
1270+ # capture-{start, stop} requests with non-existent stream
1271+ with pytest .raises (aiokatcp .FailReply ):
1272+ await client .request ("capture-start" , "non-existent-stream" )
1273+ with pytest .raises (aiokatcp .FailReply ):
1274+ await client .request ("capture-stop" , "non-existent-stream" )
1275+
1276+ @DEFAULT_PARAMETERS
1277+ async def test_capture_stop_start (
1278+ self ,
1279+ client : aiokatcp .Client ,
1280+ corrprod_outputs : list [XOutput ],
1281+ beam_outputs : list [BOutput ],
1282+ xbengine : XBEngine ,
1283+ ) -> None :
1284+ """Test capture-start and capture-stop requests.
1285+
1286+ First issue a capture-stop as `xbengine` is initialised with --send-enabled.
1287+ """
1288+
1289+ def get_stream_status (stream_name : str ) -> bool :
1290+ pipeline , stream_id = xbengine ._request_pipeline (stream_name )
1291+ if isinstance (pipeline , XPipeline ):
1292+ return pipeline .send_stream .send_enabled
1293+ elif isinstance (pipeline , BPipeline ):
1294+ return pipeline .send_stream .send_enabled [stream_id ]
1295+ else :
1296+ raise TypeError (f"{ stream_name } is of unknown type" )
1297+
1298+ for output in corrprod_outputs + beam_outputs :
1299+ await client .request ("capture-stop" , output .name )
1300+ assert get_stream_status (output .name ) is False , f"Stream { output .name } is still enabled"
1301+
1302+ await client .request ("capture-start" , output .name )
1303+ assert get_stream_status (output .name ) is True , f"Stream { output .name } is still disabled"
0 commit comments