Skip to content

Commit

Permalink
feat: 创建订阅支持开启订阅巡检 (closed TencentBlueKing#2525)
Browse files Browse the repository at this point in the history
  • Loading branch information
Huayeaaa committed Dec 24, 2024
1 parent 2d566ca commit e8e2425
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions apps/backend/subscription/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ class CreateStepSerializer(serializers.Serializer):
steps = serializers.ListField(child=CreateStepSerializer(), min_length=1, label="事件订阅触发的动作列表")
target_hosts = TargetHostSerializer(many=True, label="下发的目标机器列表", required=False, allow_empty=False)
run_immediately = serializers.BooleanField(required=False, default=False, label="是否立即执行")
enable = serializers.BooleanField(required=False, default=False, label="是否开启订阅巡检")
is_main = serializers.BooleanField(required=False, default=False, label="是否为主配置")
operate_info = serializers.ListField(required=False, child=HostOperateInfoSerializer(), default=[], label="操作信息")
system_account = serializers.DictField(required=False, label=_("操作系统对应账户"))
Expand Down
4 changes: 3 additions & 1 deletion apps/backend/tests/subscription/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ def _test_create_subscription(self):
{
"bk_username": "admin",
"bk_app_code": "blueking",
"enable": True,
"scope": {
"bk_biz_id": self.TEST_BIZ_ID,
"node_type": "TOPO",
Expand Down Expand Up @@ -125,7 +126,8 @@ def _test_create_subscription(self):
subscription_id = r.data["data"]["subscription_id"]

# 探测数据库是否创建了对应的记录
Subscription.objects.get(id=r.data["data"]["subscription_id"])
subscription_obj = Subscription.objects.get(id=r.data["data"]["subscription_id"])
self.assertEqual(subscription_obj.enable, True)
SubscriptionStep.objects.get(step_id="my_first", subscription_id=subscription_id)

return subscription_id
Expand Down

0 comments on commit e8e2425

Please sign in to comment.