Skip to content

Commit d405f4b

Browse files
authored
[jb] support testing of stable GW (#17073)
1 parent 8ad7b34 commit d405f4b

File tree

5 files changed

+47
-21
lines changed

5 files changed

+47
-21
lines changed

.github/workflows/jetbrains-integration-test.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,18 +82,25 @@ jobs:
8282
env:
8383
DISPLAY: ':10'
8484
LEEWAY_MAX_PROVENANCE_BUNDLE_SIZE: '8388608'
85+
TEST_USE_LATEST: ${{ inputs.use_latest }}
8586
run: |
8687
export GATEWAY_LINK=$(jq -r '.inputs.secret_gateway_link' $GITHUB_EVENT_PATH)
8788
export GITPOD_TEST_ACCESSTOKEN=$(jq -r '.inputs.secret_access_token' $GITHUB_EVENT_PATH)
8889
export WS_ENDPOINT=$(jq -r '.inputs.secret_endpoint' $GITHUB_EVENT_PATH)
8990
9091
export LEEWAY_WORKSPACE_ROOT=$(pwd)
9192
92-
sudo mkdir -p /workspace/.gradle-latest
93-
sudo chown -R $(whoami) /workspace
94-
95-
mkdir -p $HOME/.cache/pluginVerifier-latest
96-
leeway run dev/jetbrains-test:test -Dversion=integration-test -DpublishToJBMarketplace=false
93+
if [ $TEST_USE_LATEST = "false" ]; then
94+
sudo mkdir -p /workspace/.gradle-stable
95+
sudo chown -R $(whoami) /workspace
96+
mkdir -p $HOME/.cache/pluginVerifier-stable
97+
leeway run dev/jetbrains-test:test-stable -Dversion=integration-test -DpublishToJBMarketplace=false
98+
else
99+
sudo mkdir -p /workspace/.gradle-latest
100+
sudo chown -R $(whoami) /workspace
101+
mkdir -p $HOME/.cache/pluginVerifier-latest
102+
leeway run dev/jetbrains-test:test-latest -Dversion=integration-test -DpublishToJBMarketplace=false
103+
fi
97104
- name: Move video
98105
if: always()
99106
run: |

dev/jetbrains-test/BUILD.yaml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
scripts:
2-
- name: test
2+
- name: test-stable
3+
srcs:
4+
- "test.sh"
5+
deps:
6+
- components/ide/jetbrains/gateway-plugin:publish-stable
7+
workdir: origin
8+
script: |
9+
cp $COMPONENTS_IDE_JETBRAINS_GATEWAY_PLUGIN__PUBLISH_STABLE/build/distributions/gitpod-gateway.zip gitpod-gateway.zip
10+
./test.sh
11+
- name: test-latest
12+
srcs:
13+
- "test.sh"
314
deps:
415
- components/ide/jetbrains/gateway-plugin:publish-latest
516
workdir: origin
617
script: |
718
cp $COMPONENTS_IDE_JETBRAINS_GATEWAY_PLUGIN__PUBLISH_LATEST/build/distributions/gitpod-gateway.zip gitpod-gateway.zip
8-
export GATEWAY_PLUGIN_PATH=$(pwd)/gitpod-gateway.zip
9-
mkdir -p ~/.local/share/JetBrains/consentOptions/
10-
echo -n "rsch.send.usage.stat:1.1:0:1644945193441" > ~/.local/share/JetBrains/consentOptions/accepted
11-
mkdir -p ~/.config/JetBrains/JetBrainsClient/options
12-
touch ~/.config/JetBrains/JetBrainsClient/options/ide.general.xml
13-
./gradlew test
19+
./test.sh

dev/jetbrains-test/src/main/kotlin/io/gitpod/jetbrains/launcher/IdeDownloader.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ class IdeDownloader @JvmOverloads constructor(private val httpClient: OkHttpClie
2323
}
2424
}
2525

