Skip to content

Commit

Permalink
finalise error correlation tests (#119)
Browse files Browse the repository at this point in the history
  • Loading branch information
richardelms authored Sep 24, 2024
1 parent 817c308 commit 6367788
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 63 deletions.
6 changes: 3 additions & 3 deletions .buildkite/pipeline.full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ steps:
- features/fixtures/mazerunner/build/Windows-2020.zip
- features/fixtures/build_windows.log
commands:
- features/scripts/import_package.sh
- features/scripts/import_package.sh --windows
- features/scripts/build_windows.sh release
retry:
automatic:
Expand Down Expand Up @@ -141,7 +141,7 @@ steps:
- features/fixtures/mazerunner/build/Windows-2022.zip
- features/fixtures/build_windows.log
commands:
- features/scripts/import_package.sh
- features/scripts/import_package.sh --windows
- features/scripts/build_windows.sh release
retry:
automatic:
Expand Down Expand Up @@ -464,7 +464,7 @@ steps:
- features/fixtures/mazerunner/build/Windows-dev-2021.zip
- features/fixtures/build_windows.log
commands:
- features/scripts/import_package.sh
- features/scripts/import_package.sh --windows
- features/scripts/build_windows.sh dev
retry:
automatic:
Expand Down
2 changes: 1 addition & 1 deletion .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ steps:
- features/fixtures/mazerunner/build/Windows-2021.zip
- features/fixtures/build_windows.log
commands:
- features/scripts/import_package.sh
- features/scripts/import_package.sh --windows
- features/scripts/build_windows.sh release
retry:
automatic:
Expand Down
12 changes: 6 additions & 6 deletions features/correlation.feature
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ Feature: Manual creation of spans
* the trace payload field "resourceSpans.0.scopeSpans.0.spans.0.spanId" is stored as the value "context_span_id"
* the trace payload field "resourceSpans.0.scopeSpans.0.spans.0.traceId" is stored as the value "context_trace_id"

* the error payload field "events.0.correlation.spanid" equals the stored value "context_span_id"
* the error payload field "events.0.correlation.traceid" equals the stored value "context_trace_id"
* the error payload field "events.0.correlation.spanId" equals the stored value "context_span_id"
* the error payload field "events.0.correlation.traceId" equals the stored value "context_trace_id"


Scenario: Correlation Should be null
Expand Down Expand Up @@ -45,15 +45,15 @@ Feature: Manual creation of spans
* I sort the errors by the payload field "events.0.exceptions.0.message"

* the exception "message" equals "Event From Background Thread"
* the error payload field "events.0.correlation.spanid" equals the stored value "background_span_id"
* the error payload field "events.0.correlation.traceid" equals the stored value "background_trace_id"
* the error payload field "events.0.correlation.spanId" equals the stored value "background_span_id"
* the error payload field "events.0.correlation.traceId" equals the stored value "background_trace_id"


And I discard the oldest error

* the exception "message" equals "Event From Main Thread"
* the error payload field "events.0.correlation.spanid" equals the stored value "main_span_id"
* the error payload field "events.0.correlation.traceid" equals the stored value "main_trace_id"
* the error payload field "events.0.correlation.spanId" equals the stored value "main_span_id"
* the error payload field "events.0.correlation.traceId" equals the stored value "main_trace_id"



45 changes: 0 additions & 45 deletions features/fixtures/mazerunner/Packages/manifest.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -768,11 +768,15 @@ PlayerSettings:
webGLThreadsSupport: 0
webGLDecompressionFallback: 0
scriptingDefineSymbols:
0: BUGSNAG_PERFORMANCE
1: BUGSNAG_PERFORMANCE;BUGSNAG_DEBUG
4: BUGSNAG_PERFORMANCE;BUGSNAG_DEBUG
7: BUGSNAG_PERFORMANCE;BUGSNAG_DEBUG
13: BUGSNAG_PERFORMANCE;BUGSNAG_DEBUG
0: BUGSNAG_PERFORMANCE;BUGSNAG_DEBUG;BUGSNAG_UNITY_WEB_REQUEST
1: BUGSNAG_PERFORMANCE;BUGSNAG_DEBUG;BUGSNAG_UNITY_WEB_REQUEST
13: BUGSNAG_PERFORMANCE;BUGSNAG_DEBUG;BUGSNAG_UNITY_WEB_REQUEST
4: BUGSNAG_PERFORMANCE;BUGSNAG_DEBUG;BUGSNAG_UNITY_WEB_REQUEST
7: BUGSNAG_PERFORMANCE;BUGSNAG_DEBUG;BUGSNAG_UNITY_WEB_REQUEST
Android: BUGSNAG_PERFORMANCE;BUGSNAG_DEBUG;BUGSNAG_UNITY_WEB_REQUEST
Standalone: BUGSNAG_PERFORMANCE;BUGSNAG_DEBUG;BUGSNAG_UNITY_WEB_REQUEST
WebGL: BUGSNAG_PERFORMANCE;BUGSNAG_DEBUG;BUGSNAG_UNITY_WEB_REQUEST
iPhone: BUGSNAG_PERFORMANCE;BUGSNAG_DEBUG;BUGSNAG_UNITY_WEB_REQUEST
additionalCompilerArguments: {}
platformArchitecture: {}
scriptingBackend:
Expand Down
63 changes: 60 additions & 3 deletions features/scripts/import_package.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,68 @@
#!/usr/bin/env bash

root_path=`pwd`
if [ -z "$UNITY_PERFORMANCE_VERSION" ]; then
echo "UNITY_PERFORMANCE_VERSION must be set"
exit 1
fi

destination="features/fixtures/mazerunner/Packages"
# Parse arguments
BUILD_WINDOWS=false
while [[ "$#" -gt 0 ]]; do
case $1 in
--windows) BUILD_WINDOWS=true ;;
*) echo "Unknown option: $1" ;;
esac
shift
done

