Skip to content

Commit 482f724

Browse files
authored
Merge pull request #2811 from brandonpage/fix-nightly-shard-reporting
Fix nightly test result reporting.
2 parents 347388f + a798768 commit 482f724

File tree

3 files changed

+13
-20
lines changed

3 files changed

+13
-20
lines changed

.github/workflows/nightly.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
# Run the native libraries first so that the native, Hybrid and React MobileSync tests
1010
# don't run simultaniously (to prevents flappers).
1111
jobs:
12-
android-nightly-core:
12+
android-nightly:
1313
strategy:
1414
fail-fast: false
1515
matrix:
@@ -20,7 +20,7 @@ jobs:
2020
secrets: inherit
2121
android-nightly-Hybrid:
2222
if: success() || failure()
23-
needs: [android-nightly-core]
23+
needs: [android-nightly]
2424
strategy:
2525
fail-fast: false
2626
matrix:

.github/workflows/reusable-workflow.yaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,13 @@ jobs:
168168
169169
gsutil ls ${BUCKET_PATH} > /dev/null 2>&1
170170
if [ $? == 0 ] ; then
171-
# Copy merged XML file from top level for test reporting
172-
gsutil cp "${BUCKET_PATH}/*test_results_merged.xml" firebase_results/api_${LEVEL}_test_result.xml
171+
# Copy XML file for test reporting
172+
if gsutil ls "${BUCKET_PATH}/*test_results_merged.xml" > /dev/null 2>&1; then
173+
# Sharded runs produce test_results_merged.xml at top level
174+
gsutil cp "${BUCKET_PATH}/*test_results_merged.xml" firebase_results/api_${LEVEL}_test_result.xml
175+
else
176+
gsutil cp "${BUCKET_PATH}/*/test_result_1.xml" firebase_results/api_${LEVEL}_test_result.xml
177+
fi
173178
174179
# Copy all shard data for code coverage (only needed for one level)
175180
if [ "$LEVEL" == "$PR_API_VERSION" ] ; then

libs/test/SalesforceSDKTest/src/com/salesforce/androidsdk/auth/LoginViewModelMockTest.kt

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ class LoginViewModelMockTest {
7373
mockCookieManager = mockk<CookieManager>(relaxed = true)
7474
every { CookieManager.getInstance() } returns mockCookieManager
7575

76+
// Mock OAuth2 and AuthenticationUtilities
77+
mockkStatic(OAuth2::class)
78+
mockkStatic("com.salesforce.androidsdk.auth.AuthenticationUtilitiesKt")
79+
7680
// Create view model after mocking
7781
viewModel = LoginViewModel(bootConfig)
7882

@@ -94,7 +98,6 @@ class LoginViewModelMockTest {
9498
@Test
9599
fun onAuthFlowComplete_CallsAuthenticationUtilities_WithCorrectParameters() = runBlocking {
96100
// Mock the AuthenticationUtilities.onAuthFlowComplete function
97-
mockkStatic("com.salesforce.androidsdk.auth.AuthenticationUtilitiesKt")
98101

99102
// Mock the function to do nothing (just capture parameters)
100103
coEvery {
@@ -163,7 +166,6 @@ class LoginViewModelMockTest {
163166
@Test
164167
fun onAuthFlowComplete_CallsAuthenticationUtilitiesSuccessfully() = runBlocking {
165168
// Mock the AuthenticationUtilities.onAuthFlowComplete function
166-
mockkStatic("com.salesforce.androidsdk.auth.AuthenticationUtilitiesKt")
167169

168170
coEvery {
169171
onAuthFlowComplete(
@@ -230,7 +232,6 @@ class LoginViewModelMockTest {
230232
@Test
231233
fun onAuthFlowComplete_ResetsAuthCodeForJwtFlow() = runBlocking {
232234
// Mock the AuthenticationUtilities.onAuthFlowComplete function
233-
mockkStatic("com.salesforce.androidsdk.auth.AuthenticationUtilitiesKt")
234235

235236
coEvery {
236237
onAuthFlowComplete(
@@ -278,7 +279,6 @@ class LoginViewModelMockTest {
278279
@Test
279280
fun onAuthFlowComplete_UsesEmptyString_WhenSelectedServerIsNull() = runBlocking {
280281
// Mock the AuthenticationUtilities.onAuthFlowComplete function
281-
mockkStatic("com.salesforce.androidsdk.auth.AuthenticationUtilitiesKt")
282282

283283
coEvery {
284284
onAuthFlowComplete(
@@ -343,17 +343,13 @@ class LoginViewModelMockTest {
343343

344344
@Test
345345
fun doCodeExchange_CallsExchangeCode_WithCorrectParameters() = runBlocking {
346-
// Mock OAuth2.exchangeCode
347-
mockkStatic(OAuth2::class)
348-
349346
val testServer = "https://test.salesforce.com"
350347
val testCode = "test_auth_code_123"
351348
val mockTokenResponse = mockk<TokenEndpointResponse>(relaxed = true)
352349
val mockOnError: (String, String?, Throwable?) -> Unit = mockk(relaxed = true)
353350
val mockOnSuccess: (UserAccount) -> Unit = mockk(relaxed = true)
354351

355352
// Mock AuthenticationUtilities.onAuthFlowComplete to prevent actual execution
356-
mockkStatic("com.salesforce.androidsdk.auth.AuthenticationUtilitiesKt")
357353
coEvery {
358354
onAuthFlowComplete(
359355
tokenResponse = any(),
@@ -408,9 +404,6 @@ class LoginViewModelMockTest {
408404

409405
@Test
410406
fun doCodeExchange_WithFrontDoorBridge_UsesCorrectServerAndVerifier() = runBlocking {
411-
// Mock OAuth2.exchangeCode
412-
mockkStatic(OAuth2::class)
413-
414407
val frontDoorServer = "https://frontdoor.salesforce.com"
415408
val frontDoorUrl = "$frontDoorServer/frontdoor.jsp?sid=test_session"
416409
val frontDoorVerifier = "frontdoor_verifier_789"
@@ -420,7 +413,6 @@ class LoginViewModelMockTest {
420413
val mockOnSuccess: (UserAccount) -> Unit = mockk(relaxed = true)
421414

422415
// Mock AuthenticationUtilities.onAuthFlowComplete
423-
mockkStatic("com.salesforce.androidsdk.auth.AuthenticationUtilitiesKt")
424416
coEvery {
425417
onAuthFlowComplete(
426418
tokenResponse = any(),
@@ -482,16 +474,12 @@ class LoginViewModelMockTest {
482474

483475
@Test
484476
fun doCodeExchange_WithNullCode_PassesNullToExchangeCode() = runBlocking {
485-
// Mock OAuth2.exchangeCode
486-
mockkStatic(OAuth2::class)
487-
488477
val testServer = "https://test.salesforce.com"
489478
val mockTokenResponse = mockk<TokenEndpointResponse>(relaxed = true)
490479
val mockOnError: (String, String?, Throwable?) -> Unit = mockk(relaxed = true)
491480
val mockOnSuccess: (UserAccount) -> Unit = mockk(relaxed = true)
492481

493482
// Mock AuthenticationUtilities.onAuthFlowComplete
494-
mockkStatic("com.salesforce.androidsdk.auth.AuthenticationUtilitiesKt")
495483
coEvery {
496484
onAuthFlowComplete(
497485
tokenResponse = any(),

0 commit comments

Comments
 (0)