Beispiel #1
0
    def test_apply_queries_with_multiple_queries(self):
        queries = []
        queries.append("method=test_smoke*")
        queries.append("class=Mock*")
        queries.append("class='MockTINC*'")
        queries.append("module='test_discovery*'")
        queries.append("package = tinc*.test*")
        queries.append("method != test_smoke_02")
        queries.append("class != NonMock*")
        queries.append("package != storage.uao.*")
        queries.append("module != test_regression*")
        queries.append("author = bob")
        queries.append("tags = smoke")
        queries.append("author != alice")
        queries.append("tags != functional")
        handler = TINCDiscoveryQueryHandler(queries)
        tinc_test_case = MockTINCTestCase('test_smoke_01')
        self.assertTrue(handler.apply_queries(tinc_test_case))

        queries = []
        queries.append("method=test_smoke*")
        queries.append("class=Mock*")
        queries.append("class='MockTINC*'")
        queries.append("module='test_discovery*'")
        queries.append("package = storage.uao.*")
        handler = TINCDiscoveryQueryHandler(queries)
        tinc_test_case = MockTINCTestCase('test_smoke_01')
        self.assertFalse(handler.apply_queries(tinc_test_case))
    def test_apply_queries_with_multiple_predicates(self):
        queries = []
        queries.append(
            "method=test_smoke* OR class = Mock* or class = MockTINC*")
        queries.append("package=storage.uao.* OR method=test_smoke*")
        queries.append(
            "package=storage.uao.* and method=*testsmoke* and module!=test_discovery or method=test_smoke_01"
        )
        #queries.append("package != storage.uao or method=*testsmoke* and module != test_discovery and class != Mock* and tags = smoke and author != alice")
        handler = TINCDiscoveryQueryHandler(queries)
        tinc_test_case = MockTINCTestCase('test_smoke_01')
        self.assertTrue(handler.apply_queries(tinc_test_case))

        queries = []
        queries.append(
            "method=test_smoke* OR class = Mock* or class = MockTINC*")
        queries.append("package=storage.uao.* OR method=test_smoke*")
        queries.append(
            "package=storage.uao.* and method=*testsmoke* and module!=test_discovery or method=test_smoke_01"
        )
        queries.append(
            "package != storage.uao or method=*testsmoke* and module != test_discovery and class != Mock*"
        )
        # Introduce false at the end
        queries.append("package != storage and method != test_smoke_01")
        handler = TINCDiscoveryQueryHandler(queries)
        tinc_test_case = MockTINCTestCase('test_smoke_01')
        self.assertFalse(handler.apply_queries(tinc_test_case))
Beispiel #3
0
    def test_apply_queries_with_multiple_predicates(self):
        queries = []
        queries.append("method=test_smoke* OR class = Mock* or class = MockTINC*")
        queries.append("package=storage.uao.* OR method=test_smoke*")
        queries.append("package=storage.uao.* and method=*testsmoke* and module!=test_discovery or method=test_smoke_01")
        #queries.append("package != storage.uao or method=*testsmoke* and module != test_discovery and class != Mock* and tags = smoke and author != alice")
        handler = TINCDiscoveryQueryHandler(queries)
        tinc_test_case = MockTINCTestCase('test_smoke_01')
        self.assertTrue(handler.apply_queries(tinc_test_case))


        queries = []
        queries.append("method=test_smoke* OR class = Mock* or class = MockTINC*")
        queries.append("package=storage.uao.* OR method=test_smoke*")
        queries.append("package=storage.uao.* and method=*testsmoke* and module!=test_discovery or method=test_smoke_01")
        queries.append("package != storage.uao or method=*testsmoke* and module != test_discovery and class != Mock*")
        # Introduce false at the end
        queries.append("package != storage and method != test_smoke_01")
        handler = TINCDiscoveryQueryHandler(queries)
        tinc_test_case = MockTINCTestCase('test_smoke_01')
        self.assertFalse(handler.apply_queries(tinc_test_case))
Beispiel #4
0
    def test_apply_queries_with_single_query(self):
        handler = TINCDiscoveryQueryHandler("method=test_smoke*")
        tinc_test_case = MockTINCTestCase('test_smoke_01')
        self.assertTrue(handler.apply_queries(tinc_test_case))

        # metadata equals predicate
        handler = TINCDiscoveryQueryHandler("author=bob")
        tinc_test_case = MockTINCTestCase('test_smoke_01')
        self.assertTrue(handler.apply_queries(tinc_test_case))

        # metadata equals predicate with dash (typically used for bugs)
        handler = TINCDiscoveryQueryHandler("tags=bug-1")
        tinc_test_case = MockTINCTestCase('test_smoke_01')
        self.assertTrue(handler.apply_queries(tinc_test_case))

        #metadata not equals predicate
        handler = TINCDiscoveryQueryHandler("tags != functional")
        tinc_test_case = MockTINCTestCase('test_smoke_01')
        self.assertTrue(handler.apply_queries(tinc_test_case))

        # metadata non-match

        # metadata equals predicate
        handler = TINCDiscoveryQueryHandler("author=alice")
        tinc_test_case = MockTINCTestCase('test_smoke_01')
        self.assertFalse(handler.apply_queries(tinc_test_case))

        #metadata not equals predicate
        handler = TINCDiscoveryQueryHandler("tags != smoke")
        tinc_test_case = MockTINCTestCase('test_smoke_01')
        self.assertFalse(handler.apply_queries(tinc_test_case))

        # non existing metadata should return False
        handler = TINCDiscoveryQueryHandler("non_existing_tags = smoke")
        # not equals on a non existing metadata will currently return True
        # We will have to decide whether or not to throw an exception for such tests
        tinc_test_case = MockTINCTestCase('test_smoke_01')
        self.assertFalse(handler.apply_queries(tinc_test_case))