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

Nuke Android/Unity apk flaky tests #437

Merged
merged 64 commits into from
Dec 1, 2021
Merged
Show file tree
Hide file tree
Changes from 60 commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
619b2e3
Add more information in regard to Smoke test.
lucas-zimerman Nov 29, 2021
45993e1
Add local test
lucas-zimerman Nov 29, 2021
67319bb
Skip download step
lucas-zimerman Nov 29, 2021
d9baa89
Add timeout to snapshot and add extra delay if adb failed to initialize
lucas-zimerman Nov 29, 2021
1d80701
WIP
lucas-zimerman Nov 29, 2021
6b046e4
WIP
lucas-zimerman Nov 29, 2021
2b59b72
Change retry check
lucas-zimerman Nov 29, 2021
ec4d246
Why emulators are flaky :C
lucas-zimerman Nov 29, 2021
a2fd4f6
Validate failed smoke test
lucas-zimerman Nov 29, 2021
94f0147
Invert tag
lucas-zimerman Nov 29, 2021
6872249
WIP
lucas-zimerman Nov 29, 2021
a5ce4da
WIP
lucas-zimerman Nov 29, 2021
123d8d5
WIP
lucas-zimerman Nov 29, 2021
4255f84
WIP
lucas-zimerman Nov 29, 2021
c2c2823
WIP
lucas-zimerman Nov 29, 2021
9d9abaf
WIP
lucas-zimerman Nov 29, 2021
520482c
WIP
lucas-zimerman Nov 29, 2021
cb2ff00
WIP
lucas-zimerman Nov 29, 2021
fff2f7b
Change if syntax
lucas-zimerman Nov 29, 2021
119ac4a
WIP
lucas-zimerman Nov 29, 2021
fc35019
WIP
lucas-zimerman Nov 29, 2021
af796f4
Fix output variable
lucas-zimerman Nov 29, 2021
6830312
WIP
lucas-zimerman Nov 29, 2021
c0cf5b8
Final error flow
lucas-zimerman Nov 29, 2021
6d797a4
Remove exception test and fix snapshot Retry
lucas-zimerman Nov 29, 2021
e709732
Fix if condition
lucas-zimerman Nov 29, 2021
3568b0d
Add missing id
lucas-zimerman Nov 29, 2021
ec4a432
Fix error case
lucas-zimerman Nov 29, 2021
1f3417e
Take 2 fix throw error case
lucas-zimerman Nov 29, 2021
477b857
Test
lucas-zimerman Nov 29, 2021
111cd40
Test
lucas-zimerman Nov 29, 2021
797e374
Test
lucas-zimerman Nov 29, 2021
5725b45
Test
lucas-zimerman Nov 29, 2021
37c68a7
Another Test
lucas-zimerman Nov 29, 2021
c28457d
Another Test
lucas-zimerman Nov 29, 2021
9fedf1e
Another Test
lucas-zimerman Nov 30, 2021
2dee678
Limit android test Jobs
lucas-zimerman Nov 30, 2021
80bbf13
Add code for closing system events
lucas-zimerman Nov 30, 2021
7cb14b2
Increased parallel runs and add code to remove previous lock if found
lucas-zimerman Nov 30, 2021
027622a
Remove flaky check and disabled snapshots
lucas-zimerman Nov 30, 2021
e7f8e5a
Temporary logcat for all devices
lucas-zimerman Nov 30, 2021
76e1e5f
64 bits emulator and kill emulator on failure
lucas-zimerman Nov 30, 2021
70d2ee2
also apply changes for droid 30
lucas-zimerman Nov 30, 2021
1807c62
Removed cache
lucas-zimerman Nov 30, 2021
73516fe
Rollback to x86
lucas-zimerman Nov 30, 2021
302d498
Test refactor
lucas-zimerman Nov 30, 2021
0ea7a99
Test refactor
lucas-zimerman Nov 30, 2021
3e7c7d8
Test: Flaky emulators should not Fail the test
lucas-zimerman Nov 30, 2021
4aa07ee
Ajust emulator kill
lucas-zimerman Nov 30, 2021
53bf260
Test: 1st Smoke test fails, should fail the test
lucas-zimerman Nov 30, 2021
bc7329b
Test: 1st step fails to setup emulator, second fails smoke test, shou…
lucas-zimerman Nov 30, 2021
fc0c33e
Test: happy path should pass the tests
lucas-zimerman Nov 30, 2021
a7efa4a
Test: Disable sentry
lucas-zimerman Dec 1, 2021
acb9815
set output from powershell test
lucas-zimerman Dec 1, 2021
c68fd91
Error flow refactor for flaky tests
lucas-zimerman Dec 1, 2021
c3c05dc
Fix variable name
lucas-zimerman Dec 1, 2021
6ce3725
Test cleanup
lucas-zimerman Dec 1, 2021
f65f3fa
Prepare for GH Pull request
lucas-zimerman Dec 1, 2021
5441d36
Smoketest cleanup
lucas-zimerman Dec 1, 2021
0febc24
Remove additional spaces
lucas-zimerman Dec 1, 2021
3872d82
Requested changes
lucas-zimerman Dec 1, 2021
f7a98fc
Fix conflict
lucas-zimerman Dec 1, 2021
5fcbf4f
Fix conflict
lucas-zimerman Dec 1, 2021
f68cf6e
Add missing download app
lucas-zimerman Dec 1, 2021
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
119 changes: 83 additions & 36 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -246,38 +246,62 @@ jobs:
name: Smoke Test - Android ${{ matrix.api-level }} Unity ${{ matrix.unity-version }}
runs-on: macos-latest
strategy:
max-parallel: 5
fail-fast: false
matrix:
api-level: [21, 22, 23, 24, 25, 26, 27, 28, 29]
api-level: [21, 27, 29]
avd-target: [default]
unity-version: [2019.4.31f1, 2020.3.21f1, 2021.1.26f1]
steps:
- name: Checkout
uses: actions/checkout@v2.3.3