26-
fun downloadAndExtractLatestEap(ide: Ide, toDir: Path): Path {
27-
val idePackage = downloadIde(ide, toDir)
26+
fun downloadAndExtract(ide: Ide, toDir: Path, type: String): Path {
27+
val idePackage = downloadIde(ide, toDir, type)
2828
return extractIde(idePackage, toDir)
2929
}
3030

@@ -43,8 +43,8 @@ class IdeDownloader @JvmOverloads constructor(private val httpClient: OkHttpClie
4343
}
4444
}
4545

46-
private fun downloadIde(ide: Ide, toDir: Path): Path {
47-
val ideDownloadLink = getIdeDownloadUrl(ide, httpClient)
46+
private fun downloadIde(ide: Ide, toDir: Path, type: String): Path {
47+
val ideDownloadLink = getIdeDownloadUrl(ide, httpClient, type)
4848
val idePackageName = ideDownloadLink.substringAfterLast("/").removeSuffix("/")
4949
val targetFile = toDir.resolve(idePackageName)
5050
return downloadFile(ideDownloadLink, targetFile)
@@ -60,13 +60,13 @@ class IdeDownloader @JvmOverloads constructor(private val httpClient: OkHttpClie
6060
}
6161
}
6262

63-
private fun getIdeDownloadUrl(ide: Ide, httpClient: OkHttpClient): String {
63+
private fun getIdeDownloadUrl(ide: Ide, httpClient: OkHttpClient, type: String): String {
6464
return httpClient.newCall(
6565
Request.Builder().url(
6666
"https://data.services.jetbrains.com/products/releases".toHttpUrl()
6767
.newBuilder()
6868
.addQueryParameter("code", ide.feedsCode)
69-
.addQueryParameter("type", "eap,rc,release")
69+
.addQueryParameter("type", type)
7070
.addQueryParameter("platform", getFeedsOsPropertyName())
7171
.build()
7272
).build()
@@ -84,4 +84,4 @@ class IdeDownloader @JvmOverloads constructor(private val httpClient: OkHttpClie
8484
?.asString ?: error("no suitable ide found")
8585
}
8686
}
87-
}
87+
}

dev/jetbrains-test/src/test/kotlin/io/gitpod/jetbrains/launcher/GatewayLauncherTest.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,11 @@ class GatewayLauncherTest {
7878
val client = OkHttpClient()
7979
remoteRobot = RemoteRobot("http://localhost:8082", client)
8080
val ideDownloader = IdeDownloader(client)
81+
82+
val useLatest = System.getenv("TEST_USE_LATEST")?.toBoolean() ?: false
83+
val type = if (useLatest) "eap,rc,release" else "release"
8184
gatewayProcess = IdeLauncher.launchIde(
82-
ideDownloader.downloadAndExtractLatestEap(Ide.GATEWAY, tmpDir),
85+
ideDownloader.downloadAndExtract(Ide.GATEWAY, tmpDir, type),
8386
mapOf("robot-server.port" to 8082),
8487
emptyList(),
8588
listOf(
@@ -100,4 +103,4 @@ class GatewayLauncherTest {
100103

101104
fun RemoteRobot.isAvailable(): Boolean = runCatching {
102105
callJs<Boolean>("true")
103-
}.getOrDefault(false)
106+
}.getOrDefault(false)

dev/jetbrains-test/test.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env bash
2+
3+
GATEWAY_PLUGIN_PATH=$(pwd)/gitpod-gateway.zip
4+
export GATEWAY_PLUGIN_PATH
5+
6+
mkdir -p ~/.local/share/JetBrains/consentOptions/
7+
echo -n "rsch.send.usage.stat:1.1:0:1644945193441" > ~/.local/share/JetBrains/consentOptions/accepted
8+
mkdir -p ~/.config/JetBrains/JetBrainsClient/options
9+
touch ~/.config/JetBrains/JetBrainsClient/options/ide.general.xml
10+
./gradlew test

0 commit comments

Comments
 (0)