Plugin Test extending from BasePlatformTestCase fails on CI

Answered

Tests class (without any test code) extending from com.intellij.testFramework.fixtures.BasePlatformTestCase fails on CI, but passes on my local. 

 I have a plugin, which relies on android jar - inside the gradle build script - i have these 2 dependencies
compileOnly(fileTree("dir" to "$studioCompilePath/plugins/android/lib", "include" to "*.jar"))
compileOnly(fileTree("dir" to "$studioCompilePath/lib", "include" to "*.jar"))
where studioCompilePath = /Applications/Android Studio.app/ContentsIt builds and checks fine on local. But, on CI the test fails - when the test tried to access something from android.jar
All unit tests extends from com.intellij.testFramework.fixtures.BasePlatformTestCase - It fails on CI with the below stack-trace
ava.lang.AssertionError: File accessed outside allowed roots: file:///usr/local/lib/android/sdk/platforms/android-34/android.jar;
Allowed roots: [/home/runner/.gradle/caches/modules-2/files-2.1/com.google.android.studio/android-studio/222.4459.24.2221.9971841/5e733c455a76cacc09473825f58cf67a631bc453/android-studio-222.4459.24.2221.9971841, /home/runner/.gradle, /home/runner/work/ExampleProject/ExampleProject/build/classes, /src, /etc, /opt/hostedtoolcache/Java_Zulu_jdk/11.0.20-8/x64, /home/runner, /private/etc, /tmp/unitTest__2TWNnYqq0EYM9xRXCaWpBxEQhHC, /tmp]
	at com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess.assertAccessInTests(VfsRootAccess.java:93)
	at com.intellij.openapi.vfs.newvfs.impl.VirtualDirectoryImpl.findInPersistence(VirtualDirectoryImpl.java:179)
	at com.intellij.openapi.vfs.newvfs.impl.VirtualDirectoryImpl.doFindChild(VirtualDirectoryImpl.java:132)
	at com.intellij.openapi.vfs.newvfs.impl.VirtualDirectoryImpl.findChild(VirtualDirectoryImpl.java:78)
	at com.intellij.openapi.vfs.newvfs.impl.VirtualDirectoryImpl.refreshAndFindChild(VirtualDirectoryImpl.java:346)
	at com.intellij.openapi.vfs.VfsUtil.refreshAndFindChild(VfsUtil.java:216)
	at com.android.tools.idea.sdk.AndroidSdks.getPlatformAndAddOnJars(AndroidSdks.java:407)
	at com.android.tools.idea.sdk.AndroidSdks.getLibraryRootsForTarget(AndroidSdks.java:342)
	at com.android.tools.idea.sdk.AndroidSdks.setUpSdkAndCommit(AndroidSdks.java:292)
	at com.android.tools.idea.sdk.AndroidSdks.create(AndroidSdks.java:249)
	at org.jetbrains.android.sdk.AndroidSdkUtils.createNewAndroidPlatform(AndroidSdkUtils.java:98)
	at com.android.tools.idea.startup.GradleSpecificInitializer.lambda$setupSdks$0(GradleSpecificInitializer.java:180)
	at com.intellij.openapi.application.TransactionGuardImpl.runWithWritingAllowed(TransactionGuardImpl.java:209)
	at com.intellij.openapi.application.TransactionGuardImpl.access$100(TransactionGuardImpl.java:21)
	at com.intellij.openapi.application.TransactionGuardImpl$1.run(TransactionGuardImpl.java:191)
	at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:881)
But, it only fails on CI, not on local - i am thinking maybe it has nothing to do with VfsRootAccess.allowRootAccess but the studioCompilePath = /Applications/Android Studio.app/Contents

Thanks in advance!
0

Post is closed for comments.