- name: Download test app artifact
uses: actions/download-artifact@v2
with:
name: droid-testapp-${{ matrix.unity-version }}
path: samples/artifacts/builds/Android

- name: AVD cache
uses: actions/cache@v2
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ matrix.api-level }}-${{ matrix.unity-version }}

- name: Smoke test
id: smoke-test
continue-on-error: true
timeout-minutes: 10
uses: reactivecircus/android-emulator-runner@2b2ebf2e518e38a17180117fc2b677006db27330
with:
api-level: ${{ matrix.api-level }}
target: ${{ matrix.avd-target }}
force-avd-creation: false
ram-size: 2048M
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
arch: x86
cores: 2
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: false
script: pwsh ./scripts/smoke-test-droid.ps1
script: sudo pwsh ./scripts/smoke-test-droid.ps1

- name: Kill emulator if AVD failed.
continue-on-error: true
if: ${{ steps.smoke-test.outputs.smoke-status != 'Completed' }}
run: |
adb emu kill
sleep 7

- name: Smoke test (Retry)
id: smoke-test-retry
continue-on-error: true
timeout-minutes: 10
# We only want to retry the tests if the previous fail happened on the emulator startup.
if: ${{ steps.smoke-test.outputs.smoke-status != 'Completed' }}
uses: reactivecircus/android-emulator-runner@2b2ebf2e518e38a17180117fc2b677006db27330
with:
api-level: ${{ matrix.api-level }}
target: ${{ matrix.avd-target }}
ram-size: 2048M
cores: 2
arch: x86
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: false
script: sudo pwsh ./scripts/smoke-test-droid.ps1

- name: Throw error if Smoke test failed
# We want to throw an error if the smoke test failed.
# We will ignore flaky errors from the emulator setup.
if: ${{ (steps.smoke-test.outcome != 'success' && steps.smoke-test.outputs.smoke-status == 'Completed') || (steps.smoke-test-retry.outcome != 'success' && steps.smoke-test-retry.outputs.smoke-status == 'Completed') }}
run: exit -1

- name: Upload screenshot if smoke test failed
if: ${{ failure() }}
Expand All @@ -291,40 +315,63 @@ jobs:
name: Smoke Test - Android ${{ matrix.api-level }} Unity ${{ matrix.unity-version }}
runs-on: macos-latest
strategy:
max-parallel: 2
fail-fast: false
matrix:
api-level: [30]
avd-target: [google_apis]
#api-level 30 image is only available with google services.
unity-version: [2019.4.31f1, 2020.3.21f1, 2021.1.26f1]
steps:
- name: Checkout
uses: actions/checkout@v2.3.3

- name: Download test app artifact
uses: actions/download-artifact@v2
with:
name: droid-testapp-${{ matrix.unity-version }}
path: samples/artifacts/builds/Android

- name: AVD cache
uses: actions/cache@v2
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ matrix.api-level }}-${{ matrix.unity-version }}-gservices

