Skip to content

Commit

Permalink
feature: 支持bk_agent_id (close TencentBlueKing#562)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangzhw8 committed Apr 8, 2022
1 parent 48112a4 commit 2f0500d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion apps/backend/tests/view/test_get_gse_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

import copy

from django.db import transaction

from apps.backend.constants import REDIS_AGENT_CONF_KEY_TPL
from apps.backend.utils.redis import REDIS_INST
from apps.backend.views import generate_gse_config
Expand All @@ -30,7 +32,8 @@ def setUpTestData(cls):

super().setUpTestData()
host_model_data = copy.deepcopy(common_unit.host.HOST_MODEL_DATA)
cls.host = models.Host.objects.create(**host_model_data)
with transaction.atomic():
cls.host = models.Host.objects.create(**host_model_data)
# 此类查询在单元测试中会有如下报错, 因此将数据预先查询缓存
# TransactionManagementError "You can't execute queries until the end of the 'atomic' block" while using signals
# 参考:https://stackoverflow.com/questions/21458387
Expand Down

0 comments on commit 2f0500d

Please sign in to comment.