Skip to content

Commit 2bf901e

Browse files
committed
tst
1 parent edc2364 commit 2bf901e

File tree

2 files changed

+21
-9
lines changed

2 files changed

+21
-9
lines changed

plugins/core/jetbrains-community/tst/software/aws/toolkits/jetbrains/core/credentials/profiles/ProfileWatcherTest.kt

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
package software.aws.toolkits.jetbrains.core.credentials.profiles
55

6-
import com.intellij.openapi.Disposable
76
import com.intellij.openapi.util.Disposer
87
import com.intellij.openapi.util.Ref
98
import com.intellij.openapi.vfs.LocalFileSystem
@@ -13,6 +12,7 @@ import com.intellij.openapi.vfs.newvfs.RefreshQueue
1312
import com.intellij.testFramework.ApplicationRule
1413
import com.intellij.testFramework.DisposableRule
1514
import org.assertj.core.api.Assertions.assertThat
15+
import org.junit.AssumptionViolatedException
1616
import org.junit.Before
1717
import org.junit.ClassRule
1818
import org.junit.Rule
@@ -21,6 +21,7 @@ import org.junit.rules.TemporaryFolder
2121
import software.aws.toolkits.core.rules.SystemPropertyHelper
2222
import software.aws.toolkits.jetbrains.utils.spinUntil
2323
import java.io.File
24+
import java.io.IOException
2425
import java.time.Duration
2526
import java.util.concurrent.CountDownLatch
2627
import java.util.concurrent.TimeUnit
@@ -56,6 +57,18 @@ class ProfileWatcherTest {
5657

5758
System.getProperties().setProperty("aws.configFile", profileFile.absolutePath)
5859
System.getProperties().setProperty("aws.sharedCredentialsFile", credentialsFile.absolutePath)
60+
61+
try {
62+
assertFileChange {
63+
profileFile.writeText("Test")
64+
}
65+
} catch (e: Exception) {
66+
if (e.cause is IOException) {
67+
throw AssumptionViolatedException("native file watcher is not executable; possibly an issue with intellij-platform-gradle-plugin", e)
68+
}
69+
70+
throw e
71+
}
5972
}
6073

6174
@Test
@@ -106,15 +119,14 @@ class ProfileWatcherTest {
106119
private fun assertFileChange(block: () -> Unit) {
107120
val fileWatcher = (LocalFileSystem.getInstance() as LocalFileSystemImpl).fileWatcher
108121
Disposer.register(
109-
disposableRule.disposable,
110-
Disposable {
111-
fileWatcher.shutdown()
122+
disposableRule.disposable
123+
) {
124+
fileWatcher.shutdown()
112125

113-
spinUntil(Duration.ofSeconds(10)) {
114-
!fileWatcher.isOperational
115-
}
126+
spinUntil(Duration.ofSeconds(10)) {
127+
!fileWatcher.isOperational
116128
}
117-
)
129+
}
118130

119131
val watcherTriggered = CountDownLatch(1)
120132
fileWatcher.startup {

ui-tests-starter/tst-243+/software/aws/toolkits/jetbrains/uitests/OfflineAmazonQInlineCompletionTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ import com.intellij.ide.starter.models.TestCase
1515
import com.intellij.ide.starter.project.LocalProjectInfo
1616
import com.intellij.ide.starter.runner.CurrentTestMethod
1717
import com.intellij.ide.starter.runner.Starter
18+
import com.intellij.util.io.createParentDirectories
1819
import org.junit.jupiter.api.Test
1920
import org.kodein.di.DI
2021
import org.kodein.di.bindSingleton
2122
import java.io.File
2223
import java.nio.file.Path
2324
import java.nio.file.Paths
24-
import kotlin.io.path.createParentDirectories
2525
import kotlin.io.path.writeText
2626

2727
class OfflineAmazonQInlineCompletionTest {

0 commit comments

Comments
 (0)