Skip to content

test(android): pin SvgIconCacheTest to Robolectric SDK 28 - #723

Merged
dcalhoun merged 1 commit into
trunkfrom
fix/svg-icon-cache-test-robolectric-sdk
Sep 23, 2026
Merged

dcalhoun merged 1 commit into
trunkfrom
fix/svg-icon-cache-test-robolectric-sdk

Conversation

@dcalhoun

@dcalhoun dcalhoun commented Sep 23, 2026 •

Copy link
Copy Markdown
Member

What?

Fix unexpected SvgIconCacheTest failure due to missing config introduced in #642.

Why?

Prevent blocking CI failures.

How?

Add the @Config(sdk = [28]) found in other Android tests to align with the current practice.

Testing Instructions

N/A, no user-facing changes.

Accessibility Testing Instructions

N/A, no user-facing changes.

Screenshots or screencast

N/A, no user-facing changes.


AI-generated details

Problem: Trunk's :android: Test Android Library job fails (build 2997): SvgIconCacheTest > classMethod FAILED — UnsupportedOperationException at DefaultSdkProvider.java:174.

Cause: #642 enabled isIncludeAndroidResources, so Robolectric now defaults to the project's SDK 36, which requires Java 21. CI runs an older JVM. SvgIconCacheTest was the only Robolectric class without an explicit @Config(sdk = [28]). Local runs pass on Java 21, which hid it.

Fix: Pin the class to SDK 28 like the others.

Testing: CI's :android: Test Android Library passes. Locally: android/gradlew -p android :Gutenberg:testDebugUnitTest --tests "org.wordpress.gutenberg.inserter.SvgIconCacheTest".

🤖 Generated with Claude Code

Including Android resources in unit tests (#642) makes Robolectric default to
the project's SDK 36, which requires Java 21 and fails on CI's older JVM. Pin
the SDK as the other Robolectric test classes already do.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added the [Type] Bug An existing feature does not function as intended label Sep 23, 2026
@dcalhoun dcalhoun changed the title fix(android): pin SvgIconCacheTest to Robolectric SDK 28 test(android): pin SvgIconCacheTest to Robolectric SDK 28 Sep 23, 2026
@dcalhoun dcalhoun added [Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests. and removed [Type] Bug An existing feature does not function as intended labels Sep 23, 2026
@wpmobilebot

Copy link
Copy Markdown

XCFramework Build

This PR's XCFramework is available for testing. Add the following to your Package.swift:

.package(url: "https://github.com/wordpress-mobile/GutenbergKit", branch: "pr-build/723")

Built from 87b2075

@dcalhoun
dcalhoun marked this pull request as ready for review September 23, 2026 14:50
@nbradbury

Copy link
Copy Markdown
Contributor

@dcalhoun Claude had a few findings, but they don't appear to be important. I'll approve and leave it to you to determine if anything needs changing.

Severity Location Issue Impact
Low SvgIconCacheTest.kt:18 The fix adds a fourth per-class @Config(sdk = [28]) rather than pinning the SDK once with sdk=28 in src/test/resources/robolectric.properties, a file that doesn't exist yet. If the next Robolectric test class is added without the annotation, it defaults to SDK 36, which needs Java 21, so it passes locally and fails on CI with the same UnsupportedOperationException from DefaultSdkProvider.
Low build.gradle.kts:92 The actual cause is that CI runs tests on an older JVM than the one needed for the SDK 36 that Robolectric now resolves, and the PR works around this in each test class instead of fixing it in the build. Local runs on Java 21 and CI runs keep resolving Robolectric SDKs differently, so any test without a pin can stay green locally and only fail on CI.
Low SvgIconCacheTest.kt:18 With SDK 28 pinned, the test never checks the Color.parseColor/Color.argb behaviour it relies on against SDK 36, which the library compiles against. A named-colour parsing regression that only shows up on newer APIs would pass this suite without being caught.

@nbradbury nbradbury left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM :shipit:

@dcalhoun

Copy link
Copy Markdown
Member Author

Thanks! I'll merge to unblock CI and other PRs. We can follow up on the findings separately if deemed worthwhile.

@dcalhoun
dcalhoun merged commit 7c2cae0 into trunk Sep 23, 2026
33 checks passed
@dcalhoun
dcalhoun deleted the fix/svg-icon-cache-test-robolectric-sdk branch September 23, 2026 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants