Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Khanayan123/add consistent config system tests #3745

Open
wants to merge 43 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
b0eea10
save changes
khanayan123 Dec 25, 2024
264a755
Add runtime metrics tests
cbeauchesne Dec 13, 2024
252ad46
Add basic deserialization
cbeauchesne Dec 19, 2024
c1d9118
add runtime metrics test
khanayan123 Dec 25, 2024
f53f99c
push changes
khanayan123 Dec 28, 2024
60d2872
fix redordering
khanayan123 Dec 28, 2024
72fd00a
update
khanayan123 Jan 2, 2025
b792106
update
khanayan123 Jan 2, 2025
41dd15a
update
khanayan123 Jan 2, 2025
efa3ef3
update php manifest
khanayan123 Jan 2, 2025
e871399
fix redordering
khanayan123 Jan 2, 2025
d963739
try
khanayan123 Jan 2, 2025
a4d445f
update test
khanayan123 Jan 2, 2025
6cf3b31
update manifest file
khanayan123 Jan 2, 2025
918fbbb
update logger
khanayan123 Jan 2, 2025
bb91710
lint
khanayan123 Jan 2, 2025
78b9e7b
update test
khanayan123 Jan 2, 2025
e954a94
enable 128 bit trace id tests
khanayan123 Jan 3, 2025
6a2057e
update
khanayan123 Jan 6, 2025
bf111d5
add new endpoint logs
khanayan123 Jan 6, 2025
dd4a9c6
format
khanayan123 Jan 6, 2025
3afd035
fix
khanayan123 Jan 6, 2025
7f51151
update implemented version
khanayan123 Jan 6, 2025
f5b4d41
update version
khanayan123 Jan 6, 2025
59c1a37
address feedback
khanayan123 Jan 9, 2025
3429244
refactor
khanayan123 Jan 9, 2025
9f484c5
run lint
khanayan123 Jan 9, 2025
54b89be
update annotations
khanayan123 Jan 9, 2025
2d42831
add jira ticket number
khanayan123 Jan 10, 2025
69a1e60
break apart test_w3c_128_bit_propagation_tid_in_chunk_root test
khanayan123 Jan 10, 2025
0eb65dd
run format
khanayan123 Jan 10, 2025
17b45bd
skip ruby
khanayan123 Jan 10, 2025
6945a62
address feedback
khanayan123 Jan 10, 2025
3d14959
run format
khanayan123 Jan 10, 2025
9ed1223
simplify
khanayan123 Jan 10, 2025
4c75e27
format
khanayan123 Jan 10, 2025
7d68776
add ipv6 tests, wait for generator
khanayan123 Jan 10, 2025
d2e0312
update node test app
khanayan123 Jan 10, 2025
75e4d32
run formatter
khanayan123 Jan 10, 2025
bda76a0
update to skip test for missing_features
khanayan123 Jan 10, 2025
9dfa2a3
run formatter
khanayan123 Jan 10, 2025
6e8f305
fix test app
khanayan123 Jan 10, 2025
c363d24
fix testapp
khanayan123 Jan 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 27 additions & 48 deletions tests/test_config_consistency.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,23 +437,11 @@ def test_log_injection_enabled(self):
assert self.r.status_code == 200
pattern = r'"dd":\{[^}]*\}'
stdout.assert_presence(pattern)
for data in stdout.get_data():
json_string = json.dumps(data)
parsed_data = json.loads(json_string)
message = {}
try:
message = json.loads(parsed_data.get("message"))
except json.JSONDecodeError:
continue
if (
message.get("dd")
and message.get(log_injection_fields[context.library.library]["message"]) == self.message
):
dd = message.get("dd")
required_fields = ["trace_id", "span_id", "service", "version", "env"]
for field in required_fields:
assert field in dd, f"Missing field: {field}"
return
dd = parse_log_injection_message(self.message)
required_fields = ["trace_id", "span_id", "service", "version", "env"]
for field in required_fields:
assert field in dd, f"Missing field: {field}"
return


@rfc("https://docs.google.com/document/d/1kI-gTAKghfcwI7YzKhqRv2ExUstcHqADIWA4-TZ387o/edit#heading=h.8v16cioi7qxp")
Expand Down Expand Up @@ -484,22 +472,9 @@ def test_log_injection_128bit_traceid_default(self):
assert self.r.status_code == 200
pattern = r'"dd":\{[^}]*\}'
stdout.assert_presence(pattern)
for data in stdout.get_data():
json_string = json.dumps(data)
parsed_data = json.loads(json_string)
message = {}
try:
message = json.loads(parsed_data.get("message"))
except json.JSONDecodeError:
continue
if (
message.get("dd")
and message.get(log_injection_fields[context.library.library]["message"]) == self.message
):
dd = message.get("dd")
trace_id = dd.get("trace_id")
assert re.match(r"^[0-9a-f]{32}$", trace_id), f"Invalid 128-bit trace_id: {trace_id}"

dd = parse_log_injection_message(self.message)
trace_id = dd.get("trace_id")
assert re.match(r"^[0-9a-f]{32}$", trace_id), f"Invalid 128-bit trace_id: {trace_id}"

@rfc("https://docs.google.com/document/d/1kI-gTAKghfcwI7YzKhqRv2ExUstcHqADIWA4-TZ387o/edit#heading=h.8v16cioi7qxp")
@scenarios.tracing_config_nondefault_3
Expand All @@ -513,21 +488,9 @@ def test_log_injection_128bit_traceid_disabled(self):
assert self.r.status_code == 200
pattern = r'"dd":\{[^}]*\}'
stdout.assert_presence(pattern)
for data in stdout.get_data():
json_string = json.dumps(data)
parsed_data = json.loads(json_string)
message = {}
try:
message = json.loads(parsed_data.get("message"))
except json.JSONDecodeError:
continue
if (
message.get("dd")
and message.get(log_injection_fields[context.library.library]["message"]) == self.message
):
dd = message.get("dd")
trace_id = dd.get("trace_id")
assert re.match(r"\d+", trace_id), f"Invalid 64-bit trace_id: {trace_id}"
dd = parse_log_injection_message(self.message)
trace_id = dd.get("trace_id")
assert re.match(r"\d+", trace_id), f"Invalid 64-bit trace_id: {trace_id}"


@rfc("https://docs.google.com/document/d/1kI-gTAKghfcwI7YzKhqRv2ExUstcHqADIWA4-TZ387o/edit#heading=h.8v16cioi7qxp")
Expand All @@ -554,3 +517,19 @@ class Test_Config_RuntimeMetrics_Default:
def test_config_runtimemetrics_default(self):
data = list(interfaces.library.get_data("/dogstatsd/v2/proxy"))
assert len(data) == 0

def parse_log_injection_message(log_message):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you document a little bit the object of this function?

for data in stdout.get_data():
json_string = json.dumps(data)
parsed_data = json.loads(json_string)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get the purpose of those two line 🤔

message = {}
try:
message = json.loads(parsed_data.get("message"))
except json.JSONDecodeError:
continue
if (
message.get("dd")
and message.get(log_injection_fields[context.library.library]["message"]) == log_message
):
dd = message.get("dd")
return dd