diff --git a/sql/utils/test_workflow_audit.py b/sql/utils/test_workflow_audit.py index 816aeed424..54e2edd43a 100644 --- a/sql/utils/test_workflow_audit.py +++ b/sql/utils/test_workflow_audit.py @@ -357,13 +357,6 @@ def test_init_no_workflow_and_audit(): assert "WorkflowAudit 或 workflow" in str(e.value) -def test_archive_init_no_resource_group(archive_apply): - """测试 archive 初始化时指定的资源组不存在""" - with pytest.raises(AuditException) as e: - AuditV2(workflow=archive_apply, resource_group="not_exists_group") - assert "参数错误, 未发现资源组" in str(e.value) - - def test_duplicate_create(sql_query_apply, fake_generate_audit_setting): audit = AuditV2(workflow=sql_query_apply) audit.create_audit() diff --git a/sql/utils/workflow_audit.py b/sql/utils/workflow_audit.py index c2b2b283f4..2e633f3ae2 100644 --- a/sql/utils/workflow_audit.py +++ b/sql/utils/workflow_audit.py @@ -149,7 +149,9 @@ def __post_init__(self): self.resource_group_id = self.workflow.group_id elif isinstance(self.workflow, ArchiveConfig): try: - group_in_db = ResourceGroup.objects.get(group_name=self.resource_group) + group_in_db = ResourceGroup.objects.get( + group_id=self.workflow.resource_group_id + ) self.resource_group_id = group_in_db.group_id except ResourceGroup.DoesNotExist: raise AuditException(f"参数错误, 未发现资源组 {self.resource_group}")