@@ -190,7 +190,6 @@ def configured_analysis(core_client, registry, analysis, master_realm, analysis_
190190 return analysis
191191
192192
193- # TODO: Make it possible to create analysis logs in the current test deployment.
194193@pytest .fixture ()
195194def analysis_log (core_client , configured_analysis ):
196195 core_client .send_analysis_command (configured_analysis , "buildStart" )
@@ -203,17 +202,6 @@ def _check_analysis_logs_present():
203202 return core_client .find_analysis_logs (filter = {"analysis_id" : configured_analysis .id })[0 ]
204203
205204
206- @pytest .fixture ()
207- def analysis_node_log (core_client , analysis_node ):
208- new_analysis_node_log = core_client .create_analysis_node_log (
209- analysis_node .analysis_id , analysis_node .node_id , level = "info" , status = "started"
210- )
211- yield new_analysis_node_log
212- core_client .delete_analysis_node_logs (
213- analysis_id = new_analysis_node_log .labels ["analysis_id" ], node_id = new_analysis_node_log .labels ["node_id" ]
214- )
215-
216-
217205@pytest .fixture ()
218206def registry (core_client ):
219207 new_registry = core_client .create_registry (
@@ -423,14 +411,13 @@ def test_build_analysis(core_client, configured_analysis):
423411 assert core_client .send_analysis_command (configured_analysis .id , command = "buildStop" ).build_status == "stopping"
424412
425413
426- @pytest .mark .xfail (reason = "It is not possible to create analysis logs in the current test deployment." )
427414def test_build_status_analysis (core_client , configured_analysis ):
428415 core_client .send_analysis_command (configured_analysis .id , command = "buildStart" )
429416 core_client .send_analysis_command (configured_analysis .id , command = "buildStatus" )
430417
431418 def _check_checking_event_in_logs ():
432419 logs = core_client .find_analysis_logs (filter = {"analysis_id" : configured_analysis .id })
433- assert "checking" in [log .event for log in logs ]
420+ assert "checking" in [log .labels . get ( " event" , None ) for log in logs ]
434421
435422 assert_eventually (_check_checking_event_in_logs )
436423
@@ -472,13 +459,31 @@ def test_get_analysis_node_not_found(core_client):
472459 assert core_client .get_analysis_node (next_uuid ()) is None
473460
474461
475- def test_find_analysis_node_logs (core_client , analysis_node_log ):
476- # "node_id" and "analysis_id" have to be specified to filter for analysis node logs.
477- analysis_node_logs_find = core_client .find_analysis_node_logs (
478- filter = {"node_id" : analysis_node_log .labels ["node_id" ], "analysis_id" : analysis_node_log .labels ["analysis_id" ]}
462+ def test_analysis_node_logs (core_client , analysis_node ):
463+ core_client .create_analysis_node_log (
464+ analysis_id = analysis_node .analysis_id , node_id = analysis_node .node_id , level = "info" , message = "test"
479465 )
480466
481- assert analysis_node_log .time in [log .time for log in analysis_node_logs_find ]
467+ def _check_analysis_node_logs_present ():
468+ assert (
469+ len (
470+ core_client .find_analysis_node_logs (
471+ filter = {"analysis_id" : analysis_node .analysis_id , "node_id" : analysis_node .node_id }
472+ )
473+ )
474+ == 1
475+ )
476+
477+ assert_eventually (_check_analysis_node_logs_present )
478+
479+ # TODO: Deleting analysis node logs raises am error in the hub.
480+ # core_client.delete_analysis_node_logs(
481+ # analysis_id=analysis_node.analysis_id, node_id=analysis_node.node_id
482+ # )
483+
484+ # assert len(core_client.find_analysis_node_logs(
485+ # filter={"analysis_id": analysis_node.analysis_id, "node_id": analysis_node.node_id}
486+ # )) == 0
482487
483488
484489def test_get_analysis_bucket (core_client , analysis_buckets , analysis_bucket_includables ):
@@ -632,7 +637,7 @@ def test_update_registry_project(core_client, registry_project):
632637 assert new_registry_project .name == new_name
633638
634639
635- @pytest .mark .xfail (reason = "It is not possible to create analysis logs in the current test deployment ." )
640+ @pytest .mark .xfail (reason = "Bug in Hub, see https://github.com/PrivateAIM/hub/issues/1181 ." )
636641def test_delete_analysis_logs (core_client , analysis_log ):
637642 core_client .delete_analysis_logs (analysis_id = analysis_log .labels ["analysis_id" ])
638643
0 commit comments