Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ datadog = ">=0.51.0,<1.0.0"
wrapt = "^1.11.2"
ddtrace = [
{version = ">=3.19.1,<4", python = ">=3.8,<3.10"},
{version = ">=4.1.1,<5,!=4.6.*,<4.8.0", python = ">=3.10"}
{version = ">=4.1.1,<5,!=4.6.*", python = ">=3.10"}
]
ujson = [
{version = ">=5.10.0,<5.12.0", python = ">=3.8,<3.10"},
Expand Down
5 changes: 3 additions & 2 deletions scripts/run_integration_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,9 @@ for handler_name in "${LAMBDA_HANDLERS[@]}"; do
echo "Writing logs to $function_snapshot_path because no snapshot exists yet"
echo "$logs" >$function_snapshot_path
else
# Compare new logs to snapshots
diff_output=$(echo "$logs" | sort | diff -w - <(sort $function_snapshot_path))
# Compare new logs to snapshots (LC_ALL=C: stable sort; parse-json.js sorts object keys so
# e.g. span meta key order / trailing-comma lines do not vary between runs)
diff_output=$(echo "$logs" | LC_ALL=C sort | diff -w - <(LC_ALL=C sort $function_snapshot_path))
if [ $? -eq 1 ]; then
if [ -n "$UPDATE_SNAPSHOTS" ]; then
# If $UPDATE_SNAPSHOTS is set to true write the new logs over the current snapshot
Expand Down
16 changes: 15 additions & 1 deletion tests/integration/parse-json.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,24 @@ var rl = readline.createInterface({
terminal: false
});

function sortKeys (value) {
if (value === null || typeof value !== 'object') {
return value
}
if (Array.isArray(value)) {
return value.map(sortKeys)
}
var sorted = {}
Object.keys(value).sort().forEach(function (key) {
sorted[key] = sortKeys(value[key])
})
return sorted
}

rl.on('line', function(line){
try {
const obj = JSON.parse(line)
console.log(JSON.stringify(obj, null, 2))
console.log(JSON.stringify(sortKeys(obj), null, 2))
} catch (e) {
console.log(line)
}
Expand Down
Loading
Loading