Example #1
0
    def test_check_no_resources(self, *mocks):
        """
        Ensures the profile check fails when no resource constraints are found
        """
        profile = Profile(self.workflow)

        profile.load = mock.Mock()
        profile.load.return_value = get_content('profiles/no_constraints.yml')

        errors = profile._check_services(profile.check_resources, profile.data)

        self.assertRegex(' '.join(errors), r'resource constraints not found')
Example #2
0
    def test_check_with_node_constraints(self, *mocks):
        """
        Ensures the profile check passes when no constraints are found
        """
        profile = Profile(self.workflow)

        profile.load = mock.Mock()
        profile.load.return_value = get_content("profiles/with_node_constraints.yml")

        errors = profile._check_services(profile.check_constraints, profile.data)

        self.assertEqual(0, len(errors))
Example #3
0
    def test_check_no_node_constraints(self, *mocks):
        """
        Ensures the profile check fails when `node.` constraints are not found
        """
        profile = Profile(self.workflow)

        profile.load = mock.Mock()
        profile.load.return_value = get_content("profiles/no_node_constraints.yml")

        errors = profile._check_services(profile.check_constraints, profile.data)

        self.assertRegex(" ".join(errors), r"node constraints not found")
Example #4
0
    def test_check_resources_empty(self, *mocks):
        """
        Ensures the profile check fails when resources constraints are empty
        """
        profile = Profile(self.workflow)

        profile.load = mock.Mock()
        profile.load.return_value = get_content("profiles/resources_nothing_set.yml")

        errors = profile._check_services(profile.check_resources, profile.data)

        self.assertRegex(" ".join(errors), r"resource constraints not found")
Example #5
0
    def test_check_global_mode(self, *mocks):
        """
        Ensures the profile check does not fail when there is no constraint on a global service
        """
        profile = Profile(self.workflow)

        profile.load = mock.Mock()
        profile.load.return_value = get_content("profiles/global_no_constraints.yml")

        errors = profile._check_services(profile.check_constraints, profile.data)

        self.assertEqual(0, len(errors), errors)