Skip to content

Commit

Permalink
revert test removal
Browse files Browse the repository at this point in the history
  • Loading branch information
mabdinur committed Jan 16, 2025
1 parent 837afa9 commit bc8efa5
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions tests/tracer/test_filters.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,43 @@
from unittest import TestCase

import pytest

from ddtrace._trace.filters import FilterRequestsOnUrl
from ddtrace._trace.span import Span
from ddtrace.ext.http import URL
from ddtrace.trace import TraceFilter


class FilterRequestOnUrlTests(TestCase):
def test_is_match(self):
span = Span(name="Name")
span.set_tag(URL, r"http://example.com")
filtr = FilterRequestsOnUrl("http://examp.*.com")
trace = filtr.process_trace([span])
self.assertIsNone(trace)

def test_is_not_match(self):
span = Span(name="Name")
span.set_tag(URL, r"http://anotherexample.com")
filtr = FilterRequestsOnUrl("http://examp.*.com")
trace = filtr.process_trace([span])
self.assertIsNotNone(trace)

def test_list_match(self):
span = Span(name="Name")
span.set_tag(URL, r"http://anotherdomain.example.com")
filtr = FilterRequestsOnUrl([r"http://domain\.example\.com", r"http://anotherdomain\.example\.com"])
trace = filtr.process_trace([span])
self.assertIsNone(trace)

def test_list_no_match(self):
span = Span(name="Name")
span.set_tag(URL, r"http://cooldomain.example.com")
filtr = FilterRequestsOnUrl([r"http://domain\.example\.com", r"http://anotherdomain\.example\.com"])
trace = filtr.process_trace([span])
self.assertIsNotNone(trace)


def test_not_implemented_trace_filter():
class Filter(TraceFilter):
pass
Expand Down

0 comments on commit bc8efa5

Please sign in to comment.