Execute ChatGpt test only when GitHub is running coverage

This commit is contained in:
Erik C. Thauvin 2024-04-26 17:36:11 -07:00
parent 33a3e3c7ef
commit 4f9ff1b641
Signed by: erik
GPG key ID: 776702A6A2DA330E
3 changed files with 16 additions and 4 deletions

View file

@ -57,6 +57,12 @@
<version>1.2.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib</artifactId>
<version>1.9.23</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlinx</groupId>
<artifactId>kotlinx-coroutines-core</artifactId>

View file

@ -91,6 +91,7 @@ public class MobibotBuild extends Project {
.include(dependency("com.google.guava", "guava", "33.1.0-jre"))
.include(dependency("com.google.cloud", "google-cloud-vertexai", "1.2.0"))
// Kotlin
.include(dependency("org.jetbrains.kotlin", "kotlin-stdlib", kotlin))
.include(dependency("org.jetbrains.kotlinx", "kotlinx-coroutines-core", "1.8.0"))
.include(dependency("org.jetbrains.kotlinx", "kotlinx-cli-jvm", "0.3.6"))
// Logging

View file

@ -47,6 +47,15 @@ class ChatGptTest : LocalProperties() {
.hasNoCause()
}
@Test
fun testChatOnCoverage() {
if (System.getenv("CI") == null || System.getenv("COVERAGE_SDK") != null) {
assertThat(
ChatGpt.chat("how do I encode a URL in java?", getProperty(ChatGpt.API_KEY_PROP), 60)
).contains("URLEncoder")
}
}
@Test
@DisableOnCi
fun testChat() {
@ -55,10 +64,6 @@ class ChatGptTest : LocalProperties() {
ChatGpt.chat("how do I make an HTTP request in Javascript?", apiKey, 100)
).contains("XMLHttpRequest")
assertThat(
ChatGpt.chat("how do I encode a URL in java?", apiKey, 60)
).contains("URLEncoder")
assertFailure { ChatGpt.chat("1 liter to gallon", apiKey, -1) }
.isInstanceOf(ModuleException::class.java)
}