-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Wait for service availability at the ingress before running tests
This commit makes the RestateDeployer wait for the availability of registered services at the ingress. The deployer checks whether the ingress is serving the registered services via calling grpc.health.v1.Health/Check and checking that the response contains status = SERVING. This fixes #266.
- Loading branch information
1 parent
1632e6f
commit 49edea2
Showing
14 changed files
with
139 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
test-utils/src/main/kotlin/dev/restate/e2e/utils/JsonUtils.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Copyright (c) 2023 - Restate Software, Inc., Restate GmbH | ||
// | ||
// This file is part of the Restate e2e tests, | ||
// which are released under the MIT license. | ||
// | ||
// You can find a copy of the license in file LICENSE in the root | ||
// directory of this repository or package, or at | ||
// https://github.com/restatedev/e2e/blob/main/LICENSE | ||
|
||
package dev.restate.e2e.utils | ||
|
||
import com.fasterxml.jackson.databind.JsonNode | ||
import com.fasterxml.jackson.databind.ObjectMapper | ||
import java.net.URI | ||
import java.net.http.HttpClient | ||
import java.net.http.HttpRequest | ||
import java.net.http.HttpResponse | ||
import java.nio.charset.StandardCharsets | ||
|
||
object JsonUtils { | ||
private val objMapper = ObjectMapper() | ||
private val httpClient = HttpClient.newHttpClient() | ||
|
||
fun jacksonBodyHandler(): HttpResponse.BodyHandler<JsonNode> { | ||
return HttpResponse.BodyHandler { | ||
HttpResponse.BodySubscribers.mapping( | ||
HttpResponse.BodySubscribers.ofString(StandardCharsets.UTF_8), objMapper::readTree) | ||
} | ||
} | ||
|
||
fun jacksonBodyPublisher(value: Any): HttpRequest.BodyPublisher { | ||
return HttpRequest.BodyPublishers.ofString(objMapper.writeValueAsString(value)) | ||
} | ||
|
||
fun postJsonRequest(uri: String, reqBody: Any): HttpResponse<JsonNode> { | ||
val req = | ||
HttpRequest.newBuilder(URI.create(uri)) | ||
.headers("Content-Type", "application/json") | ||
.POST(jacksonBodyPublisher(reqBody)) | ||
.build() | ||
return httpClient.send(req, jacksonBodyHandler()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.