示例#1
0
    def test_no_such_process(self):
        """
        If processes do not exist, only wallclock time is returned.
        """
        d = get_node_cpu_times(
            Clock(),
            _LocalRunner(),
            Node(uuid=uuid4(), public_address=IPAddress('10.0.0.1')),
            ['n0n-exist'],
        )

        d.addCallback(self.assertEqual, {WALLCLOCK_LABEL: 0.0})

        return d
示例#2
0
    def test_no_such_process(self):
        """
        If processes do not exist, only wallclock time is returned.
        """
        d = get_node_cpu_times(
            Clock(),
            _LocalRunner(),
            Node(uuid=uuid4(), public_address=IPAddress('10.0.0.1')),
            ['n0n-exist'],
        )

        d.addCallback(self.assertEqual, {WALLCLOCK_LABEL: 0.0})

        return d
示例#3
0
    def test_get_node_cpu_times(self):
        """
        Success results in output of dictionary containing process names.
        """
        d = get_node_cpu_times(
            Clock(),
            _LocalRunner(),
            Node(uuid=uuid4(), public_address=IPAddress('10.0.0.1')),
            _pid_1_name,
            [_pid_1_name],
        )

        def check(result):
            self.assertEqual(result.keys(), [_pid_1_name, WALLCLOCK_LABEL])

        d.addCallback(check)

        return d
示例#4
0
    def test_get_node_cpu_times(self):
        """
        Success results in output of dictionary containing process names.
        """
        d = get_node_cpu_times(
            Clock(),
            _LocalRunner(),
            Node(uuid=uuid4(), public_address=IPAddress('10.0.0.1')),
            [_standard_process],
        )

        def check(result):
            self.assertEqual(
                result.keys(), [_standard_process, WALLCLOCK_LABEL]
            )

        d.addCallback(check)

        return d