Ejemplo n.º 1
0
    def test_no_suites_matching_test_kind(self, mock_get_named_suites, mock_suite_class):
        all_suites = ["core", "replica_sets_jscore_passthrough"]
        mock_get_named_suites.return_value = all_suites

        membership_map = suitesconfig.create_test_membership_map(test_kind="nonexistent_test")
        self.assertEqual(membership_map, {})
        self.assertEqual(mock_suite_class.call_count, 0)
Ejemplo n.º 2
0
    def test_no_suites_matching_test_kind(self, mock_get_named_suites, mock_suite_class):
        all_suites = ["core", "replica_sets_jscore_passthrough"]
        mock_get_named_suites.return_value = all_suites

        membership_map = suitesconfig.create_test_membership_map(test_kind="nonexistent_test")
        self.assertEqual(membership_map, {})
        self.assertEqual(mock_suite_class.call_count, 0)
Ejemplo n.º 3
0
    def test_multiple_suites_matching_single_test_kind(self, mock_get_named_suites,
                                                       mock_suite_class):
        all_suites = ["core", "replica_sets_jscore_passthrough"]
        mock_get_named_suites.return_value = all_suites

        mock_suite_class.return_value.tests = ["test1", "test2"]

        membership_map = suitesconfig.create_test_membership_map(test_kind="js_test")
        self.assertEqual(membership_map, dict(test1=all_suites, test2=all_suites))
        self.assertEqual(mock_suite_class.call_count, 2)
Ejemplo n.º 4
0
    def test_multiple_suites_matching_single_test_kind(self, mock_get_named_suites,
                                                       mock_suite_class):
        all_suites = ["core", "replica_sets_jscore_passthrough"]
        mock_get_named_suites.return_value = all_suites

        mock_suite_class.return_value.tests = ["test1", "test2"]

        membership_map = suitesconfig.create_test_membership_map(test_kind="js_test")
        self.assertEqual(membership_map, dict(test1=all_suites, test2=all_suites))
        self.assertEqual(mock_suite_class.call_count, 2)
Ejemplo n.º 5
0
    def test_multiple_suites_matching_multiple_test_kinds(self, mock_get_named_suites,
                                                          mock_suite_class):
        all_suites = ["core", "concurrency"]
        mock_get_named_suites.return_value = all_suites

        mock_suite_class.return_value.tests = ["test1", "test2"]

        membership_map = suitesconfig.create_test_membership_map(
            test_kind=("fsm_workload_test", "js_test"))
        self.assertEqual(membership_map, dict(test1=all_suites, test2=all_suites))
        self.assertEqual(mock_suite_class.call_count, 2)
Ejemplo n.º 6
0
    def test_multiple_suites_matching_multiple_test_kinds(self, mock_get_named_suites,
                                                          mock_suite_class):
        all_suites = ["core", "concurrency"]
        mock_get_named_suites.return_value = all_suites

        mock_suite_class.return_value.tests = ["test1", "test2"]

        membership_map = suitesconfig.create_test_membership_map(
            test_kind=("fsm_workload_test", "js_test"))
        self.assertEqual(membership_map, dict(test1=all_suites, test2=all_suites))
        self.assertEqual(mock_suite_class.call_count, 2)
Ejemplo n.º 7
0
    def _find_suites_by_test(suites):
        """
        Look up what other resmoke suites run the tests specified in the suites parameter.

        Return a dict keyed by test name, value is array of suite names.
        """
        memberships = {}
        test_membership = suitesconfig.create_test_membership_map()
        for suite in suites:
            for test in suite.tests:
                memberships[test] = test_membership[test]
        return memberships
Ejemplo n.º 8
0
    def _find_suites_by_test(suites):
        """
        Look up what other resmoke suites run the tests specified in the suites parameter.

        Return a dict keyed by test name, value is array of suite names.
        """
        memberships = {}
        test_membership = suitesconfig.create_test_membership_map()
        for suite in suites:
            for test in suite.tests:
                memberships[test] = test_membership[test]
        return memberships
Ejemplo n.º 9
0
def create_executor_list(suites, exclude_suites):
    """Create the executor list.

    Looks up what other resmoke suites run the tests specified in the suites
    parameter. Returns a dict keyed by suite name / executor, value is tests
    to run under that executor.
    """
    test_membership = create_test_membership_map(test_kind=SUPPORTED_TEST_KINDS)

    memberships = defaultdict(list)
    for suite in suites:
        LOGGER.debug("Adding tests for suite", suite=suite, tests=suite.tests)
        for test in suite.tests:
            LOGGER.debug("membership for test", test=test, membership=test_membership[test])
            for executor in set(test_membership[test]) - set(exclude_suites):
                if test not in memberships[executor]:
                    memberships[executor].append(test)
    return memberships