- name: Smoke test
id: smoke-test
continue-on-error: true
timeout-minutes: 10
uses: reactivecircus/android-emulator-runner@2b2ebf2e518e38a17180117fc2b677006db27330
with:
api-level: ${{ matrix.api-level }}
target: google_apis
target: ${{ matrix.avd-target }}
force-avd-creation: false
ram-size: 2048M
arch: x86
cores: 2
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: false
script: sudo pwsh ./scripts/smoke-test-droid.ps1

- name: Kill emulator if AVD failed.
continue-on-error: true
if: ${{ steps.smoke-test.outputs.smoke-status != 'Completed' }}
run: |
adb emu kill
sleep 7

- name: Smoke test (Retry)
id: smoke-test-retry
continue-on-error: true
timeout-minutes: 10
# We only want to retry the tests if the previous fail happened on the emulator startup.
if: ${{ steps.smoke-test.outputs.smoke-status != 'Completed' }}
uses: reactivecircus/android-emulator-runner@2b2ebf2e518e38a17180117fc2b677006db27330
with:
api-level: ${{ matrix.api-level }}
target: ${{ matrix.avd-target }}
ram-size: 2048M
cores: 2
arch: x86
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: false
script: pwsh ./scripts/smoke-test-droid.ps1
script: sudo pwsh ./scripts/smoke-test-droid.ps1

- name: Throw error if Smoke test failed
# We want to throw an error if the smoke test failed.
# We will ignore flaky errors from the emulator setup.
if: ${{ (steps.smoke-test.outcome != 'success' && steps.smoke-test.outputs.smoke-status == 'Completed') || (steps.smoke-test-retry.outcome != 'success' && steps.smoke-test-retry.outputs.smoke-status == 'Completed') }}
run: exit -1

- name: Upload screenshot if smoke test failed
if: ${{ failure() }}
Expand Down
81 changes: 0 additions & 81 deletions package-dev/Plugins/iOS/Device/Sentry.framework.meta

This file was deleted.

81 changes: 0 additions & 81 deletions package-dev/Plugins/iOS/Simulator/Sentry.framework.meta

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ MonoBehaviour:
m_Script: {fileID: -668357930, guid: 43ec428a58422470fa764bdba9d9bc19, type: 3}
m_Name: SentryOptions
m_EditorClassIdentifier:
<Enabled>k__BackingField: 1
<Enabled>k__BackingField: 0
lucas-zimerman marked this conversation as resolved.
Show resolved Hide resolved
<Dsn>k__BackingField: https://94677106febe46b88b9b9ae5efd18a00@o447951.ingest.sentry.io/5439417
<CaptureInEditor>k__BackingField: 1
<EnableLogDebouncing>k__BackingField: 0
Expand Down
19 changes: 18 additions & 1 deletion samples/unity-of-bugs/Assets/Scripts/SmokeTester.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if !UNITY_EDITOR
#if !UNITY_EDITOR
#if UNITY_IOS
#define SENTRY_NATIVE_IOS
#elif UNITY_ANDROID
Expand Down Expand Up @@ -53,11 +53,15 @@ public void Start()

public static void SmokeTest()
{
try
{
Debug.Log("SMOKE TEST: START");
bruno-garcia marked this conversation as resolved.
Show resolved Hide resolved
var evt = new ManualResetEventSlim();

var requests = new List<string>();
void Verify(HttpRequestMessage message)
{
Debug.Log("SMOKE TEST: Verify invoked.");
requests.Add(message.Content.ReadAsStringAsync().Result);
evt.Set();
}
Expand All @@ -71,13 +75,18 @@ void Verify(HttpRequestMessage message)
options.CreateHttpClientHandler = () => new TestHandler(Verify);

#if SENTRY_NATIVE_IOS
Debug.Log("SMOKE TEST: Configure Native iOS.");
SentryNativeIos.Configure(options);
#elif SENTRY_NATIVE_ANDROID
Debug.Log("SMOKE TEST: Configure Native Android.");
SentryNativeAndroid.Configure(options);
#endif

Debug.Log("SMOKE TEST: SentryUnity Init.");
SentryUnity.Init(options);

Debug.Log("SMOKE TEST: SentryUnity Init OK.");

var guid = Guid.NewGuid().ToString();
Debug.LogError(guid);
SentrySdk.CaptureMessage(guid);
Expand All @@ -99,6 +108,14 @@ void Verify(HttpRequestMessage message)

// Test passed: Exit Code 200 to avoid false positive from a graceful exit unrelated to this test run
Application.Quit(200);

}
catch (Exception ex)
{
Debug.Log("SMOKE TEST: FAILED");
Debug.LogError(ex);
Application.Quit(-1);
}
}

private class TestHandler : HttpClientHandler
Expand Down
Loading