예제 #1
0
 def test_resource(self):
     agent_name = ResourceAgentName("ocf", "pacemaker", "Stateful")
     self.config.runner.pcmk.load_agent(
         agent_name=agent_name.full_name,
         env={"PATH": "/usr/sbin:/bin:/usr/bin"},
     )
     self.assertEqual(
         lib.get_agent_default_operations(
             self.env_assist.get_env(), agent_name.to_dto()
         ),
         ListCibResourceOperationDto(
             operations=[
                 _operation_fixture("start", "0s", timeout="20s"),
                 _operation_fixture("stop", "0s", timeout="20s"),
                 _operation_fixture(
                     "monitor",
                     "10s",
                     timeout="20s",
                     role=const.PCMK_ROLE_PROMOTED,
                 ),
                 _operation_fixture(
                     "monitor",
                     "11s",
                     timeout="20s",
                     role=const.PCMK_ROLE_UNPROMOTED,
                 ),
                 _operation_fixture("promote", "0s", timeout="10s"),
                 _operation_fixture("demote", "0s", timeout="10s"),
                 _operation_fixture("notify", "0s", timeout="5s"),
                 _operation_fixture("reload-agent", "0s", timeout="10s"),
             ]
         ),
     )
예제 #2
0
 def test_resource_only_necessary(self):
     agent_name = ResourceAgentName("ocf", "pacemaker", "Stateful")
     self.config.runner.pcmk.load_agent(
         agent_name=agent_name.full_name,
         env={"PATH": "/usr/sbin:/bin:/usr/bin"},
     )
     self.assertEqual(
         lib.get_agent_default_operations(
             self.env_assist.get_env(),
             agent_name.to_dto(),
             necessary_only=True,
         ),
         ListCibResourceOperationDto(
             operations=[
                 _operation_fixture(
                     "monitor",
                     "10s",
                     timeout="20s",
                     role=const.PCMK_ROLE_PROMOTED,
                 ),
                 _operation_fixture(
                     "monitor",
                     "11s",
                     timeout="20s",
                     role=const.PCMK_ROLE_UNPROMOTED,
                 ),
             ]
         ),
     )
예제 #3
0
 def _test_stonith(self, necessary_only):
     agent_name = ResourceAgentName("stonith", None, "fence_unfencing")
     self.config.runner.pcmk.load_agent(
         agent_name=agent_name.full_name,
         env={"PATH": "/usr/sbin:/bin:/usr/bin"},
     )
     self.config.runner.pcmk.load_fenced_metadata()
     self.assertEqual(
         lib.get_agent_default_operations(
             self.env_assist.get_env(),
             agent_name.to_dto(),
             necessary_only=necessary_only,
         ),
         ListCibResourceOperationDto(operations=[
             _operation_fixture("monitor", interval="60s"),
         ]),
     )