|
| 1 | +// Copyright (c) 2023 - Restate Software, Inc., Restate GmbH |
| 2 | +// |
| 3 | +// This file is part of the Restate SDK Test suite tool, |
| 4 | +// which is released under the MIT license. |
| 5 | +// |
| 6 | +// You can find a copy of the license in file LICENSE in the root |
| 7 | +// directory of this repository or package, or at |
| 8 | +// https://github.com/restatedev/sdk-test-suite/blob/main/LICENSE |
| 9 | +package dev.restate.sdktesting.tests |
| 10 | + |
| 11 | +import dev.restate.sdk.client.Client |
| 12 | +import dev.restate.sdktesting.contracts.TestUtilsServiceClient |
| 13 | +import dev.restate.sdktesting.contracts.TestUtilsServiceDefinitions |
| 14 | +import dev.restate.sdktesting.infra.InjectClient |
| 15 | +import dev.restate.sdktesting.infra.RestateDeployerExtension |
| 16 | +import dev.restate.sdktesting.infra.ServiceSpec |
| 17 | +import kotlin.random.Random |
| 18 | +import kotlinx.coroutines.test.runTest |
| 19 | +import org.assertj.core.api.Assertions.assertThat |
| 20 | +import org.junit.jupiter.api.DisplayName |
| 21 | +import org.junit.jupiter.api.Test |
| 22 | +import org.junit.jupiter.api.extension.RegisterExtension |
| 23 | +import org.junit.jupiter.api.parallel.Execution |
| 24 | +import org.junit.jupiter.api.parallel.ExecutionMode |
| 25 | + |
| 26 | +class RawHandler { |
| 27 | + |
| 28 | + companion object { |
| 29 | + @RegisterExtension |
| 30 | + val deployerExt: RestateDeployerExtension = RestateDeployerExtension { |
| 31 | + withServiceSpec( |
| 32 | + ServiceSpec.defaultBuilder().withServices(TestUtilsServiceDefinitions.SERVICE_NAME)) |
| 33 | + } |
| 34 | + } |
| 35 | + |
| 36 | + @Test |
| 37 | + @Execution(ExecutionMode.CONCURRENT) |
| 38 | + @DisplayName("Raw input and raw output") |
| 39 | + fun rawHandler(@InjectClient ingressClient: Client) = runTest { |
| 40 | + val bytes = Random.nextBytes(100) |
| 41 | + |
| 42 | + assertThat(TestUtilsServiceClient.fromClient(ingressClient).rawEcho(bytes)).isEqualTo(bytes) |
| 43 | + } |
| 44 | +} |
0 commit comments