# Set Unity path based on the platform
if [ "$BUILD_WINDOWS" = true ]; then
UNITY_PATH="/mnt/c/Program Files/Unity/Hub/Editor/$UNITY_PERFORMANCE_VERSION/Editor/Unity.exe"
PACKAGE_DOWNLOAD_PATH="features/fixtures/mazerunner/Bugsnag.unitypackage"
else
UNITY_PATH="/Applications/Unity/Hub/Editor/$UNITY_PERFORMANCE_VERSION/Unity.app/Contents/MacOS/Unity"
PACKAGE_DOWNLOAD_PATH="features/fixtures/mazerunner/Bugsnag.unitypackage"
fi

FIXTURE_PATH="features/fixtures/mazerunner"
DEFAULT_CLI_ARGS="-batchmode -nographics -quit"
BUGSNAG_RELEASE_URL="https://github.com/bugsnag/bugsnag-unity/releases/latest/download/Bugsnag.unitypackage"

# Download the latest Bugsnag Unity package if it doesn't exist or override it
echo "Downloading Bugsnag.unitypackage from $BUGSNAG_RELEASE_URL"
curl -L "$BUGSNAG_RELEASE_URL" -o "$PACKAGE_DOWNLOAD_PATH"
RESULT=$?
if [ $RESULT -ne 0 ]; then
echo "Failed to download Bugsnag.unitypackage"
exit $RESULT
fi

# Check if Unity path exists
if [ ! -f "$UNITY_PATH" ]; then
echo "Unity executable not found at $UNITY_PATH"
exit 1
fi

# Importing the Bugsnag package into Unity project
echo "Importing Bugsnag.unitypackage into $FIXTURE_PATH"
"$UNITY_PATH" $DEFAULT_CLI_ARGS \
-projectPath $FIXTURE_PATH \
-ignoreCompilerErrors \
-importPackage "Bugsnag.unitypackage"
RESULT=$?
if [ $RESULT -ne 0 ]; then
echo "Failed to import Bugsnag.unitypackage"
exit $RESULT
fi

echo "Bugsnag package imported successfully"

# Proceed with unzipping the main package
root_path=$(pwd)
destination="features/fixtures/mazerunner/Packages"
package="$root_path/upm-package.zip"

rm -rf "$destination/package"

unzip -q "$package" -d "$destination"

echo "Package unzipped successfully"

0 comments on commit 6367788

Please sign in to comment.