コード例 #1
0
ファイル: test.py プロジェクト: rstgroup/nagctl
	def test_acknowledgeProblem_host(self):
		"""acknowledgeProblem: generate commands to acknowledge host problem"""

		nagctl.conf["host"] = "database"
		commands = nagctl.acknowledgeProblem(["acknowledge", "problem", "comment"], "host")

		expected = ["ACKNOWLEDGE_HOST_PROBLEM;database;1;0;0;nagctl;comment"]
		self.assertEqual(commands, expected)
コード例 #2
0
ファイル: test.py プロジェクト: rstgroup/nagctl
	def test_acknowledgeProblem_none(self):
		"""acknowledgeProblem: do not generate any commands"""

		nagctl.conf["host"] = "worker0"
		nagctl.conf["service"] = "queue1"
		commands = nagctl.acknowledgeProblem(["acknowledge", "problem", "comment"], "all")

		expected = []
		self.assertEqual(commands, expected)
コード例 #3
0
ファイル: test.py プロジェクト: sasg/nagctl
    def test_acknowledgeProblem_host(self):
        """acknowledgeProblem: generate commands to acknowledge host problem"""

        nagctl.conf["host"] = "database"
        commands = nagctl.acknowledgeProblem(
            ["acknowledge", "problem", "comment"], "host")

        expected = ["ACKNOWLEDGE_HOST_PROBLEM;database;1;0;0;nagctl;comment"]
        self.assertEqual(commands, expected)
コード例 #4
0
ファイル: test.py プロジェクト: rstgroup/nagctl
	def test_acknowledgeProblem_service(self):
		"""acknowledgeProblem: generate commands to acknowledge service problem"""

		import re

		nagctl.conf["service"] = "load"
		commands = nagctl.acknowledgeProblem(["acknowledge", "problem", "comment"], "service")

		expected = ["ACKNOWLEDGE_SVC_PROBLEM;worker0;load;1;0;0;nagctl;comment", "ACKNOWLEDGE_SVC_PROBLEM;worker1;load;1;0;0;nagctl;comment", "ACKNOWLEDGE_SVC_PROBLEM;database;load;1;0;0;nagctl;comment"]
		self.assertEqual(commands, expected)
コード例 #5
0
ファイル: test.py プロジェクト: sasg/nagctl
    def test_acknowledgeProblem_none(self):
        """acknowledgeProblem: do not generate any commands"""

        nagctl.conf["host"] = "worker0"
        nagctl.conf["service"] = "queue1"
        commands = nagctl.acknowledgeProblem(
            ["acknowledge", "problem", "comment"], "all")

        expected = []
        self.assertEqual(commands, expected)
コード例 #6
0
ファイル: test.py プロジェクト: rstgroup/nagctl
	def test_acknowledgeProblem_all(self):
		"""acknowledgeProblem: generate commands to acknowledge host and service problem"""

		import re

		nagctl.conf["host"] = "database"
		nagctl.conf["service"] = "load"
		commands = nagctl.acknowledgeProblem(["acknowledge", "problem", "comment"], "all")

		expected = ["ACKNOWLEDGE_HOST_PROBLEM;database;1;0;0;nagctl;comment", "ACKNOWLEDGE_SVC_PROBLEM;database;load;1;0;0;nagctl;comment"]
		self.assertEqual(commands, expected)
コード例 #7
0
ファイル: test.py プロジェクト: sasg/nagctl
    def test_acknowledgeProblem_all(self):
        """acknowledgeProblem: generate commands to acknowledge host and service problem"""

        import re

        nagctl.conf["host"] = "database"
        nagctl.conf["service"] = "load"
        commands = nagctl.acknowledgeProblem(
            ["acknowledge", "problem", "comment"], "all")

        expected = [
            "ACKNOWLEDGE_HOST_PROBLEM;database;1;0;0;nagctl;comment",
            "ACKNOWLEDGE_SVC_PROBLEM;database;load;1;0;0;nagctl;comment"
        ]
        self.assertEqual(commands, expected)
コード例 #8
0
ファイル: test.py プロジェクト: sasg/nagctl
    def test_acknowledgeProblem_service(self):
        """acknowledgeProblem: generate commands to acknowledge service problem"""

        import re

        nagctl.conf["service"] = "load"
        commands = nagctl.acknowledgeProblem(
            ["acknowledge", "problem", "comment"], "service")

        expected = [
            "ACKNOWLEDGE_SVC_PROBLEM;worker0;load;1;0;0;nagctl;comment",
            "ACKNOWLEDGE_SVC_PROBLEM;worker1;load;1;0;0;nagctl;comment",
            "ACKNOWLEDGE_SVC_PROBLEM;database;load;1;0;0;nagctl;comment"
        ]
        self.assertEqual(commands, expected)