Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ dependencies {
implementation(libs.log4j.jul)

implementation("org.apache.kafka:kafka-clients:3.5.0")
implementation("org.openapitools:openapi-generator:7.15.0")
implementation("org.openapitools:openapi-generator:7.21.0")

implementation(libs.kotlinx.serialization.core)
implementation(libs.kotlinx.serialization.json)
Expand Down
14 changes: 6 additions & 8 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ dependencyResolutionManagement {
library("log4j-jul", "org.apache.logging.log4j", "log4j-jul").versionRef("log4j")
library("log4j-kotlin", "org.apache.logging.log4j", "log4j-api-kotlin").version("1.5.0")

version("jackson", "2.18.2")
version("jackson", "2.21.2")
library("jackson-core", "com.fasterxml.jackson.core", "jackson-core").versionRef("jackson")
library("jackson-databind", "com.fasterxml.jackson.core", "jackson-databind")
.versionRef("jackson")
Expand All @@ -39,18 +39,16 @@ dependencyResolutionManagement {

library("vertx", "io.vertx:vertx-core:4.5.14")

version("junit-jupiter", "6.0.0")
version("junit-platform", "6.0.0")
library("junit-all", "org.junit.jupiter", "junit-jupiter").versionRef("junit-jupiter")
library("junit-launcher", "org.junit.platform", "junit-platform-launcher")
.versionRef("junit-platform")
version("junit", "6.0.3")
library("junit-all", "org.junit.jupiter", "junit-jupiter").versionRef("junit")
library("junit-launcher", "org.junit.platform", "junit-platform-launcher").versionRef("junit")
library("junit-reporting", "org.junit.platform", "junit-platform-reporting")
.versionRef("junit-platform")
.versionRef("junit")

version("assertj", "3.27.6")
library("assertj", "org.assertj", "assertj-core").versionRef("assertj")

version("testcontainers", "2.0.3")
version("testcontainers", "2.0.4")
library("testcontainers-core", "org.testcontainers", "testcontainers")
.versionRef("testcontainers")
library("testcontainers-kafka", "org.testcontainers", "testcontainers-kafka")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,8 @@ private constructor(
}

private fun discoverDeployment(client: DeploymentApi, uri: String) {
val request = RegisterDeploymentRequest(RegisterHttpDeploymentRequest().uri(uri).force(false))
val request =
RegisterDeploymentRequest(RegisterHttpDeploymentRequest().uri(URI.create(uri)).force(false))

val response =
Unreliables.retryUntilSuccess(20, TimeUnit.SECONDS) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,8 @@ class BackwardCompatibilityTest {
// For each deployment, update its URI
for (deployment in deployments.deployments) {
val updateRequest =
UpdateDeploymentRequest(UpdateHttpDeploymentRequest().uri(localEndpointURI.toString()))
UpdateDeploymentRequest(
UpdateHttpDeploymentRequest().uri(URI.create(localEndpointURI.toString())))

try {
adminApi.updateDeployment(deployment.httpDeploymentResponse.id, updateRequest)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ package dev.restate.sdktesting.tests

import dev.restate.admin.api.DeploymentApi
import dev.restate.admin.client.ApiClient
import dev.restate.admin.model.UpdateDeploymentRequest
import dev.restate.admin.model.UpdateHttpDeploymentRequest
import dev.restate.client.Client
import dev.restate.client.SendResponse
import dev.restate.client.kotlin.*
Expand Down Expand Up @@ -253,33 +251,48 @@ class ForwardCompatibilityTest {
@InjectLocalEndpointURI localEndpointURI: URI
) {
// Create Admin API client with the provided admin URI
val adminApi =
DeploymentApi(
ApiClient()
.setHost(adminURI.host)
// TODO remove basePath
.setBasePath("/v2")
.setPort(adminURI.port))
val adminClient =
ApiClient()
.setHost(adminURI.host)
// TODO remove basePath
.setBasePath("/v2")
.setPort(adminURI.port)
val adminApi = DeploymentApi(adminClient)

// List all deployments
val deployments = adminApi.listDeployments()

LOG.info("Patching all deployments to use endpoint URI: {}", localEndpointURI)

// For each deployment, update its URI
// For each deployment, update its URI.
// NOTE: We use a raw PUT request here instead of adminApi.updateDeployment() because
// the generated client uses PATCH (per the current OpenAPI spec), but this test runs
// against an OLDER server version that only supports PUT on this endpoint.
// When the minimum supported version includes PATCH support, replace this block with:
// adminApi.updateDeployment(deployment.httpDeploymentResponse.id, updateRequest)
val httpClient = java.net.http.HttpClient.newHttpClient()
for (deployment in deployments.deployments) {
val updateRequest =
UpdateDeploymentRequest(UpdateHttpDeploymentRequest().uri(localEndpointURI.toString()))
val deploymentId = deployment.httpDeploymentResponse.id
val body = """{"uri":"$localEndpointURI"}"""
val request =
java.net.http.HttpRequest.newBuilder()
.uri(
URI.create(
"http://${adminURI.host}:${adminURI.port}/v2/deployments/$deploymentId"))
.header("Content-Type", "application/json")
.PUT(java.net.http.HttpRequest.BodyPublishers.ofString(body))
.build()

try {
adminApi.updateDeployment(deployment.httpDeploymentResponse.id, updateRequest)
val response =
httpClient.send(request, java.net.http.HttpResponse.BodyHandlers.ofString())
check(response.statusCode() / 100 == 2) {
"updateDeployment call failed with: ${response.statusCode()} - ${response.body()}"
}
LOG.info(
"Successfully updated deployment {} to use URI {}",
deployment.httpDeploymentResponse.id,
localEndpointURI)
"Successfully updated deployment {} to use URI {}", deploymentId, localEndpointURI)
} catch (e: Exception) {
LOG.error(
"Failed to update deployment {}: {}", deployment.httpDeploymentResponse.id, e.message)
LOG.error("Failed to update deployment {}: {}", deploymentId, e.message)
throw e
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/dev/restate/sdktesting/tests/Kafka.kt
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ object Kafka {
SubscriptionApi(ApiClient().setHost(adminURI.host).setPort(adminURI.port))
subscriptionsClient.createSubscription(
CreateSubscriptionRequest()
.source("kafka://my-cluster/$topic")
.sink("service://$serviceName/$handlerName")
.source(URI.create("kafka://my-cluster/$topic"))
.sink(URI.create("service://$serviceName/$handlerName"))
.options(mapOf("auto.offset.reset" to "earliest")))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class PauseResumeTest {
// Resume the paused invocation on the specific endpoint
val adminClient = ApiClient().setHost(adminURI.host).setPort(adminURI.port)
val invocationApi = InvocationApi(adminClient)
retryOnServiceUnavailable { invocationApi.resumeInvocation(invocationId, null) }
retryOnServiceUnavailable { invocationApi.resumeInvocation(invocationId, "keep") }

assertThat(sendResult.attachSuspend().response()).isEqualTo("input")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class RestartAsNewInvocationTest {
val invocationApi = InvocationApi(adminClient)
val newInvocationId =
retryOnServiceUnavailable {
invocationApi.restartAsNewInvocation(sendResult.invocationId(), null, null)
invocationApi.restartAsNewInvocation(sendResult.invocationId(), null, "latest")
}
.newInvocationId

Expand Down Expand Up @@ -158,7 +158,7 @@ class RestartAsNewInvocationTest {
val invocationApi = InvocationApi(adminClient)
val newInvocationId =
retryOnServiceUnavailable {
invocationApi.restartAsNewInvocation(sendResult.invocationId(), 1, null)
invocationApi.restartAsNewInvocation(sendResult.invocationId(), 1, "latest")
}
.newInvocationId

Expand Down
3 changes: 2 additions & 1 deletion src/main/kotlin/dev/restate/sdktesting/tests/utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,8 @@ fun startAndRegisterLocalEndpoint(endpoint: Endpoint, adminURI: URI): LocalEndpo
try {
deploymentApi
.createDeployment(
RegisterDeploymentRequest(RegisterHttpDeploymentRequest().uri(uri).force(false)))
RegisterDeploymentRequest(
RegisterHttpDeploymentRequest().uri(URI.create(uri)).force(false)))
.id
} catch (e: Exception) {
LOG.error("Failed to register new deployment {}: {}", uri, e.message)
Expand Down
Loading
Loading