-
Notifications
You must be signed in to change notification settings - Fork 14
[Debugger] Symdb tests #3761
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
Merged
Merged
[Debugger] Symdb tests #3761
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
518512b
symdb tests
ojung 15b5a08
fix test the test
shurivich 8225ee2
format + yml
shurivich a952670
update expected
shurivich 5e8e0df
remove redundant env
shurivich 19ccc58
format
shurivich bc89477
schema + re-use rc methods
shurivich 4da86a3
format
shurivich 1e29102
Merge branch 'main' into shurivich/symdb
cbeauchesne e9b78c4
always consider data inside /symdb/v1/input as json
cbeauchesne b138673
validate schema
shurivich d59d519
mark dotnet as bug
shurivich 1fd4f27
remove express4-typescript: v5.32.0
shurivich 3da9e91
fix schema validations
shurivich b41cbf0
format
shurivich f46005b
in instead of ==
shurivich File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Unless explicitly stated otherwise all files in this repository are licensed under the the Apache License Version 2.0. | ||
# This product includes software developed at Datadog (https://www.datadoghq.com/). | ||
# Copyright 2021 Datadog, Inc. | ||
|
||
import json | ||
import tests.debugger.utils as debugger | ||
from utils import features, scenarios, bug, context | ||
from utils import remote_config as rc | ||
|
||
|
||
@features.debugger | ||
@scenarios.debugger_symdb | ||
class Test_Debugger_SymDb(debugger._Base_Debugger_Test): | ||
############ setup ############ | ||
def _setup(self): | ||
self.rc_state = rc.send_symdb_command() | ||
|
||
############ assert ############ | ||
def _assert(self): | ||
self.collect() | ||
self.assert_rc_state_not_error() | ||
self._assert_symbols_uploaded() | ||
|
||
def _assert_symbols_uploaded(self): | ||
assert len(self.symbols) > 0, "No symbol files were found" | ||
|
||
errors = [] | ||
for symbol in self.symbols: | ||
error = symbol.get("system-tests-error") | ||
if error is not None: | ||
errors.append( | ||
f"Error is: {error}, exported to file: {symbol.get('system-tests-file-path', 'No file path')}" | ||
) | ||
|
||
assert not errors, "Found system-tests-errors:\n" + "\n".join(f"- {err}" for err in errors) | ||
|
||
############ test ############ | ||
def setup_symdb_upload(self): | ||
self._setup() | ||
|
||
@bug(context.library == "dotnet", reason="DEBUG-3298") | ||
def test_symdb_upload(self): | ||
self._assert() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,8 @@ | |
import os | ||
import os.path | ||
import uuid | ||
import gzip | ||
import io | ||
|
||
from utils import interfaces, remote_config, weblog, context | ||
from utils.tools import logger | ||
|
@@ -17,6 +19,7 @@ | |
_DEBUGGER_PATH = "/api/v2/debugger" | ||
_LOGS_PATH = "/api/v2/logs" | ||
_TRACES_PATH = "/api/v0.2/traces" | ||
_SYMBOLS_PATH = "/symdb/v1/input" | ||
|
||
_CUR_DIR = os.path.dirname(os.path.abspath(__file__)) | ||
|
||
|
@@ -65,6 +68,7 @@ class _Base_Debugger_Test: | |
probe_diagnostics = {} | ||
probe_snapshots = {} | ||
probe_spans = {} | ||
symbols = [] | ||
|
||
rc_state = None | ||
weblog_responses = [] | ||
|
@@ -261,6 +265,7 @@ def collect(self): | |
self._collect_probe_diagnostics() | ||
self._collect_snapshots() | ||
self._collect_spans() | ||
self._collect_symbols() | ||
|
||
def _collect_probe_diagnostics(self): | ||
def _read_data(): | ||
|
@@ -384,6 +389,22 @@ def _get_spans_hash(self): | |
|
||
self.probe_spans = _get_spans_hash(self) | ||
|
||
def _collect_symbols(self): | ||
def _get_symbols(): | ||
result = [] | ||
raw_data = list(interfaces.library.get_data(_SYMBOLS_PATH)) | ||
|
||
for data in raw_data: | ||
if isinstance(data, dict) and "request" in data: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If my not wrong, data is always a dict, and request will always be in data. |
||
contents = data["request"].get("content", []) | ||
for content in contents: | ||
if isinstance(content, dict) and "system-tests-filename" in content: | ||
result.append(content) | ||
|
||
return result | ||
|
||
self.symbols = _get_symbols() | ||
|
||
def get_tracer(self): | ||
if not _Base_Debugger_Test.tracer: | ||
_Base_Debugger_Test.tracer = { | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this irrelevant and not missing feature?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm, you're right, I aligned with other definitions for this library.
I will fix it in separate PR.