def test_attribute_check_works(self): api_check = APICompatibilityCheckMixin() setattr(api_check, 'tracer', lambda: Tracer()) # no-op tracer does not store attributes, so the test with default # value of `check_trace_attribute_values()` should fail. with self.assertRaises(AssertionError): api_check.test_trace_attributes()
def test_baggage_check_works(self): api_check = APICompatibilityCheckMixin() setattr(api_check, 'tracer', lambda: Tracer()) # no-op tracer does not store baggage, so the test with default # value of `check_baggage_values()` should fail. with self.assertRaises(AssertionError): api_check.test_span_baggage() # second check that assert on empty baggage will fail too with self.assertRaises(AssertionError): api_check.test_context_baggage()
def test_default_baggage_check_mode(self): api_check = APICompatibilityCheckMixin() assert api_check.check_baggage_values() is True
def test_tracer_exception(self): api_check = APICompatibilityCheckMixin() with self.assertRaises(NotImplementedError): api_check.tracer()
def test_scope_manager_check_works(self): api_check = APICompatibilityCheckMixin() setattr(api_check, 'tracer', lambda: Tracer()) # these tests are expected to succeed api_check.test_start_active_span_ignore_active_span() api_check.test_start_span_propagation_ignore_active_span() # no-op tracer has a no-op ScopeManager implementation, # which means no *actual* propagation is done, # so these tests are expected to work, but asserts to fail with self.assertRaises(AssertionError): api_check.test_start_active_span() with self.assertRaises(AssertionError): api_check.test_start_active_span_parent() with self.assertRaises(AssertionError): api_check.test_start_span_propagation() with self.assertRaises(AssertionError): api_check.test_tracer_start_active_span_scope() with self.assertRaises(AssertionError): api_check.test_tracer_start_span_scope() with self.assertRaises(AssertionError): api_check.test_start_active_span_finish_on_close()
def test_default_scope_manager_check_mode(self): api_check = APICompatibilityCheckMixin() assert api_check.check_scope_manager() is True
def test_default_trace_attribute_check_mode(self): api_check = APICompatibilityCheckMixin() assert api_check.check_trace_attribute_values() is True