commit
144a3dedbb
|
@ -827,12 +827,11 @@ class TestAgentTasks(TacticalTestCase):
|
|||
@patch("agents.tasks.sleep", return_value=None)
|
||||
def test_batch_sync_modules_task(self, mock_sleep, salt_batch_async):
|
||||
# chunks of 50, 60 online should run only 2 times
|
||||
# can't use baker agent.online_agent or agent.overdue_agent here
|
||||
# cuz it breaks test_generating_policy_checks_for_all_agents
|
||||
# with error self.assertEqual(Agent.objects.get(pk=agent1.id).agentchecks.count(), 7): AssertionError: 0 != 7
|
||||
baker.make_recipe("agents.agent", last_seen=djangotime.now(), _quantity=60)
|
||||
baker.make_recipe(
|
||||
"agents.agent",
|
||||
"agents.online_agent", last_seen=djangotime.now(), _quantity=60
|
||||
)
|
||||
baker.make_recipe(
|
||||
"agents.overdue_agent",
|
||||
last_seen=djangotime.now() - djangotime.timedelta(minutes=9),
|
||||
_quantity=115,
|
||||
)
|
||||
|
|
|
@ -888,18 +888,22 @@ class TestPolicyTasks(TacticalTestCase):
|
|||
# setup data
|
||||
policy = baker.make("automation.Policy", active=True)
|
||||
self.create_checks(policy=policy)
|
||||
clients = baker.make("clients.Client", client=seq("Default"), _quantity=2)
|
||||
baker.make(
|
||||
"clients.Site", client=cycle(clients), site=seq("Default"), _quantity=4
|
||||
clients = baker.make("clients.Client", client=seq("Client"), _quantity=2)
|
||||
sites = baker.make(
|
||||
"clients.Site", client=cycle(clients), site=seq("Site"), _quantity=4
|
||||
)
|
||||
server_agent = baker.make_recipe(
|
||||
"agents.server_agent", client="Default1", site="Default1"
|
||||
"agents.server_agent", client=clients[0].client, site=sites[0].site
|
||||
)
|
||||
workstation_agent = baker.make_recipe(
|
||||
"agents.workstation_agent", client="Default1", site="Default3"
|
||||
"agents.workstation_agent", client=clients[0].client, site=sites[2].site
|
||||
)
|
||||
agent1 = baker.make_recipe(
|
||||
"agents.server_agent", client=clients[1].client, site=sites[1].site
|
||||
)
|
||||
agent2 = baker.make_recipe(
|
||||
"agents.workstation_agent", client=clients[1].client, site=sites[3].site
|
||||
)
|
||||
agent1 = baker.make_recipe("agents.agent", client="Default2", site="Default2")
|
||||
agent2 = baker.make_recipe("agents.agent", client="Default2", site="Default4")
|
||||
core = CoreSettings.objects.first()
|
||||
core.server_policy = policy
|
||||
core.workstation_policy = policy
|
||||
|
@ -1027,7 +1031,7 @@ class TestPolicyTasks(TacticalTestCase):
|
|||
|
||||
# setup data
|
||||
policy = baker.make("automation.Policy", active=True)
|
||||
tasks = baker.make(
|
||||
baker.make(
|
||||
"autotasks.AutomatedTask", policy=policy, name=seq("Task"), _quantity=3
|
||||
)
|
||||
clients = baker.make(
|
||||
|
|
Loading…
Reference in New Issue