From 681379d3cdc6ef578ae3b03b770dda1fc4a35aa0 Mon Sep 17 00:00:00 2001 From: Aaron Todd Date: Fri, 13 Oct 2023 13:19:52 -0400 Subject: [PATCH 1/4] refactor!: rename metrics and remove redundant metrics (#973) --- .../b31b8667-e931-49cf-8897-4e2ded2b7f14.json | 5 +++ .../c063605b-4702-4d8a-a841-2e0b7aa78e78.json | 5 +++ .../logging/slf4j/Slf4j1xLoggerAdapter.kt | 5 --- .../logging/slf4j/Slf4j2xLoggerAdapter.kt | 5 --- .../telemetry-api/api/telemetry-api.api | 15 ++++++- .../logging/CoroutineContextLogExt.kt | 34 +++++++-------- .../telemetry/logging/LogRecordBuilder.kt | 8 ---- .../runtime/telemetry/logging/NoOpLogger.kt | 3 -- .../telemetry/trace/NoOpTracerProvider.kt | 2 +- .../runtime/telemetry/trace/SpanContext.kt | 41 +++++++++++++++++++ .../runtime/telemetry/trace/TraceSpan.kt | 5 +-- .../telemetry/otel/OtelTracerProvider.kt | 20 +++++++-- .../OperationTelemetryInterceptor.kt | 11 ----- .../http/operation/OperationMetrics.kt | 24 +++++------ 14 files changed, 109 insertions(+), 74 deletions(-) create mode 100644 .changes/b31b8667-e931-49cf-8897-4e2ded2b7f14.json create mode 100644 .changes/c063605b-4702-4d8a-a841-2e0b7aa78e78.json create mode 100644 runtime/observability/telemetry-api/common/src/aws/smithy/kotlin/runtime/telemetry/trace/SpanContext.kt diff --git a/.changes/b31b8667-e931-49cf-8897-4e2ded2b7f14.json b/.changes/b31b8667-e931-49cf-8897-4e2ded2b7f14.json new file mode 100644 index 000000000..2a1d1ef22 --- /dev/null +++ b/.changes/b31b8667-e931-49cf-8897-4e2ded2b7f14.json @@ -0,0 +1,5 @@ +{ + "id": "b31b8667-e931-49cf-8897-4e2ded2b7f14", + "type": "misc", + "description": "Expose immutable `SpanContext` on `TraceSpan`" +} \ No newline at end of file diff --git a/.changes/c063605b-4702-4d8a-a841-2e0b7aa78e78.json b/.changes/c063605b-4702-4d8a-a841-2e0b7aa78e78.json new file mode 100644 index 000000000..bc6c22efa --- /dev/null +++ b/.changes/c063605b-4702-4d8a-a841-2e0b7aa78e78.json @@ -0,0 +1,5 @@ +{ + "id": "c063605b-4702-4d8a-a841-2e0b7aa78e78", + "type": "misc", + "description": "**BREAKING**: Remove `smithy.client.request.size`, `smithy.client.response.size`, `smithy.client.retries` metrics. Rename all `smithy.client.*` metrics to `smithy.client.call.*`." +} diff --git a/runtime/observability/logging-slf4j2/jvm/src/aws/smithy/kotlin/runtime/telemetry/logging/slf4j/Slf4j1xLoggerAdapter.kt b/runtime/observability/logging-slf4j2/jvm/src/aws/smithy/kotlin/runtime/telemetry/logging/slf4j/Slf4j1xLoggerAdapter.kt index 2b196ab12..917615a88 100644 --- a/runtime/observability/logging-slf4j2/jvm/src/aws/smithy/kotlin/runtime/telemetry/logging/slf4j/Slf4j1xLoggerAdapter.kt +++ b/runtime/observability/logging-slf4j2/jvm/src/aws/smithy/kotlin/runtime/telemetry/logging/slf4j/Slf4j1xLoggerAdapter.kt @@ -4,7 +4,6 @@ */ package aws.smithy.kotlin.runtime.telemetry.logging.slf4j -import aws.smithy.kotlin.runtime.telemetry.context.Context import aws.smithy.kotlin.runtime.telemetry.logging.LogLevel import aws.smithy.kotlin.runtime.telemetry.logging.LogRecordBuilder import aws.smithy.kotlin.runtime.telemetry.logging.LoggerProvider @@ -47,10 +46,6 @@ private class Slf4j1xLogRecordBuilderAdapter( kvp[key] = value } - override fun setContext(context: Context) { - // TODO - add a way to get the current trace context and set the key/value pair on it? - } - override fun emit() { val message = requireNotNull(msg) { "no message provided to LogRecordBuilder" } val logMethod = when (level) { diff --git a/runtime/observability/logging-slf4j2/jvm/src/aws/smithy/kotlin/runtime/telemetry/logging/slf4j/Slf4j2xLoggerAdapter.kt b/runtime/observability/logging-slf4j2/jvm/src/aws/smithy/kotlin/runtime/telemetry/logging/slf4j/Slf4j2xLoggerAdapter.kt index 737519b68..4cc773321 100644 --- a/runtime/observability/logging-slf4j2/jvm/src/aws/smithy/kotlin/runtime/telemetry/logging/slf4j/Slf4j2xLoggerAdapter.kt +++ b/runtime/observability/logging-slf4j2/jvm/src/aws/smithy/kotlin/runtime/telemetry/logging/slf4j/Slf4j2xLoggerAdapter.kt @@ -4,7 +4,6 @@ */ package aws.smithy.kotlin.runtime.telemetry.logging.slf4j -import aws.smithy.kotlin.runtime.telemetry.context.Context import aws.smithy.kotlin.runtime.telemetry.logging.LogLevel import aws.smithy.kotlin.runtime.telemetry.logging.LogRecordBuilder import org.slf4j.event.Level @@ -37,10 +36,6 @@ private class Slf4j2xLogRecordBuilderAdapter( delegate.addKeyValue(key, value) } - override fun setContext(context: Context) { - // TODO - add a way to get the current trace context and set the key/value pair on it? - } - override fun emit() = delegate.log() } diff --git a/runtime/observability/telemetry-api/api/telemetry-api.api b/runtime/observability/telemetry-api/api/telemetry-api.api index 0fa8897df..b36b30eaa 100644 --- a/runtime/observability/telemetry-api/api/telemetry-api.api +++ b/runtime/observability/telemetry-api/api/telemetry-api.api @@ -68,7 +68,6 @@ public final class aws/smithy/kotlin/runtime/telemetry/logging/LogLevel : java/l public abstract interface class aws/smithy/kotlin/runtime/telemetry/logging/LogRecordBuilder { public abstract fun emit ()V public abstract fun setCause (Ljava/lang/Throwable;)V - public abstract fun setContext (Laws/smithy/kotlin/runtime/telemetry/context/Context;)V public abstract fun setKeyValuePair (Ljava/lang/String;Ljava/lang/Object;)V public abstract fun setMessage (Ljava/lang/String;)V public abstract fun setMessage (Lkotlin/jvm/functions/Function0;)V @@ -190,6 +189,18 @@ public final class aws/smithy/kotlin/runtime/telemetry/metrics/UpDownCounter$Def public final class aws/smithy/kotlin/runtime/telemetry/trace/CoroutineContextTraceExtKt { } +public abstract interface class aws/smithy/kotlin/runtime/telemetry/trace/SpanContext { + public static final field Companion Laws/smithy/kotlin/runtime/telemetry/trace/SpanContext$Companion; + public abstract fun getSpanId ()Ljava/lang/String; + public abstract fun getTraceId ()Ljava/lang/String; + public abstract fun isRemote ()Z + public abstract fun isValid ()Z +} + +public final class aws/smithy/kotlin/runtime/telemetry/trace/SpanContext$Companion { + public final fun getInvalid ()Laws/smithy/kotlin/runtime/telemetry/trace/SpanContext; +} + public final class aws/smithy/kotlin/runtime/telemetry/trace/SpanKind : java/lang/Enum { public static final field CLIENT Laws/smithy/kotlin/runtime/telemetry/trace/SpanKind; public static final field INTERNAL Laws/smithy/kotlin/runtime/telemetry/trace/SpanKind; @@ -209,7 +220,7 @@ public final class aws/smithy/kotlin/runtime/telemetry/trace/SpanStatus : java/l public abstract interface class aws/smithy/kotlin/runtime/telemetry/trace/TraceSpan : aws/smithy/kotlin/runtime/telemetry/context/Scope { public abstract fun close ()V public abstract fun emitEvent (Ljava/lang/String;Laws/smithy/kotlin/runtime/util/Attributes;)V - public abstract fun getName ()Ljava/lang/String; + public abstract fun getSpanContext ()Laws/smithy/kotlin/runtime/telemetry/trace/SpanContext; public abstract fun mergeAttributes (Laws/smithy/kotlin/runtime/util/Attributes;)V public abstract fun set (Laws/smithy/kotlin/runtime/util/AttributeKey;Ljava/lang/Object;)V public abstract fun setStatus (Laws/smithy/kotlin/runtime/telemetry/trace/SpanStatus;)V diff --git a/runtime/observability/telemetry-api/common/src/aws/smithy/kotlin/runtime/telemetry/logging/CoroutineContextLogExt.kt b/runtime/observability/telemetry-api/common/src/aws/smithy/kotlin/runtime/telemetry/logging/CoroutineContextLogExt.kt index bbf3c58ba..f5e56fd83 100644 --- a/runtime/observability/telemetry-api/common/src/aws/smithy/kotlin/runtime/telemetry/logging/CoroutineContextLogExt.kt +++ b/runtime/observability/telemetry-api/common/src/aws/smithy/kotlin/runtime/telemetry/logging/CoroutineContextLogExt.kt @@ -7,14 +7,21 @@ package aws.smithy.kotlin.runtime.telemetry.logging import aws.smithy.kotlin.runtime.ExperimentalApi import aws.smithy.kotlin.runtime.InternalApi -import aws.smithy.kotlin.runtime.telemetry.context.Context -import aws.smithy.kotlin.runtime.telemetry.context.telemetryContext import aws.smithy.kotlin.runtime.telemetry.telemetryProvider +import aws.smithy.kotlin.runtime.telemetry.trace.SpanContext +import aws.smithy.kotlin.runtime.telemetry.trace.traceSpan import kotlinx.coroutines.withContext import kotlin.coroutines.AbstractCoroutineContextElement import kotlin.coroutines.CoroutineContext import kotlin.coroutines.coroutineContext +// NOTE: these keys are specifically chosen to match the ones used by OpenTelemetry +// so that any of the javaagent/autoconfigure MDC instrumentation doesn't result in +// multiple key/value pairs with the same information. +// see: https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/v1.30.0/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/log/LoggingContextConstants.java#L14 +private const val TRACE_ID_KEY = "trace_id" +private const val SPAN_ID_KEY = "span_id" + /** * Coroutine scoped telemetry context used for carrying telemetry provider configuration * @param kvPairs key/value pairs to add to output log statements @@ -72,14 +79,17 @@ public fun CoroutineContext.log( ) { val logger = this.telemetryProvider.loggerProvider.getOrCreateLogger(sourceComponent) if (!logger.isEnabledFor(level)) return - val context = this.telemetryContext val loggingContext = this.loggingContext + val spanContext = this.traceSpan?.spanContext?.takeIf(SpanContext::isValid) logger.atLevel(level) .apply { ex?.let { setCause(it) } setMessage(content) - context?.let { setContext(it) } loggingContext.forEach { entry -> setKeyValuePair(entry.key, entry.value) } + if (spanContext != null) { + setKeyValuePair(TRACE_ID_KEY, spanContext.traceId) + setKeyValuePair(SPAN_ID_KEY, spanContext.spanId) + } }.emit() } @@ -236,21 +246,7 @@ private class ContextAwareLogger( override fun warn(t: Throwable?, msg: () -> String) = context.warn(sourceComponent, t, msg) override fun error(t: Throwable?, msg: () -> String) = context.error(sourceComponent, t, msg) override fun isEnabledFor(level: LogLevel): Boolean = delegate.isEnabledFor(level) - override fun atLevel(level: LogLevel): LogRecordBuilder { - val builder = delegate.atLevel(level) - val telemetryContext = context.telemetryContext - return telemetryContext?.let { ContextAwareLogRecordBuilder(builder, it) } ?: builder - } -} -private class ContextAwareLogRecordBuilder( - private val delegate: LogRecordBuilder, - private var context: Context, -) : LogRecordBuilder by delegate { - override fun setContext(context: Context) { this.context = context } - override fun emit() { - delegate.setContext(context) - delegate.emit() - } + override fun atLevel(level: LogLevel): LogRecordBuilder = delegate.atLevel(level) } /** diff --git a/runtime/observability/telemetry-api/common/src/aws/smithy/kotlin/runtime/telemetry/logging/LogRecordBuilder.kt b/runtime/observability/telemetry-api/common/src/aws/smithy/kotlin/runtime/telemetry/logging/LogRecordBuilder.kt index 04461ab4a..c531963f2 100644 --- a/runtime/observability/telemetry-api/common/src/aws/smithy/kotlin/runtime/telemetry/logging/LogRecordBuilder.kt +++ b/runtime/observability/telemetry-api/common/src/aws/smithy/kotlin/runtime/telemetry/logging/LogRecordBuilder.kt @@ -5,8 +5,6 @@ package aws.smithy.kotlin.runtime.telemetry.logging -import aws.smithy.kotlin.runtime.telemetry.context.Context - /** * Construct a logging record that can be emitted to an underlying logger. */ @@ -38,12 +36,6 @@ public interface LogRecordBuilder { */ public fun setKeyValuePair(key: String, value: Any) - /** - * Set the telemetry context to associate with this log record - * @param context the context to associate - */ - public fun setContext(context: Context) - /** * Emit this event to the underlying logger */ diff --git a/runtime/observability/telemetry-api/common/src/aws/smithy/kotlin/runtime/telemetry/logging/NoOpLogger.kt b/runtime/observability/telemetry-api/common/src/aws/smithy/kotlin/runtime/telemetry/logging/NoOpLogger.kt index 03fbcb54b..6821f1c83 100644 --- a/runtime/observability/telemetry-api/common/src/aws/smithy/kotlin/runtime/telemetry/logging/NoOpLogger.kt +++ b/runtime/observability/telemetry-api/common/src/aws/smithy/kotlin/runtime/telemetry/logging/NoOpLogger.kt @@ -5,8 +5,6 @@ package aws.smithy.kotlin.runtime.telemetry.logging -import aws.smithy.kotlin.runtime.telemetry.context.Context - internal object NoOpLoggerProvider : LoggerProvider { override fun getOrCreateLogger(name: String): Logger = NoOpLogger } @@ -26,6 +24,5 @@ private object NoOpLogRecordBuilder : LogRecordBuilder { override fun setMessage(message: String) {} override fun setMessage(message: MessageSupplier) {} override fun setKeyValuePair(key: String, value: Any) {} - override fun setContext(context: Context) {} override fun emit() {} } diff --git a/runtime/observability/telemetry-api/common/src/aws/smithy/kotlin/runtime/telemetry/trace/NoOpTracerProvider.kt b/runtime/observability/telemetry-api/common/src/aws/smithy/kotlin/runtime/telemetry/trace/NoOpTracerProvider.kt index 392453027..bf62547cc 100644 --- a/runtime/observability/telemetry-api/common/src/aws/smithy/kotlin/runtime/telemetry/trace/NoOpTracerProvider.kt +++ b/runtime/observability/telemetry-api/common/src/aws/smithy/kotlin/runtime/telemetry/trace/NoOpTracerProvider.kt @@ -23,7 +23,7 @@ private object NoOpTracer : Tracer { } private object NoOpTraceSpan : TraceSpan { - override val name: String = "NoOpSpan" + override val spanContext: SpanContext = SpanContext.Invalid override fun emitEvent(name: String, attributes: Attributes) {} override fun setStatus(status: SpanStatus) {} override operator fun set(key: AttributeKey, value: T) {} diff --git a/runtime/observability/telemetry-api/common/src/aws/smithy/kotlin/runtime/telemetry/trace/SpanContext.kt b/runtime/observability/telemetry-api/common/src/aws/smithy/kotlin/runtime/telemetry/trace/SpanContext.kt new file mode 100644 index 000000000..f102c4ac9 --- /dev/null +++ b/runtime/observability/telemetry-api/common/src/aws/smithy/kotlin/runtime/telemetry/trace/SpanContext.kt @@ -0,0 +1,41 @@ +/* + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ +package aws.smithy.kotlin.runtime.telemetry.trace + +/** + * The immutable state that must be serialized and propagated as part of a distributed trace context. + */ +public interface SpanContext { + public companion object { + public val Invalid: SpanContext = InvalidSpanContext + } + + /** + * The unique trace identifier this span belongs to + */ + public val traceId: String + + /** + * The unique span identifier + */ + public val spanId: String + + /** + * True if the [SpanContext] was propagated from a remote parent + */ + public val isRemote: Boolean + + /** + * True if the [SpanContext] has a non-zero [traceId] and [spanId] + */ + public val isValid: Boolean +} + +private object InvalidSpanContext : SpanContext { + override val traceId: String = "00000000000000000000000000000000" + override val spanId: String = "0000000000000000" + override val isRemote: Boolean = false + override val isValid: Boolean = false +} diff --git a/runtime/observability/telemetry-api/common/src/aws/smithy/kotlin/runtime/telemetry/trace/TraceSpan.kt b/runtime/observability/telemetry-api/common/src/aws/smithy/kotlin/runtime/telemetry/trace/TraceSpan.kt index 4b436878f..c08d5e64e 100644 --- a/runtime/observability/telemetry-api/common/src/aws/smithy/kotlin/runtime/telemetry/trace/TraceSpan.kt +++ b/runtime/observability/telemetry-api/common/src/aws/smithy/kotlin/runtime/telemetry/trace/TraceSpan.kt @@ -16,9 +16,9 @@ import aws.smithy.kotlin.runtime.util.emptyAttributes */ public interface TraceSpan : Scope { /** - * The name of the span + * The immutable tracing context this span belongs to */ - public val name: String + public val spanContext: SpanContext /** * Set an attribute on the span @@ -34,7 +34,6 @@ public interface TraceSpan : Scope { */ public fun mergeAttributes(attributes: Attributes) - // FIXME - when would we use OTeL trace events vs logs? /** * Add an event to this span * @param name the name of the event diff --git a/runtime/observability/telemetry-provider-otel/jvm/src/aws/smithy/kotlin/runtime/telemetry/otel/OtelTracerProvider.kt b/runtime/observability/telemetry-provider-otel/jvm/src/aws/smithy/kotlin/runtime/telemetry/otel/OtelTracerProvider.kt index 5ac1d86c5..e7299b37e 100644 --- a/runtime/observability/telemetry-provider-otel/jvm/src/aws/smithy/kotlin/runtime/telemetry/otel/OtelTracerProvider.kt +++ b/runtime/observability/telemetry-provider-otel/jvm/src/aws/smithy/kotlin/runtime/telemetry/otel/OtelTracerProvider.kt @@ -11,6 +11,7 @@ import aws.smithy.kotlin.runtime.util.AttributeKey import aws.smithy.kotlin.runtime.util.Attributes import io.opentelemetry.api.OpenTelemetry import io.opentelemetry.api.trace.Span as OtelSpan +import io.opentelemetry.api.trace.SpanContext as OtelSpanContext import io.opentelemetry.api.trace.SpanKind as OtelSpanKind import io.opentelemetry.api.trace.StatusCode as OtelStatus import io.opentelemetry.api.trace.Tracer as OtelTracer @@ -43,16 +44,29 @@ private class OtelTracerImpl( } .setSpanKind(spanKind.toOtelSpanKind()) - return OtelTraceSpan(name, spanBuilder.startSpan()) + return OtelTraceSpanImpl(spanBuilder.startSpan()) } } -private class OtelTraceSpan( - override val name: String, +private class OtelSpanContextImpl(private val otelSpanContext: OtelSpanContext) : SpanContext { + override val traceId: String + get() = otelSpanContext.traceId + override val spanId: String + get() = otelSpanContext.spanId + override val isRemote: Boolean + get() = otelSpanContext.isRemote + override val isValid: Boolean + get() = otelSpanContext.isValid +} + +internal class OtelTraceSpanImpl( private val otelSpan: OtelSpan, ) : TraceSpan { private val spanScope = otelSpan.makeCurrent() + + override val spanContext: SpanContext + get() = OtelSpanContextImpl(otelSpan.spanContext) override fun set(key: AttributeKey, value: T) { key.otelAttrKeyOrNull(value)?.let { otelKey -> otelSpan.setAttribute(otelKey, value) diff --git a/runtime/protocol/http-client/common/src/aws/smithy/kotlin/runtime/http/interceptors/OperationTelemetryInterceptor.kt b/runtime/protocol/http-client/common/src/aws/smithy/kotlin/runtime/http/interceptors/OperationTelemetryInterceptor.kt index 6756d0880..e501413a1 100644 --- a/runtime/protocol/http-client/common/src/aws/smithy/kotlin/runtime/http/interceptors/OperationTelemetryInterceptor.kt +++ b/runtime/protocol/http-client/common/src/aws/smithy/kotlin/runtime/http/interceptors/OperationTelemetryInterceptor.kt @@ -57,14 +57,6 @@ internal class OperationTelemetryInterceptor( metrics.rpcCallDuration.recordSeconds(callDuration, perRpcAttributes, currentCtx) } - context.protocolRequest?.body?.contentLength?.let { - metrics.rpcRequestSize.record(it, perRpcAttributes, currentCtx) - } - - context.protocolResponse?.body?.contentLength?.let { - metrics.rpcResponseSize.record(it, perRpcAttributes, currentCtx) - } - context.response.exceptionOrNull()?.let { ex -> val exType = ex::class.simpleName val errorAttributes = if (exType != null) { @@ -90,9 +82,6 @@ internal class OperationTelemetryInterceptor( override fun readAfterAttempt(context: ResponseInterceptorContext) { metrics.rpcAttempts.add(1L, perRpcAttributes, metrics.provider.contextManager.current()) attempts++ - if (attempts > 1) { - metrics.rpcRetryCount.add(1L, perRpcAttributes, metrics.provider.contextManager.current()) - } val attemptDuration = attemptStart?.elapsedNow() ?: return metrics.rpcAttemptDuration.recordSeconds(attemptDuration, perRpcAttributes, metrics.provider.contextManager.current()) diff --git a/runtime/protocol/http-client/common/src/aws/smithy/kotlin/runtime/http/operation/OperationMetrics.kt b/runtime/protocol/http-client/common/src/aws/smithy/kotlin/runtime/http/operation/OperationMetrics.kt index f7d899667..8c3dcaa88 100644 --- a/runtime/protocol/http-client/common/src/aws/smithy/kotlin/runtime/http/operation/OperationMetrics.kt +++ b/runtime/protocol/http-client/common/src/aws/smithy/kotlin/runtime/http/operation/OperationMetrics.kt @@ -8,7 +8,6 @@ import aws.smithy.kotlin.runtime.ExperimentalApi import aws.smithy.kotlin.runtime.InternalApi import aws.smithy.kotlin.runtime.telemetry.TelemetryProvider import aws.smithy.kotlin.runtime.telemetry.metrics.DoubleHistogram -import aws.smithy.kotlin.runtime.telemetry.metrics.LongHistogram import aws.smithy.kotlin.runtime.telemetry.metrics.MonotonicCounter /** @@ -28,17 +27,14 @@ public class OperationMetrics( val None: OperationMetrics = OperationMetrics("NoOp", TelemetryProvider.None) } - public val rpcCallDuration: DoubleHistogram = meter.createDoubleHistogram("smithy.client.duration", "s", "Overall call duration including retries") - public val rpcAttempts: MonotonicCounter = meter.createMonotonicCounter("smithy.client.attempts", "{attempt}", "The number of attempts for an operation") - public val rpcErrors: MonotonicCounter = meter.createMonotonicCounter("smithy.client.errors", "{error}", "The number of errors for an operation") - public val rpcRetryCount: MonotonicCounter = meter.createMonotonicCounter("smithy.client.retries", "{count}", "The number of retries for an operation") - public val rpcRequestSize: LongHistogram = meter.createLongHistogram("smithy.client.request.size", "By", "Size of the serialized request message") - public val rpcResponseSize: LongHistogram = meter.createLongHistogram("smithy.client.response.size", "By", "Size of the serialized response message") - public val rpcAttemptDuration: DoubleHistogram = meter.createDoubleHistogram("smithy.client.attempt_duration", "s", "The time it takes to connect to complete an entire call attempt, including identity resolution, endpoint resolution, signing, sending the request, and receiving the HTTP status code and headers from the response for an operation") - public val rpcAttemptOverheadDuration: DoubleHistogram = meter.createDoubleHistogram("smithy.client.attempt_overhead_duration", "s", "The time it takes to execute an attempt minus the time spent waiting for a response from the remote server") - public val serializationDuration: DoubleHistogram = meter.createDoubleHistogram("smithy.client.serialization_duration", "s", "The time it takes to serialize a request message body") - public val deserializationDuration: DoubleHistogram = meter.createDoubleHistogram("smithy.client.deserialization_duration", "s", "The time it takes to deserialize a response message body") - public val resolveEndpointDuration: DoubleHistogram = meter.createDoubleHistogram("smithy.client.resolve_endpoint_duration", "s", "The time it takes to resolve an endpoint for a request") - public val resolveIdentityDuration: DoubleHistogram = meter.createDoubleHistogram("smithy.client.auth.resolve_identity_duration", "s", "The time it takes to resolve an identity for signing a request") - public val signingDuration: DoubleHistogram = meter.createDoubleHistogram("smithy.client.auth.signing_duration", "s", "The time it takes to sign a request") + public val rpcCallDuration: DoubleHistogram = meter.createDoubleHistogram("smithy.client.call.duration", "s", "Overall call duration including retries") + public val rpcAttempts: MonotonicCounter = meter.createMonotonicCounter("smithy.client.call.attempts", "{attempt}", "The number of attempts for an operation") + public val rpcErrors: MonotonicCounter = meter.createMonotonicCounter("smithy.client.call.errors", "{error}", "The number of errors for an operation") + public val rpcAttemptDuration: DoubleHistogram = meter.createDoubleHistogram("smithy.client.call.attempt_duration", "s", "The time it takes to connect to complete an entire call attempt, including identity resolution, endpoint resolution, signing, sending the request, and receiving the HTTP status code and headers from the response for an operation") + public val rpcAttemptOverheadDuration: DoubleHistogram = meter.createDoubleHistogram("smithy.client.call.attempt_overhead_duration", "s", "The time it takes to execute an attempt minus the time spent waiting for a response from the remote server") + public val serializationDuration: DoubleHistogram = meter.createDoubleHistogram("smithy.client.call.serialization_duration", "s", "The time it takes to serialize a request message body") + public val deserializationDuration: DoubleHistogram = meter.createDoubleHistogram("smithy.client.call.deserialization_duration", "s", "The time it takes to deserialize a response message body") + public val resolveEndpointDuration: DoubleHistogram = meter.createDoubleHistogram("smithy.client.call.resolve_endpoint_duration", "s", "The time it takes to resolve an endpoint for a request") + public val resolveIdentityDuration: DoubleHistogram = meter.createDoubleHistogram("smithy.client.call.auth.resolve_identity_duration", "s", "The time it takes to resolve an identity for signing a request") + public val signingDuration: DoubleHistogram = meter.createDoubleHistogram("smithy.client.call.auth.signing_duration", "s", "The time it takes to sign a request") } From fd6a340817262f6ad16cfe038709a61947741101 Mon Sep 17 00:00:00 2001 From: Aaron Todd Date: Tue, 17 Oct 2023 12:59:01 -0400 Subject: [PATCH 2/4] feat: publish a BOM and version catalog (#980) --- .../666fa825-d13b-458c-af63-354434bfc2ed.json | 5 ++ bom/build.gradle.kts | 85 +++++++++++++++++++ settings.gradle.kts | 1 + 3 files changed, 91 insertions(+) create mode 100644 .changes/666fa825-d13b-458c-af63-354434bfc2ed.json create mode 100644 bom/build.gradle.kts diff --git a/.changes/666fa825-d13b-458c-af63-354434bfc2ed.json b/.changes/666fa825-d13b-458c-af63-354434bfc2ed.json new file mode 100644 index 000000000..0ae8637a5 --- /dev/null +++ b/.changes/666fa825-d13b-458c-af63-354434bfc2ed.json @@ -0,0 +1,5 @@ +{ + "id": "666fa825-d13b-458c-af63-354434bfc2ed", + "type": "feature", + "description": "Publish a BOM and a Version Catalog" +} \ No newline at end of file diff --git a/bom/build.gradle.kts b/bom/build.gradle.kts new file mode 100644 index 000000000..f2a4bd5ca --- /dev/null +++ b/bom/build.gradle.kts @@ -0,0 +1,85 @@ +/* + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ +import aws.sdk.kotlin.gradle.dsl.configurePublishing +import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension +import org.jetbrains.kotlin.gradle.plugin.KotlinMultiplatformPluginWrapper +import org.jetbrains.kotlin.gradle.plugin.KotlinTarget +import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinMetadataTarget +import org.jetbrains.kotlin.gradle.targets.js.KotlinJsTarget +import java.util.* + +plugins { + `maven-publish` + `java-platform` + `version-catalog` +} + +val sdkVersion: String by project + +group = "aws.smithy.kotlin" +version = sdkVersion + +val evaluateAfter = listOf(":runtime") +evaluateAfter.forEach { evaluationDependsOn(it) } + +fun createBomConstraintsAndVersionCatalog() { + val bomConstraints: DependencyConstraintHandler = dependencies.constraints + val catalogExt = catalog + + project(":runtime").subprojects { + val subproject = this + val hasMavenPublish = subproject.plugins.hasPlugin("maven-publish") + if (!hasMavenPublish) { + logger.info("skipping bom and version-catalog entry for ${subproject.name}") + return@subprojects + } + subproject.plugins.withType { + subproject.extensions.getByType().targets.all { + val target = this + val gavCoordinates = gav(target) + bomConstraints.api(gavCoordinates) + catalogExt.versionCatalog { + val alias = artifactId(target) + library(alias, gavCoordinates) + } + } + } + } +} + +fun Project.artifactId(target: KotlinTarget): String = when (target) { + is KotlinMetadataTarget -> name + is KotlinJsTarget -> "$name-js" + else -> "$name-${target.targetName.toLowerCase(Locale.ROOT)}" +} + +/** + * Returns a string like "aws.sdk.kotlin:s3-linuxx64:1.0.2" for this target. + */ +fun Project.gav(target: KotlinTarget): String { + val artifactId = artifactId(target) + return "$group:$artifactId:$version" +} + +fun DependencyConstraintHandler.api(constraintNotation: Any) = + add("api", constraintNotation) + +createBomConstraintsAndVersionCatalog() + +configurePublishing("smithy-kotlin") + +publishing { + publications { + create("bom", MavenPublication::class) { + artifactId = "bom" + from(project.components.getByName("javaPlatform")) + } + + create("versionCatalog") { + artifactId = "version-catalog" + from(components["versionCatalog"]) + } + } +} diff --git a/settings.gradle.kts b/settings.gradle.kts index d0e741f99..ca7b04e87 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -39,6 +39,7 @@ rootProject.name = "smithy-kotlin" include(":dokka-smithy") +include(":bom") include(":runtime") include(":runtime:auth:aws-credentials") include(":runtime:auth:aws-signing-common") From 4a0dda66088241838b2b9e6f1fa4e04eedbe99dc Mon Sep 17 00:00:00 2001 From: Matas Date: Tue, 17 Oct 2023 13:30:02 -0400 Subject: [PATCH 3/4] feat: implement clock skew interceptor (#972) --- .../6de10487-c3a0-4c63-929a-ba11a415ea8f.json | 5 + .../kotlin/codegen/core/RuntimeTypes.kt | 1 + .../rendering/ServiceClientGenerator.kt | 5 + .../kotlin/runtime/http/auth/AwsHttpSigner.kt | 5 + .../api/aws-protocol-core.api | 28 +++ .../aws-protocol-core/build.gradle.kts | 12 ++ .../awsprotocol/ClockSkewInterceptor.kt | 118 +++++++++++ .../common/test/ClockSkewInterceptorTest.kt | 198 ++++++++++++++++++ .../http/operation/HttpOperationContext.kt | 12 ++ runtime/runtime-core/api/runtime-core.api | 1 + .../aws/smithy/kotlin/runtime/time/Instant.kt | 3 + .../smithy/kotlin/runtime/time/InstantTest.kt | 26 +++ 12 files changed, 414 insertions(+) create mode 100644 .changes/6de10487-c3a0-4c63-929a-ba11a415ea8f.json create mode 100644 runtime/protocol/aws-protocol-core/common/src/aws/smithy/kotlin/runtime/awsprotocol/ClockSkewInterceptor.kt create mode 100644 runtime/protocol/aws-protocol-core/common/test/ClockSkewInterceptorTest.kt diff --git a/.changes/6de10487-c3a0-4c63-929a-ba11a415ea8f.json b/.changes/6de10487-c3a0-4c63-929a-ba11a415ea8f.json new file mode 100644 index 000000000..3e4b61c35 --- /dev/null +++ b/.changes/6de10487-c3a0-4c63-929a-ba11a415ea8f.json @@ -0,0 +1,5 @@ +{ + "id": "6de10487-c3a0-4c63-929a-ba11a415ea8f", + "type": "feature", + "description": "Detect and automatically correct clock skew to prevent signing errors" +} \ No newline at end of file diff --git a/codegen/smithy-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/core/RuntimeTypes.kt b/codegen/smithy-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/core/RuntimeTypes.kt index 3f5a7dd12..b651041b3 100644 --- a/codegen/smithy-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/core/RuntimeTypes.kt +++ b/codegen/smithy-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/core/RuntimeTypes.kt @@ -366,6 +366,7 @@ object RuntimeTypes { val AwsQueryCompatibleErrorDetails = symbol("AwsQueryCompatibleErrorDetails") val setAwsQueryCompatibleErrorMetadata = symbol("setAwsQueryCompatibleErrorMetadata") val XAmznQueryErrorHeader = symbol("X_AMZN_QUERY_ERROR_HEADER") + val ClockSkewInterceptor = symbol("ClockSkewInterceptor") } object AwsJsonProtocols : RuntimeTypePackage(KotlinDependency.AWS_JSON_PROTOCOLS) { diff --git a/codegen/smithy-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/rendering/ServiceClientGenerator.kt b/codegen/smithy-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/rendering/ServiceClientGenerator.kt index 6151cbacc..531090bd1 100644 --- a/codegen/smithy-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/rendering/ServiceClientGenerator.kt +++ b/codegen/smithy-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/rendering/ServiceClientGenerator.kt @@ -57,6 +57,11 @@ class ServiceClientGenerator(private val ctx: RenderingContext) { */ val RenderingContext: SectionKey> = SectionKey("RenderingContext") } + + /** + * [SectionId] used when rendering the finalizeConfig block of a service client + */ + object FinalizeConfig : SectionId } init { diff --git a/runtime/auth/http-auth-aws/common/src/aws/smithy/kotlin/runtime/http/auth/AwsHttpSigner.kt b/runtime/auth/http-auth-aws/common/src/aws/smithy/kotlin/runtime/http/auth/AwsHttpSigner.kt index 509505747..ae4123c3f 100644 --- a/runtime/auth/http-auth-aws/common/src/aws/smithy/kotlin/runtime/http/auth/AwsHttpSigner.kt +++ b/runtime/auth/http-auth-aws/common/src/aws/smithy/kotlin/runtime/http/auth/AwsHttpSigner.kt @@ -12,8 +12,10 @@ import aws.smithy.kotlin.runtime.auth.awssigning.internal.setAwsChunkedBody import aws.smithy.kotlin.runtime.auth.awssigning.internal.setAwsChunkedHeaders import aws.smithy.kotlin.runtime.auth.awssigning.internal.useAwsChunkedEncoding import aws.smithy.kotlin.runtime.http.HttpBody +import aws.smithy.kotlin.runtime.http.operation.HttpOperationContext import aws.smithy.kotlin.runtime.http.request.HttpRequest import aws.smithy.kotlin.runtime.http.request.HttpRequestBuilder +import aws.smithy.kotlin.runtime.time.Instant import aws.smithy.kotlin.runtime.util.get import kotlin.time.Duration @@ -123,7 +125,10 @@ public class AwsHttpSigner(private val config: Config) : HttpSigner { service = attributes.getOrNull(AwsSigningAttributes.SigningService) ?: checkNotNull(config.service) credentials = signingRequest.identity as Credentials algorithm = config.algorithm + + // apply clock skew if applicable signingDate = attributes.getOrNull(AwsSigningAttributes.SigningDate) + ?: (Instant.now() + (attributes.getOrNull(HttpOperationContext.ClockSkew) ?: Duration.ZERO)) signatureType = config.signatureType omitSessionToken = config.omitSessionToken diff --git a/runtime/protocol/aws-protocol-core/api/aws-protocol-core.api b/runtime/protocol/aws-protocol-core/api/aws-protocol-core.api index c6b984481..6da1ee55a 100644 --- a/runtime/protocol/aws-protocol-core/api/aws-protocol-core.api +++ b/runtime/protocol/aws-protocol-core/api/aws-protocol-core.api @@ -11,6 +11,34 @@ public final class aws/smithy/kotlin/runtime/awsprotocol/AwsQueryCompatibleError public final class aws/smithy/kotlin/runtime/awsprotocol/AwsQueryCompatibleErrorDetailsKt { } +public final class aws/smithy/kotlin/runtime/awsprotocol/ClockSkewInterceptor : aws/smithy/kotlin/runtime/client/Interceptor { + public static final field Companion Laws/smithy/kotlin/runtime/awsprotocol/ClockSkewInterceptor$Companion; + public fun ()V + public fun modifyBeforeAttemptCompletion-gIAlu-s (Laws/smithy/kotlin/runtime/client/ResponseInterceptorContext;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public fun modifyBeforeCompletion-gIAlu-s (Laws/smithy/kotlin/runtime/client/ResponseInterceptorContext;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public fun modifyBeforeDeserialization (Laws/smithy/kotlin/runtime/client/ProtocolResponseInterceptorContext;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public fun modifyBeforeRetryLoop (Laws/smithy/kotlin/runtime/client/ProtocolRequestInterceptorContext;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public fun modifyBeforeSerialization (Laws/smithy/kotlin/runtime/client/RequestInterceptorContext;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public fun modifyBeforeSigning (Laws/smithy/kotlin/runtime/client/ProtocolRequestInterceptorContext;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public fun modifyBeforeTransmit (Laws/smithy/kotlin/runtime/client/ProtocolRequestInterceptorContext;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public fun readAfterAttempt (Laws/smithy/kotlin/runtime/client/ResponseInterceptorContext;)V + public fun readAfterDeserialization (Laws/smithy/kotlin/runtime/client/ResponseInterceptorContext;)V + public fun readAfterExecution (Laws/smithy/kotlin/runtime/client/ResponseInterceptorContext;)V + public fun readAfterSerialization (Laws/smithy/kotlin/runtime/client/ProtocolRequestInterceptorContext;)V + public fun readAfterSigning (Laws/smithy/kotlin/runtime/client/ProtocolRequestInterceptorContext;)V + public fun readAfterTransmit (Laws/smithy/kotlin/runtime/client/ProtocolResponseInterceptorContext;)V + public fun readBeforeAttempt (Laws/smithy/kotlin/runtime/client/ProtocolRequestInterceptorContext;)V + public fun readBeforeDeserialization (Laws/smithy/kotlin/runtime/client/ProtocolResponseInterceptorContext;)V + public fun readBeforeExecution (Laws/smithy/kotlin/runtime/client/RequestInterceptorContext;)V + public fun readBeforeSerialization (Laws/smithy/kotlin/runtime/client/RequestInterceptorContext;)V + public fun readBeforeSigning (Laws/smithy/kotlin/runtime/client/ProtocolRequestInterceptorContext;)V + public fun readBeforeTransmit (Laws/smithy/kotlin/runtime/client/ProtocolRequestInterceptorContext;)V +} + +public final class aws/smithy/kotlin/runtime/awsprotocol/ClockSkewInterceptor$Companion { + public final fun getCLOCK_SKEW_THRESHOLD-UwyO8pc ()J +} + public final class aws/smithy/kotlin/runtime/awsprotocol/ProtocolErrorsKt { } diff --git a/runtime/protocol/aws-protocol-core/build.gradle.kts b/runtime/protocol/aws-protocol-core/build.gradle.kts index 638b3f9a4..c6ab376e8 100644 --- a/runtime/protocol/aws-protocol-core/build.gradle.kts +++ b/runtime/protocol/aws-protocol-core/build.gradle.kts @@ -9,12 +9,24 @@ extra["moduleName"] = "aws.smithy.kotlin.runtime.awsprotocol" val coroutinesVersion: String by project +apply(plugin = "kotlinx-atomicfu") + kotlin { sourceSets { commonMain { dependencies { api(project(":runtime:protocol:http")) api(project(":runtime:runtime-core")) + api(project(":runtime:protocol:http-client")) + api(project(":runtime:smithy-client")) + implementation(libs.kotlinx.atomicfu) + } + } + + commonTest { + dependencies { + implementation(libs.kotlinx.coroutines.test) + implementation(project(":runtime:protocol:http-test")) } } diff --git a/runtime/protocol/aws-protocol-core/common/src/aws/smithy/kotlin/runtime/awsprotocol/ClockSkewInterceptor.kt b/runtime/protocol/aws-protocol-core/common/src/aws/smithy/kotlin/runtime/awsprotocol/ClockSkewInterceptor.kt new file mode 100644 index 000000000..39f7391fd --- /dev/null +++ b/runtime/protocol/aws-protocol-core/common/src/aws/smithy/kotlin/runtime/awsprotocol/ClockSkewInterceptor.kt @@ -0,0 +1,118 @@ +/* + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ +package aws.smithy.kotlin.runtime.awsprotocol + +import aws.smithy.kotlin.runtime.ErrorMetadata +import aws.smithy.kotlin.runtime.SdkBaseException +import aws.smithy.kotlin.runtime.ServiceErrorMetadata +import aws.smithy.kotlin.runtime.client.ProtocolRequestInterceptorContext +import aws.smithy.kotlin.runtime.client.ResponseInterceptorContext +import aws.smithy.kotlin.runtime.http.interceptors.HttpInterceptor +import aws.smithy.kotlin.runtime.http.operation.HttpOperationContext +import aws.smithy.kotlin.runtime.http.request.HttpRequest +import aws.smithy.kotlin.runtime.http.response.HttpResponse +import aws.smithy.kotlin.runtime.http.response.header +import aws.smithy.kotlin.runtime.telemetry.logging.logger +import aws.smithy.kotlin.runtime.time.Instant +import aws.smithy.kotlin.runtime.time.until +import aws.smithy.kotlin.runtime.util.get +import kotlinx.atomicfu.* +import kotlin.coroutines.coroutineContext +import kotlin.time.Duration +import kotlin.time.Duration.Companion.minutes + +/** + * An interceptor used to detect clock skew (difference between client and server clocks) and apply a correction. + */ +public class ClockSkewInterceptor : HttpInterceptor { + public companion object { + /** + * How much must the clock be skewed before attempting correction + */ + public val CLOCK_SKEW_THRESHOLD: Duration = 4.minutes + + /** + * Determine whether the client's clock is skewed relative to the server. + * @return true if the service's response represents a definite clock skew error + * OR a *possible* clock skew error AND the skew exists. false otherwise. + * @param errorCode the server's error code + * @param serverTime the server's time + */ + internal fun Instant.isSkewed(serverTime: Instant, errorCode: String): Boolean = + CLOCK_SKEW_ERROR_CODES.contains(errorCode) || (POSSIBLE_CLOCK_SKEW_ERROR_CODES.contains(errorCode) && until(serverTime).absoluteValue >= CLOCK_SKEW_THRESHOLD) + + // Errors definitely caused by clock skew + private val CLOCK_SKEW_ERROR_CODES = listOf( + "RequestTimeTooSkewed", + "RequestExpired", + "RequestInTheFuture", + ) + + // Errors possibly caused by clock skew + private val POSSIBLE_CLOCK_SKEW_ERROR_CODES = listOf( + "InvalidSignatureException", + "SignatureDoesNotMatch", + "AuthFailure", + ) + } + + // Clock skew to be applied to all requests + private val _currentSkew: AtomicRef = atomic(null) + + /** + * Apply the previously-computed skew, if it's set, to the execution context before signing + */ + public override suspend fun modifyBeforeSigning(context: ProtocolRequestInterceptorContext): HttpRequest { + val logger = coroutineContext.logger() + + val skew = _currentSkew.value + skew?.let { + logger.info { "applying clock skew $skew to client" } + context.executionContext[HttpOperationContext.ClockSkew] = skew + } + + context.executionContext[HttpOperationContext.ClockSkewApproximateSigningTime] = Instant.now() + + return context.protocolRequest + } + + /** + * After receiving a response, check if the client clock is skewed and apply a correction if necessary. + */ + public override suspend fun modifyBeforeAttemptCompletion(context: ResponseInterceptorContext): Result { + val logger = coroutineContext.logger() + + val serverTime = context.protocolResponse?.header("Date")?.let { + Instant.fromRfc5322(it) + } ?: run { + logger.debug { "service did not return \"Date\" header, skipping skew calculation" } + return context.response + } + + val clientTime = context.protocolRequest.headers["Date"]?.let { + Instant.fromRfc5322(it) + } ?: context.protocolRequest.headers["x-amz-date"]?.let { + Instant.fromIso8601(it) + } ?: context.executionContext[HttpOperationContext.ClockSkewApproximateSigningTime] + + val ex = (context.response.exceptionOrNull() as? SdkBaseException) ?: return context.response + val errorCode = ex.sdkErrorMetadata.attributes.getOrNull(ServiceErrorMetadata.ErrorCode) + + errorCode?.let { + if (clientTime.isSkewed(serverTime, it)) { + val skew = clientTime.until(serverTime) + logger.warn { "client clock ($clientTime) is skewed $skew from the server ($serverTime), applying correction" } + _currentSkew.getAndSet(skew) + context.executionContext[HttpOperationContext.ClockSkew] = skew + + // Mark the exception as retryable + ex.sdkErrorMetadata.attributes[ErrorMetadata.Retryable] = true + return Result.failure(ex) + } + } + + return context.response + } +} diff --git a/runtime/protocol/aws-protocol-core/common/test/ClockSkewInterceptorTest.kt b/runtime/protocol/aws-protocol-core/common/test/ClockSkewInterceptorTest.kt new file mode 100644 index 000000000..4e67b12e1 --- /dev/null +++ b/runtime/protocol/aws-protocol-core/common/test/ClockSkewInterceptorTest.kt @@ -0,0 +1,198 @@ +/* + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ +package aws.smithy.kotlin.runtime.awsprotocol + +import aws.smithy.kotlin.runtime.SdkBaseException +import aws.smithy.kotlin.runtime.ServiceErrorMetadata +import aws.smithy.kotlin.runtime.awsprotocol.ClockSkewInterceptor.Companion.CLOCK_SKEW_THRESHOLD +import aws.smithy.kotlin.runtime.awsprotocol.ClockSkewInterceptor.Companion.isSkewed +import aws.smithy.kotlin.runtime.client.ResponseInterceptorContext +import aws.smithy.kotlin.runtime.http.* +import aws.smithy.kotlin.runtime.http.interceptors.HttpInterceptor +import aws.smithy.kotlin.runtime.http.operation.HttpDeserialize +import aws.smithy.kotlin.runtime.http.operation.HttpOperationContext +import aws.smithy.kotlin.runtime.http.operation.HttpSerialize +import aws.smithy.kotlin.runtime.http.operation.SdkHttpOperation +import aws.smithy.kotlin.runtime.http.operation.roundTrip +import aws.smithy.kotlin.runtime.http.request.HttpRequest +import aws.smithy.kotlin.runtime.http.request.HttpRequestBuilder +import aws.smithy.kotlin.runtime.http.response.HttpResponse +import aws.smithy.kotlin.runtime.httptest.TestEngine +import aws.smithy.kotlin.runtime.io.SdkSource +import aws.smithy.kotlin.runtime.io.source +import aws.smithy.kotlin.runtime.time.Instant +import aws.smithy.kotlin.runtime.time.until +import kotlinx.coroutines.test.runTest +import kotlin.test.* +import kotlin.time.Duration.Companion.days +import kotlin.time.Duration.Companion.seconds + +class ClockSkewInterceptorTest { + val SKEWED_RESPONSE_CODE_DESCRIPTION = "RequestTimeTooSkewed" + val POSSIBLE_SKEWED_RESPONSE_CODE_DESCRIPTION = "InvalidSignatureException" + val NOT_SKEWED_RESPONSE_CODE_DESCRIPTION = "RequestThrottled" + + @Test + fun testNotSkewed() { + val clientTime = Instant.fromRfc5322("Wed, 6 Oct 2023 16:20:50 -0400") + val serverTime = Instant.fromRfc5322("Wed, 6 Oct 2023 16:20:50 -0400") + assertEquals(clientTime, serverTime) + assertFalse(clientTime.isSkewed(serverTime, NOT_SKEWED_RESPONSE_CODE_DESCRIPTION)) + } + + @Test + fun testSkewedByResponseCode() { + // clocks are exactly the same, but service returned skew error + val clientTime = Instant.fromRfc5322("Wed, 6 Oct 2023 16:20:50 -0400") + val serverTime = Instant.fromRfc5322("Wed, 6 Oct 2023 16:20:50 -0400") + assertTrue(clientTime.isSkewed(serverTime, SKEWED_RESPONSE_CODE_DESCRIPTION)) + assertEquals(0.days, clientTime.until(serverTime)) + } + + @Test + fun testSkewedByTime() { + val clientTime = Instant.fromRfc5322("Wed, 6 Oct 2023 16:20:50 -0400") + val serverTime = Instant.fromRfc5322("Wed, 7 Oct 2023 16:20:50 -0400") + assertTrue(clientTime.isSkewed(serverTime, POSSIBLE_SKEWED_RESPONSE_CODE_DESCRIPTION)) + assertEquals(1.days, clientTime.until(serverTime)) + } + + @Test + fun testNegativeSkewedByTime() { + val clientTime = Instant.fromRfc5322("Wed, 7 Oct 2023 16:20:50 -0400") + val serverTime = Instant.fromRfc5322("Wed, 6 Oct 2023 16:20:50 -0400") + assertTrue(clientTime.isSkewed(serverTime, POSSIBLE_SKEWED_RESPONSE_CODE_DESCRIPTION)) + assertEquals(-1.days, clientTime.until(serverTime)) + } + + @Test + fun testSkewThreshold() { + val minute = 20 + var clientTime = + Instant.fromRfc5322("Wed, 6 Oct 2023 16:${minute - CLOCK_SKEW_THRESHOLD.inWholeMinutes}:50 -0400") + val serverTime = Instant.fromRfc5322("Wed, 6 Oct 2023 16:$minute:50 -0400") + assertTrue(clientTime.isSkewed(serverTime, POSSIBLE_SKEWED_RESPONSE_CODE_DESCRIPTION)) + assertEquals(CLOCK_SKEW_THRESHOLD, clientTime.until(serverTime)) + + // shrink the skew by one second, crossing the threshold + clientTime += 1.seconds + assertFalse(clientTime.isSkewed(serverTime, POSSIBLE_SKEWED_RESPONSE_CODE_DESCRIPTION)) + } + + @Test + fun testClockSkewApplied() = runTest { + val serverTimeString = "Wed, 14 Sep 2023 16:20:50 -0400" + val serverTime = Instant.fromRfc5322(serverTimeString) + + val clientTimeString = "20231006T131604Z" + val clientTime = Instant.fromIso8601(clientTimeString) + + val client = getMockClient( + "bla".encodeToByteArray(), + Headers { append("Date", serverTimeString) }, + HttpStatusCode(403, "Forbidden"), + ) + + val req = HttpRequestBuilder().apply { + body = "bar".encodeToByteArray().toHttpBody() + } + req.headers.append("x-amz-date", clientTimeString) + + val op = newTestOperation(req, Unit) + + val clockSkewException = SdkBaseException() + clockSkewException.sdkErrorMetadata.attributes[ServiceErrorMetadata.ErrorCode] = + POSSIBLE_SKEWED_RESPONSE_CODE_DESCRIPTION + op.interceptors.add(FailedResultInterceptor(clockSkewException)) + + op.interceptors.add(ClockSkewInterceptor()) + + op.roundTrip(client, Unit) + + // Validate the skew got stored in execution context + val expectedSkew = clientTime.until(serverTime) + assertEquals(expectedSkew, op.context.getOrNull(HttpOperationContext.ClockSkew)) + } + + @Test + fun testClockSkewNotApplied() = runTest { + val serverTimeString = "Wed, 06 Oct 2023 13:16:04 -0000" + val clientTimeString = "20231006T131604Z" + assertEquals(Instant.fromRfc5322(serverTimeString), Instant.fromIso8601(clientTimeString)) + + val client = getMockClient( + "bla".encodeToByteArray(), + Headers { + append("Date", serverTimeString) + }, + HttpStatusCode(403, POSSIBLE_SKEWED_RESPONSE_CODE_DESCRIPTION), + ) + + val req = HttpRequestBuilder().apply { + body = "bar".encodeToByteArray().toHttpBody() + } + req.headers.append("x-amz-date", clientTimeString) + + val op = newTestOperation(req, Unit) + + val clockSkewException = SdkBaseException() + clockSkewException.sdkErrorMetadata.attributes[ServiceErrorMetadata.ErrorCode] = + POSSIBLE_SKEWED_RESPONSE_CODE_DESCRIPTION + op.interceptors.add(FailedResultInterceptor(clockSkewException)) + + op.interceptors.add(ClockSkewInterceptor()) + + // The request should fail because it's a non-retryable error, but there should be no skew detected. + assertFailsWith { + op.roundTrip(client, Unit) + } + + // Validate no skew was detected + assertNull(op.context.getOrNull(HttpOperationContext.ClockSkew)) + } + + /** + * An interceptor which returns a [Result.failure] with the given [exception] for the first [timesToFail] times its invoked. + * This simulates a service returning a clock skew exception and then successfully processing any successive requests. + */ + private class FailedResultInterceptor(val exception: SdkBaseException, val timesToFail: Int = 1) : HttpInterceptor { + var failuresSent = 0 + + override suspend fun modifyBeforeAttemptCompletion(context: ResponseInterceptorContext): Result { + if (failuresSent == timesToFail) { + return context.response + } + failuresSent += 1 + return Result.failure(exception) + } + } + + private fun getMockClient(response: ByteArray, responseHeaders: Headers = Headers.Empty, httpStatusCode: HttpStatusCode = HttpStatusCode.OK): SdkHttpClient { + val mockEngine = TestEngine { _, request -> + val body = object : HttpBody.SourceContent() { + override val contentLength: Long = response.size.toLong() + override fun readFrom(): SdkSource = response.source() + override val isOneShot: Boolean get() = false + } + val resp = HttpResponse(httpStatusCode, responseHeaders, body) + HttpCall(request, resp, Instant.now(), Instant.now()) + } + return SdkHttpClient(mockEngine) + } + + /** + * Create a new test operation using [serialized] as the already serialized version of the input type [I] + * and [deserialized] as the result of "deserialization" from an HTTP response. + */ + inline fun newTestOperation(serialized: HttpRequestBuilder, deserialized: O): SdkHttpOperation = + SdkHttpOperation.build { + serializer = HttpSerialize { _, _ -> serialized } + deserializer = HttpDeserialize { _, _ -> deserialized } + + // required operation context + operationName = "TestOperation" + serviceName = "TestService" + } +} diff --git a/runtime/protocol/http-client/common/src/aws/smithy/kotlin/runtime/http/operation/HttpOperationContext.kt b/runtime/protocol/http-client/common/src/aws/smithy/kotlin/runtime/http/operation/HttpOperationContext.kt index fe052d311..a3ccb60c4 100644 --- a/runtime/protocol/http-client/common/src/aws/smithy/kotlin/runtime/http/operation/HttpOperationContext.kt +++ b/runtime/protocol/http-client/common/src/aws/smithy/kotlin/runtime/http/operation/HttpOperationContext.kt @@ -8,7 +8,9 @@ package aws.smithy.kotlin.runtime.http.operation import aws.smithy.kotlin.runtime.InternalApi import aws.smithy.kotlin.runtime.http.HttpCall import aws.smithy.kotlin.runtime.operation.ExecutionContext +import aws.smithy.kotlin.runtime.time.Instant import aws.smithy.kotlin.runtime.util.* +import kotlin.time.Duration /** * Common configuration for an SDK (HTTP) operation/call @@ -50,6 +52,16 @@ public object HttpOperationContext { * Cached attribute level attributes (e.g. rpc.method, rpc.service, etc) */ public val OperationAttributes: AttributeKey = AttributeKey("aws.smithy.kotlin#OperationAttributes") + + /** + * The clock skew duration to apply to the signature calculation date during the operation + */ + public val ClockSkew: AttributeKey = AttributeKey("aws.smithy.kotlin#ClockSkew") + + /** + * The approximate signing time of the request, used to compute client clock skew. + */ + public val ClockSkewApproximateSigningTime: AttributeKey = AttributeKey("aws.smithy.kotlin#ClockSkewApproximateSigningTime") } internal val ExecutionContext.operationMetrics: OperationMetrics diff --git a/runtime/runtime-core/api/runtime-core.api b/runtime/runtime-core/api/runtime-core.api index 43c72a38c..7b2198edc 100644 --- a/runtime/runtime-core/api/runtime-core.api +++ b/runtime/runtime-core/api/runtime-core.api @@ -1250,6 +1250,7 @@ public final class aws/smithy/kotlin/runtime/time/InstantKt { public static final fun fromEpochMilliseconds (Laws/smithy/kotlin/runtime/time/Instant$Companion;J)Laws/smithy/kotlin/runtime/time/Instant; public static final fun getEpochMilliseconds (Laws/smithy/kotlin/runtime/time/Instant;)J public static final fun toEpochDouble (Laws/smithy/kotlin/runtime/time/Instant;)D + public static final fun until (Laws/smithy/kotlin/runtime/time/Instant;Laws/smithy/kotlin/runtime/time/Instant;)J } public class aws/smithy/kotlin/runtime/time/ParseException : aws/smithy/kotlin/runtime/SdkBaseException { diff --git a/runtime/runtime-core/common/src/aws/smithy/kotlin/runtime/time/Instant.kt b/runtime/runtime-core/common/src/aws/smithy/kotlin/runtime/time/Instant.kt index a496391d8..f9ffd6395 100644 --- a/runtime/runtime-core/common/src/aws/smithy/kotlin/runtime/time/Instant.kt +++ b/runtime/runtime-core/common/src/aws/smithy/kotlin/runtime/time/Instant.kt @@ -5,6 +5,7 @@ package aws.smithy.kotlin.runtime.time import kotlin.time.Duration +import kotlin.time.Duration.Companion.milliseconds // FIXME - remove in favor of kotlinx-datetime before GA (assuming it's available). For now // we are stubbing this out for codegen purposes and supporting the various timestamp format parsers. @@ -100,3 +101,5 @@ public fun Instant.Companion.fromEpochMilliseconds(milliseconds: Long): Instant val ns = (milliseconds - secs * MILLISEC_PER_SEC) * NS_PER_MILLISEC return fromEpochSeconds(secs, ns.toInt()) } + +public fun Instant.until(other: Instant): Duration = (other.epochMilliseconds - epochMilliseconds).milliseconds diff --git a/runtime/runtime-core/common/test/aws/smithy/kotlin/runtime/time/InstantTest.kt b/runtime/runtime-core/common/test/aws/smithy/kotlin/runtime/time/InstantTest.kt index 94d33a041..cd75980dd 100644 --- a/runtime/runtime-core/common/test/aws/smithy/kotlin/runtime/time/InstantTest.kt +++ b/runtime/runtime-core/common/test/aws/smithy/kotlin/runtime/time/InstantTest.kt @@ -7,6 +7,10 @@ package aws.smithy.kotlin.runtime.time import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertTrue +import kotlin.time.Duration +import kotlin.time.Duration.Companion.days +import kotlin.time.Duration.Companion.hours +import kotlin.time.Duration.Companion.minutes import kotlin.time.Duration.Companion.nanoseconds import kotlin.time.Duration.Companion.seconds @@ -257,4 +261,26 @@ class InstantTest { assertEquals(test.second, actual, "test[$idx]: failed to format offset timestamp in UTC") } } + + @Test + fun testUntil() { + val untilTests = mapOf( + ("2013-01-01T00:00:00+00:00" to "2014-01-01T00:00:00+00:00") to 365.days, + ("2020-01-01T00:00:00+00:00" to "2021-01-01T00:00:00+00:00") to 366.days, // leap year! + ("2023-10-06T00:00:00+00:00" to "2023-10-06T00:00:00+00:00") to Duration.ZERO, + ("2023-10-06T00:00:00+00:00" to "2023-10-07T00:00:00+00:00") to 1.days, + ("2023-10-06T00:00:00+00:00" to "2023-10-06T01:00:00+00:00") to 1.hours, + ("2023-10-06T00:00:00+00:00" to "2023-10-06T00:01:00+00:00") to 1.minutes, + ("2023-10-06T00:00:00+00:00" to "2023-10-06T00:00:01+00:00") to 1.seconds, + ("2023-10-06T00:00:00+00:00" to "2023-10-06T12:12:12+00:00") to 12.hours + 12.minutes + 12.seconds, + ) + + for ((times, expectedDuration) in untilTests) { + val start = Instant.fromIso8601(times.first) + val end = Instant.fromIso8601(times.second) + + assertEquals(expectedDuration, start.until(end)) + assertEquals(end.until(start), -expectedDuration) + } + } } From da008693cb177b2a0b1a9079abe1e69728ea834a Mon Sep 17 00:00:00 2001 From: 0marperez <60363173+0marperez@users.noreply.github.com> Date: Tue, 17 Oct 2023 11:48:01 -0600 Subject: [PATCH 4/4] refactor: JMESPath tests to fit style (#976) --- .../test/kotlin/com/test/BooleanLogicTest.kt | 11 ++-- .../test/kotlin/com/test/FunctionAbsTest.kt | 17 ++++-- .../test/kotlin/com/test/FunctionAvgTest.kt | 20 ++++--- .../test/kotlin/com/test/FunctionCeilTest.kt | 17 ++++-- .../kotlin/com/test/FunctionContainsTest.kt | 35 +++++++---- .../kotlin/com/test/FunctionEndsWithTest.kt | 5 +- .../test/kotlin/com/test/FunctionFloorTest.kt | 17 ++++-- .../test/kotlin/com/test/FunctionJoinTest.kt | 8 ++- .../test/kotlin/com/test/FunctionKeysTest.kt | 8 ++- .../kotlin/com/test/FunctionLengthTest.kt | 59 ++++++++++++------- .../test/kotlin/com/test/FunctionMapTest.kt | 5 +- .../test/kotlin/com/test/FunctionMaxByTest.kt | 8 ++- .../test/kotlin/com/test/FunctionMaxTest.kt | 20 ++++--- .../test/kotlin/com/test/FunctionMergeTest.kt | 11 ++-- .../test/kotlin/com/test/FunctionMinByTest.kt | 8 ++- .../test/kotlin/com/test/FunctionMinTest.kt | 20 ++++--- .../kotlin/com/test/FunctionNotNullTest.kt | 5 +- .../kotlin/com/test/FunctionReverseTest.kt | 8 ++- .../kotlin/com/test/FunctionSortByTest.kt | 8 ++- .../test/kotlin/com/test/FunctionSortTest.kt | 8 ++- .../kotlin/com/test/FunctionStartsWithTest.kt | 5 +- .../test/kotlin/com/test/FunctionSumTest.kt | 17 ++++-- .../kotlin/com/test/FunctionToArrayTest.kt | 8 ++- .../kotlin/com/test/FunctionToNumberTest.kt | 8 ++- .../kotlin/com/test/FunctionToStringTest.kt | 8 ++- .../test/kotlin/com/test/FunctionTypeTest.kt | 33 +++++++---- .../kotlin/com/test/FunctionValuesTest.kt | 8 ++- .../kotlin/com/test/ListOperationsTest.kt | 50 ++++++++++------ .../kotlin/com/test/MultiSelectHashTest.kt | 14 +++-- .../kotlin/com/test/MultiSelectListTest.kt | 11 ++-- .../kotlin/com/test/PrimitiveEqualityTest.kt | 41 ++++++++----- .../test/kotlin/com/test/StringEqualsTest.kt | 14 +++-- .../kotlin/com/test/SubFieldProjectionTest.kt | 11 ++-- 33 files changed, 340 insertions(+), 186 deletions(-) diff --git a/tests/codegen/waiter-tests/src/test/kotlin/com/test/BooleanLogicTest.kt b/tests/codegen/waiter-tests/src/test/kotlin/com/test/BooleanLogicTest.kt index b7e383f7f..3a19a2ea6 100644 --- a/tests/codegen/waiter-tests/src/test/kotlin/com/test/BooleanLogicTest.kt +++ b/tests/codegen/waiter-tests/src/test/kotlin/com/test/BooleanLogicTest.kt @@ -12,10 +12,11 @@ import com.test.utils.successTest import com.test.waiters.waitUntilAndEquals import com.test.waiters.waitUntilNotEquals import com.test.waiters.waitUntilOrEquals -import org.junit.jupiter.api.Test +import kotlin.test.Test class BooleanLogicTest { - @Test fun testAndEquals() = successTest( + @Test + fun testAndEquals() = successTest( GetBooleanLogicRequest { name = "test" }, WaitersTestClient::waitUntilAndEquals, GetBooleanLogicResponse { lists = EntityLists { booleans = listOf(false, false) } }, @@ -24,7 +25,8 @@ class BooleanLogicTest { GetBooleanLogicResponse { lists = EntityLists { booleans = listOf(true, true) } }, ) - @Test fun testOrEquals() = successTest( + @Test + fun testOrEquals() = successTest( GetBooleanLogicRequest { name = "test" }, WaitersTestClient::waitUntilOrEquals, GetBooleanLogicResponse { lists = EntityLists { booleans = listOf(true, true) } }, @@ -33,7 +35,8 @@ class BooleanLogicTest { GetBooleanLogicResponse { lists = EntityLists { booleans = listOf(false, false) } }, ) - @Test fun testNotEquals() = successTest( + @Test + fun testNotEquals() = successTest( GetBooleanLogicRequest { name = "test" }, WaitersTestClient::waitUntilNotEquals, GetBooleanLogicResponse { primitives = EntityPrimitives { boolean = true } }, diff --git a/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionAbsTest.kt b/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionAbsTest.kt index 208ba5753..88d5231d1 100644 --- a/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionAbsTest.kt +++ b/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionAbsTest.kt @@ -9,10 +9,11 @@ import com.test.model.GetFunctionAbsRequest import com.test.model.GetFunctionAbsResponse import com.test.utils.successTest import com.test.waiters.* -import org.junit.jupiter.api.Test +import kotlin.test.Test class FunctionAbsTest { - @Test fun testAbsFunctionShortEquals() = successTest( + @Test + fun testAbsFunctionShortEquals() = successTest( GetFunctionAbsRequest { name = "test" }, WaitersTestClient::waitUntilAbsFunctionShortEquals, GetFunctionAbsResponse { primitives = EntityPrimitives { short = -1 } }, @@ -20,7 +21,8 @@ class FunctionAbsTest { GetFunctionAbsResponse { primitives = EntityPrimitives { short = 2 } }, ) - @Test fun testAbsFunctionIntegerEquals() = successTest( + @Test + fun testAbsFunctionIntegerEquals() = successTest( GetFunctionAbsRequest { name = "test" }, WaitersTestClient::waitUntilAbsFunctionIntegerEquals, GetFunctionAbsResponse { primitives = EntityPrimitives { integer = -1 } }, @@ -28,7 +30,8 @@ class FunctionAbsTest { GetFunctionAbsResponse { primitives = EntityPrimitives { integer = 2 } }, ) - @Test fun testAbsFunctionLongEquals() = successTest( + @Test + fun testAbsFunctionLongEquals() = successTest( GetFunctionAbsRequest { name = "test" }, WaitersTestClient::waitUntilAbsFunctionLongEquals, GetFunctionAbsResponse { primitives = EntityPrimitives { long = -1L } }, @@ -36,7 +39,8 @@ class FunctionAbsTest { GetFunctionAbsResponse { primitives = EntityPrimitives { long = 2L } }, ) - @Test fun testAbsFunctionFloatEquals() = successTest( + @Test + fun testAbsFunctionFloatEquals() = successTest( GetFunctionAbsRequest { name = "test" }, WaitersTestClient::waitUntilAbsFunctionFloatEquals, GetFunctionAbsResponse { primitives = EntityPrimitives { float = -1f } }, @@ -44,7 +48,8 @@ class FunctionAbsTest { GetFunctionAbsResponse { primitives = EntityPrimitives { float = 2f } }, ) - @Test fun testAbsFunctionDoubleEquals() = successTest( + @Test + fun testAbsFunctionDoubleEquals() = successTest( GetFunctionAbsRequest { name = "test" }, WaitersTestClient::waitUntilAbsFunctionDoubleEquals, GetFunctionAbsResponse { primitives = EntityPrimitives { double = -1.0 } }, diff --git a/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionAvgTest.kt b/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionAvgTest.kt index 14cfd0a90..23b234c6d 100644 --- a/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionAvgTest.kt +++ b/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionAvgTest.kt @@ -9,16 +9,18 @@ import com.test.model.GetFunctionAvgEqualsRequest import com.test.model.GetFunctionAvgEqualsResponse import com.test.utils.successTest import com.test.waiters.* -import org.junit.jupiter.api.Test +import kotlin.test.Test class FunctionAvgTest { - @Test fun testEmptyIntegerListAvgNotEquals() = successTest( + @Test + fun testEmptyIntegerListAvgNotEquals() = successTest( GetFunctionAvgEqualsRequest { name = "test" }, WaitersTestClient::waitUntilEmptyIntegerListAvgNotEquals, GetFunctionAvgEqualsResponse { lists = EntityLists { integers = listOf() } }, ) - @Test fun testShortListAvgNotEquals() = successTest( + @Test + fun testShortListAvgNotEquals() = successTest( GetFunctionAvgEqualsRequest { name = "test" }, WaitersTestClient::waitUntilShortListAvgNotEquals, GetFunctionAvgEqualsResponse { lists = EntityLists { shorts = listOf(12, 12, 10, 8, 8) } }, @@ -26,7 +28,8 @@ class FunctionAvgTest { GetFunctionAvgEqualsResponse { lists = EntityLists { shorts = listOf(0) } }, ) - @Test fun testIntegerListAvgNotEquals() = successTest( + @Test + fun testIntegerListAvgNotEquals() = successTest( GetFunctionAvgEqualsRequest { name = "test" }, WaitersTestClient::waitUntilIntegerListAvgNotEquals, GetFunctionAvgEqualsResponse { lists = EntityLists { integers = listOf(12, 12, 10, 8, 8) } }, @@ -34,7 +37,8 @@ class FunctionAvgTest { GetFunctionAvgEqualsResponse { lists = EntityLists { integers = listOf(0) } }, ) - @Test fun testLongListAvgNotEquals() = successTest( + @Test + fun testLongListAvgNotEquals() = successTest( GetFunctionAvgEqualsRequest { name = "test" }, WaitersTestClient::waitUntilLongListAvgNotEquals, GetFunctionAvgEqualsResponse { lists = EntityLists { longs = listOf(12L, 12L, 10L, 8L, 8L) } }, @@ -42,7 +46,8 @@ class FunctionAvgTest { GetFunctionAvgEqualsResponse { lists = EntityLists { longs = listOf(0L) } }, ) - @Test fun testFloatListAvgNotEquals() = successTest( + @Test + fun testFloatListAvgNotEquals() = successTest( GetFunctionAvgEqualsRequest { name = "test" }, WaitersTestClient::waitUntilFloatListAvgNotEquals, GetFunctionAvgEqualsResponse { lists = EntityLists { floats = listOf(12f, 12f, 10f, 8f, 8f) } }, @@ -50,7 +55,8 @@ class FunctionAvgTest { GetFunctionAvgEqualsResponse { lists = EntityLists { floats = listOf(0f) } }, ) - @Test fun testDoubleListAvgNotEquals() = successTest( + @Test + fun testDoubleListAvgNotEquals() = successTest( GetFunctionAvgEqualsRequest { name = "test" }, WaitersTestClient::waitUntilDoubleListAvgNotEquals, GetFunctionAvgEqualsResponse { lists = EntityLists { doubles = listOf(12.0, 12.0, 10.0, 8.0, 8.0) } }, diff --git a/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionCeilTest.kt b/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionCeilTest.kt index 06398d7c3..0501b8470 100644 --- a/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionCeilTest.kt +++ b/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionCeilTest.kt @@ -9,31 +9,35 @@ import com.test.model.GetFunctionCeilRequest import com.test.model.GetFunctionCeilResponse import com.test.utils.successTest import com.test.waiters.* -import org.junit.jupiter.api.Test +import kotlin.test.Test class FunctionCeilTest { - @Test fun testCeilFunctionShortEquals() = successTest( + @Test + fun testCeilFunctionShortEquals() = successTest( GetFunctionCeilRequest { name = "test" }, WaitersTestClient::waitUntilCeilFunctionShortEquals, GetFunctionCeilResponse { primitives = EntityPrimitives { short = 1 } }, GetFunctionCeilResponse { primitives = EntityPrimitives { short = 2 } }, ) - @Test fun testCeilFunctionIntegerEquals() = successTest( + @Test + fun testCeilFunctionIntegerEquals() = successTest( GetFunctionCeilRequest { name = "test" }, WaitersTestClient::waitUntilCeilFunctionIntegerEquals, GetFunctionCeilResponse { primitives = EntityPrimitives { integer = 1 } }, GetFunctionCeilResponse { primitives = EntityPrimitives { integer = 2 } }, ) - @Test fun testCeilFunctionLongEquals() = successTest( + @Test + fun testCeilFunctionLongEquals() = successTest( GetFunctionCeilRequest { name = "test" }, WaitersTestClient::waitUntilCeilFunctionLongEquals, GetFunctionCeilResponse { primitives = EntityPrimitives { long = 1L } }, GetFunctionCeilResponse { primitives = EntityPrimitives { long = 2L } }, ) - @Test fun testCeilFunctionFloatEquals() = successTest( + @Test + fun testCeilFunctionFloatEquals() = successTest( GetFunctionCeilRequest { name = "test" }, WaitersTestClient::waitUntilCeilFunctionFloatEquals, GetFunctionCeilResponse { primitives = EntityPrimitives { float = 0.0001f } }, @@ -42,7 +46,8 @@ class FunctionCeilTest { GetFunctionCeilResponse { primitives = EntityPrimitives { float = 2.0f } }, ) - @Test fun testCeilFunctionDoubleEquals() = successTest( + @Test + fun testCeilFunctionDoubleEquals() = successTest( GetFunctionCeilRequest { name = "test" }, WaitersTestClient::waitUntilCeilFunctionDoubleEquals, GetFunctionCeilResponse { primitives = EntityPrimitives { double = 0.0001 } }, diff --git a/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionContainsTest.kt b/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionContainsTest.kt index 058b58027..775a3ab23 100644 --- a/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionContainsTest.kt +++ b/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionContainsTest.kt @@ -8,11 +8,12 @@ import com.test.model.* import com.test.model.Enum import com.test.utils.successTest import com.test.waiters.* -import org.junit.jupiter.api.Test +import kotlin.test.Test class FunctionContainsTest { // list - @Test fun testBooleanListContains() = successTest( + @Test + fun testBooleanListContains() = successTest( GetFunctionContainsRequest { name = "test" }, WaitersTestClient::waitUntilBooleanListContains, GetFunctionContainsResponse { @@ -25,7 +26,8 @@ class FunctionContainsTest { }, ) - @Test fun testBooleanListContainsIdentityProjection() = successTest( + @Test + fun testBooleanListContainsIdentityProjection() = successTest( GetFunctionContainsRequest { name = "test" }, WaitersTestClient::waitUntilBooleanListContainsIdentityProjection, GetFunctionContainsResponse { @@ -38,7 +40,8 @@ class FunctionContainsTest { }, ) - @Test fun testStringListContains() = successTest( + @Test + fun testStringListContains() = successTest( GetFunctionContainsRequest { name = "test" }, WaitersTestClient::waitUntilStringListContains, GetFunctionContainsResponse { @@ -51,7 +54,8 @@ class FunctionContainsTest { }, ) - @Test fun testIntegerListContains() = successTest( + @Test + fun testIntegerListContains() = successTest( GetFunctionContainsRequest { name = "test" }, WaitersTestClient::waitUntilIntegerListContains, GetFunctionContainsResponse { @@ -64,7 +68,8 @@ class FunctionContainsTest { }, ) - @Test fun testEnumListContains() = successTest( + @Test + fun testEnumListContains() = successTest( GetFunctionContainsRequest { name = "test" }, WaitersTestClient::waitUntilEnumListContains, GetFunctionContainsResponse { @@ -77,7 +82,8 @@ class FunctionContainsTest { }, ) - @Test fun testIntEnumListContains() = successTest( + @Test + fun testIntEnumListContains() = successTest( GetFunctionContainsRequest { name = "test" }, WaitersTestClient::waitUntilIntEnumListContains, GetFunctionContainsResponse { @@ -91,7 +97,8 @@ class FunctionContainsTest { ) // object projection - @Test fun testBooleanMapContains() = successTest( + @Test + fun testBooleanMapContains() = successTest( GetFunctionContainsRequest { name = "test" }, WaitersTestClient::waitUntilBooleanMapContains, GetFunctionContainsResponse { @@ -104,7 +111,8 @@ class FunctionContainsTest { }, ) - @Test fun testStringMapContains() = successTest( + @Test + fun testStringMapContains() = successTest( GetFunctionContainsRequest { name = "test" }, WaitersTestClient::waitUntilStringMapContains, GetFunctionContainsResponse { @@ -117,7 +125,8 @@ class FunctionContainsTest { }, ) - @Test fun testIntegerMapContains() = successTest( + @Test + fun testIntegerMapContains() = successTest( GetFunctionContainsRequest { name = "test" }, WaitersTestClient::waitUntilIntegerMapContains, GetFunctionContainsResponse { @@ -130,7 +139,8 @@ class FunctionContainsTest { }, ) - @Test fun testEnumMapContains() = successTest( + @Test + fun testEnumMapContains() = successTest( GetFunctionContainsRequest { name = "test" }, WaitersTestClient::waitUntilEnumMapContains, GetFunctionContainsResponse { @@ -143,7 +153,8 @@ class FunctionContainsTest { }, ) - @Test fun testIntEnumMapContains() = successTest( + @Test + fun testIntEnumMapContains() = successTest( GetFunctionContainsRequest { name = "test" }, WaitersTestClient::waitUntilIntEnumMapContains, GetFunctionContainsResponse { diff --git a/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionEndsWithTest.kt b/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionEndsWithTest.kt index e501456f0..ce0659e47 100644 --- a/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionEndsWithTest.kt +++ b/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionEndsWithTest.kt @@ -9,10 +9,11 @@ import com.test.model.GetFunctionEndsWithEqualsRequest import com.test.model.GetFunctionEndsWithEqualsResponse import com.test.utils.successTest import com.test.waiters.waitUntilStringEndsWithEquals -import org.junit.jupiter.api.Test +import kotlin.test.Test class FunctionEndsWithTest { - @Test fun testStringEndsWithEquals() = successTest( + @Test + fun testStringEndsWithEquals() = successTest( GetFunctionEndsWithEqualsRequest { name = "test" }, WaitersTestClient::waitUntilStringEndsWithEquals, GetFunctionEndsWithEqualsResponse { primitives = EntityPrimitives { string = "foo" } }, diff --git a/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionFloorTest.kt b/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionFloorTest.kt index 07add2e0e..e24b2466d 100644 --- a/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionFloorTest.kt +++ b/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionFloorTest.kt @@ -9,31 +9,35 @@ import com.test.model.GetFunctionFloorRequest import com.test.model.GetFunctionFloorResponse import com.test.utils.successTest import com.test.waiters.* -import org.junit.jupiter.api.Test +import kotlin.test.Test class FunctionFloorTest { - @Test fun testFloorFunctionShortEquals() = successTest( + @Test + fun testFloorFunctionShortEquals() = successTest( GetFunctionFloorRequest { name = "test" }, WaitersTestClient::waitUntilFloorFunctionShortEquals, GetFunctionFloorResponse { primitives = EntityPrimitives { short = 1 } }, GetFunctionFloorResponse { primitives = EntityPrimitives { short = 2 } }, ) - @Test fun testFloorFunctionIntegerEquals() = successTest( + @Test + fun testFloorFunctionIntegerEquals() = successTest( GetFunctionFloorRequest { name = "test" }, WaitersTestClient::waitUntilFloorFunctionIntegerEquals, GetFunctionFloorResponse { primitives = EntityPrimitives { integer = 1 } }, GetFunctionFloorResponse { primitives = EntityPrimitives { integer = 2 } }, ) - @Test fun testFloorFunctionLongEquals() = successTest( + @Test + fun testFloorFunctionLongEquals() = successTest( GetFunctionFloorRequest { name = "test" }, WaitersTestClient::waitUntilFloorFunctionLongEquals, GetFunctionFloorResponse { primitives = EntityPrimitives { long = 1L } }, GetFunctionFloorResponse { primitives = EntityPrimitives { long = 2L } }, ) - @Test fun testFloorFunctionFloatEquals() = successTest( + @Test + fun testFloorFunctionFloatEquals() = successTest( GetFunctionFloorRequest { name = "test" }, WaitersTestClient::waitUntilFloorFunctionFloatEquals, GetFunctionFloorResponse { primitives = EntityPrimitives { float = 1.0001f } }, @@ -42,7 +46,8 @@ class FunctionFloorTest { GetFunctionFloorResponse { primitives = EntityPrimitives { float = 2.0f } }, ) - @Test fun testFloorFunctionDoubleEquals() = successTest( + @Test + fun testFloorFunctionDoubleEquals() = successTest( GetFunctionFloorRequest { name = "test" }, WaitersTestClient::waitUntilFloorFunctionDoubleEquals, GetFunctionFloorResponse { primitives = EntityPrimitives { double = 1.0001 } }, diff --git a/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionJoinTest.kt b/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionJoinTest.kt index 468bf1fc1..3d908dbd2 100644 --- a/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionJoinTest.kt +++ b/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionJoinTest.kt @@ -10,17 +10,19 @@ import com.test.model.GetFunctionJoinEqualsResponse import com.test.utils.successTest import com.test.waiters.waitUntilStringListJoinEquals import com.test.waiters.waitUntilStringListSeparatorJoinEquals -import org.junit.jupiter.api.Test +import kotlin.test.Test class FunctionJoinTest { - @Test fun testStringListJoinEquals() = successTest( + @Test + fun testStringListJoinEquals() = successTest( GetFunctionJoinEqualsRequest { name = "test" }, WaitersTestClient::waitUntilStringListJoinEquals, GetFunctionJoinEqualsResponse { lists = EntityLists { strings = listOf("f", "o", "x") } }, GetFunctionJoinEqualsResponse { lists = EntityLists { strings = listOf("f", "o", "o") } }, ) - @Test fun testStringListSeparatorJoinEquals() = successTest( + @Test + fun testStringListSeparatorJoinEquals() = successTest( GetFunctionJoinEqualsRequest { name = "test" }, WaitersTestClient::waitUntilStringListSeparatorJoinEquals, GetFunctionJoinEqualsResponse { lists = EntityLists { strings = listOf("bar", "baz") } }, diff --git a/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionKeysTest.kt b/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionKeysTest.kt index 711e7dc2b..26b11a9d1 100644 --- a/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionKeysTest.kt +++ b/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionKeysTest.kt @@ -11,16 +11,18 @@ import com.test.model.GetFunctionKeysEqualsResponse import com.test.utils.successTest import com.test.waiters.waitUntilKeysFunctionPrimitivesIntegerEquals import com.test.waiters.waitUntilKeysFunctionPrimitivesStringEquals -import org.junit.jupiter.api.Test +import kotlin.test.Test class FunctionKeysTest { - @Test fun testKeysFunctionPrimitivesStringEquals() = successTest( + @Test + fun testKeysFunctionPrimitivesStringEquals() = successTest( GetFunctionKeysEqualsRequest { name = "test" }, WaitersTestClient::waitUntilKeysFunctionPrimitivesStringEquals, GetFunctionKeysEqualsResponse { primitives = EntityPrimitives { } }, ) - @Test fun testKeysFunctionPrimitivesIntegerEquals() = successTest( + @Test + fun testKeysFunctionPrimitivesIntegerEquals() = successTest( GetFunctionKeysEqualsRequest { name = "test" }, WaitersTestClient::waitUntilKeysFunctionPrimitivesIntegerEquals, GetFunctionKeysEqualsResponse { primitives = EntityPrimitives { } }, diff --git a/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionLengthTest.kt b/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionLengthTest.kt index 19d04b384..1c3f4c1bd 100644 --- a/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionLengthTest.kt +++ b/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionLengthTest.kt @@ -8,11 +8,12 @@ import com.test.model.* import com.test.model.Enum import com.test.utils.successTest import com.test.waiters.* -import org.junit.jupiter.api.Test +import kotlin.test.Test class FunctionLengthTest { // list - @Test fun testBooleanListLength() = successTest( + @Test + fun testBooleanListLength() = successTest( GetFunctionLengthRequest { name = "test" }, WaitersTestClient::waitUntilBooleanListLength, GetFunctionLengthResponse { }, @@ -25,7 +26,8 @@ class FunctionLengthTest { }, ) - @Test fun testStringListLength() = successTest( + @Test + fun testStringListLength() = successTest( GetFunctionLengthRequest { name = "test" }, WaitersTestClient::waitUntilStringListLength, GetFunctionLengthResponse { }, @@ -38,7 +40,8 @@ class FunctionLengthTest { }, ) - @Test fun testIntegerListLength() = successTest( + @Test + fun testIntegerListLength() = successTest( GetFunctionLengthRequest { name = "test" }, WaitersTestClient::waitUntilIntegerListLength, GetFunctionLengthResponse { }, @@ -51,7 +54,8 @@ class FunctionLengthTest { }, ) - @Test fun testEnumListLength() = successTest( + @Test + fun testEnumListLength() = successTest( GetFunctionLengthRequest { name = "test" }, WaitersTestClient::waitUntilEnumListLength, GetFunctionLengthResponse { }, @@ -64,7 +68,8 @@ class FunctionLengthTest { }, ) - @Test fun testIntEnumListLength() = successTest( + @Test + fun testIntEnumListLength() = successTest( GetFunctionLengthRequest { name = "test" }, WaitersTestClient::waitUntilIntEnumListLength, GetFunctionLengthResponse { }, @@ -78,7 +83,8 @@ class FunctionLengthTest { ) // object projection - @Test fun testBooleanMapLength() = successTest( + @Test + fun testBooleanMapLength() = successTest( GetFunctionLengthRequest { name = "test" }, WaitersTestClient::waitUntilBooleanMapLength, GetFunctionLengthResponse { }, @@ -91,7 +97,8 @@ class FunctionLengthTest { }, ) - @Test fun testStringMapLength() = successTest( + @Test + fun testStringMapLength() = successTest( GetFunctionLengthRequest { name = "test" }, WaitersTestClient::waitUntilStringMapLength, GetFunctionLengthResponse { }, @@ -104,7 +111,8 @@ class FunctionLengthTest { }, ) - @Test fun testIntegerMapLength() = successTest( + @Test + fun testIntegerMapLength() = successTest( GetFunctionLengthRequest { name = "test" }, WaitersTestClient::waitUntilIntegerMapLength, GetFunctionLengthResponse { }, @@ -117,7 +125,8 @@ class FunctionLengthTest { }, ) - @Test fun testEnumMapLength() = successTest( + @Test + fun testEnumMapLength() = successTest( GetFunctionLengthRequest { name = "test" }, WaitersTestClient::waitUntilEnumMapLength, GetFunctionLengthResponse { }, @@ -130,7 +139,8 @@ class FunctionLengthTest { }, ) - @Test fun testIntEnumMapLength() = successTest( + @Test + fun testIntEnumMapLength() = successTest( GetFunctionLengthRequest { name = "test" }, WaitersTestClient::waitUntilIntEnumMapLength, GetFunctionLengthResponse { }, @@ -144,7 +154,8 @@ class FunctionLengthTest { ) // compound filter - @Test fun testHasStructWithBoolean() = successTest( + @Test + fun testHasStructWithBoolean() = successTest( GetFunctionLengthRequest { name = "test" }, WaitersTestClient::waitUntilHasStructWithBoolean, GetFunctionLengthResponse { }, @@ -172,7 +183,8 @@ class FunctionLengthTest { }, ) - @Test fun testHasStructWithString() = successTest( + @Test + fun testHasStructWithString() = successTest( GetFunctionLengthRequest { name = "test" }, WaitersTestClient::waitUntilHasStructWithString, GetFunctionLengthResponse { }, @@ -200,7 +212,8 @@ class FunctionLengthTest { }, ) - @Test fun testHasStructWithInteger() = successTest( + @Test + fun testHasStructWithInteger() = successTest( GetFunctionLengthRequest { name = "test" }, WaitersTestClient::waitUntilHasStructWithInteger, GetFunctionLengthResponse { }, @@ -228,7 +241,8 @@ class FunctionLengthTest { }, ) - @Test fun testHasStructWithEnum() = successTest( + @Test + fun testHasStructWithEnum() = successTest( GetFunctionLengthRequest { name = "test" }, WaitersTestClient::waitUntilHasStructWithEnum, GetFunctionLengthResponse { }, @@ -256,7 +270,8 @@ class FunctionLengthTest { }, ) - @Test fun testHasStructWithIntEnum() = successTest( + @Test + fun testHasStructWithIntEnum() = successTest( GetFunctionLengthRequest { name = "test" }, WaitersTestClient::waitUntilHasStructWithIntEnum, GetFunctionLengthResponse { }, @@ -284,7 +299,8 @@ class FunctionLengthTest { }, ) - @Test fun testHasStructWithStringInStringList() = successTest( + @Test + fun testHasStructWithStringInStringList() = successTest( GetFunctionLengthRequest { name = "test" }, WaitersTestClient::waitUntilHasStructWithStringInStringList, GetFunctionLengthResponse { }, @@ -334,7 +350,8 @@ class FunctionLengthTest { }, ) - @Test fun testHasStructWithEnumInEnumList() = successTest( + @Test + fun testHasStructWithEnumInEnumList() = successTest( GetFunctionLengthRequest { name = "test" }, WaitersTestClient::waitUntilHasStructWithEnumInEnumList, GetFunctionLengthResponse { }, @@ -384,7 +401,8 @@ class FunctionLengthTest { }, ) - @Test fun testHasStructWithStringInEnumList() = successTest( + @Test + fun testHasStructWithStringInEnumList() = successTest( GetFunctionLengthRequest { name = "test" }, WaitersTestClient::waitUntilHasStructWithStringInEnumList, GetFunctionLengthResponse { }, @@ -434,7 +452,8 @@ class FunctionLengthTest { }, ) - @Test fun testHasStructWithEnumInStringList() = successTest( + @Test + fun testHasStructWithEnumInStringList() = successTest( GetFunctionLengthRequest { name = "test" }, WaitersTestClient::waitUntilHasStructWithEnumInStringList, GetFunctionLengthResponse { }, diff --git a/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionMapTest.kt b/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionMapTest.kt index 960415e60..d33474c89 100644 --- a/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionMapTest.kt +++ b/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionMapTest.kt @@ -10,10 +10,11 @@ import com.test.model.GetFunctionMapEqualsResponse import com.test.model.Struct import com.test.utils.successTest import com.test.waiters.waitUntilMapStructEquals -import org.junit.jupiter.api.Test +import kotlin.test.Test class FunctionMapTest { - @Test fun testMapStructEquals() = successTest( + @Test + fun testMapStructEquals() = successTest( GetFunctionMapEqualsRequest { name = "test" }, WaitersTestClient::waitUntilMapStructEquals, GetFunctionMapEqualsResponse { diff --git a/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionMaxByTest.kt b/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionMaxByTest.kt index 099eaa31c..ea46a215c 100644 --- a/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionMaxByTest.kt +++ b/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionMaxByTest.kt @@ -11,10 +11,11 @@ import com.test.model.Struct import com.test.utils.successTest import com.test.waiters.waitUntilMaxByNumberEquals import com.test.waiters.waitUntilMaxByStringEquals -import org.junit.jupiter.api.Test +import kotlin.test.Test class FunctionMaxByTest { - @Test fun testMaxByNumberEquals() = successTest( + @Test + fun testMaxByNumberEquals() = successTest( GetFunctionMaxByEqualsRequest { name = "test" }, WaitersTestClient::waitUntilMaxByNumberEquals, GetFunctionMaxByEqualsResponse { @@ -31,7 +32,8 @@ class FunctionMaxByTest { }, ) - @Test fun testMaxByStringEquals() = successTest( + @Test + fun testMaxByStringEquals() = successTest( GetFunctionMaxByEqualsRequest { name = "test" }, WaitersTestClient::waitUntilMaxByStringEquals, GetFunctionMaxByEqualsResponse { diff --git a/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionMaxTest.kt b/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionMaxTest.kt index da97cdb6b..3b5af9e5f 100644 --- a/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionMaxTest.kt +++ b/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionMaxTest.kt @@ -10,45 +10,51 @@ import com.test.model.GetFunctionMaxEqualsRequest import com.test.model.GetFunctionMaxEqualsResponse import com.test.utils.successTest import com.test.waiters.* -import org.junit.jupiter.api.Test +import kotlin.test.Test class FunctionMaxTest { - @Test fun testMaxFunctionShortListEquals() = successTest( + @Test + fun testMaxFunctionShortListEquals() = successTest( GetFunctionMaxEqualsRequest { name = "test" }, WaitersTestClient::waitUntilMaxFunctionShortListEquals, GetFunctionMaxEqualsResponse { lists = EntityLists { shorts = listOf(10, 20) } }, GetFunctionMaxEqualsResponse { lists = EntityLists { shorts = listOf(0, 10) } }, ) - @Test fun testMaxFunctionIntegerListEquals() = successTest( + @Test + fun testMaxFunctionIntegerListEquals() = successTest( GetFunctionMaxEqualsRequest { name = "test" }, WaitersTestClient::waitUntilMaxFunctionIntegerListEquals, GetFunctionMaxEqualsResponse { lists = EntityLists { integers = listOf(10, 20) } }, GetFunctionMaxEqualsResponse { lists = EntityLists { integers = listOf(0, 10) } }, ) - @Test fun testMaxFunctionLongListEquals() = successTest( + @Test + fun testMaxFunctionLongListEquals() = successTest( GetFunctionMaxEqualsRequest { name = "test" }, WaitersTestClient::waitUntilMaxFunctionLongListEquals, GetFunctionMaxEqualsResponse { lists = EntityLists { longs = listOf(10L, 20L) } }, GetFunctionMaxEqualsResponse { lists = EntityLists { longs = listOf(0L, 10L) } }, ) - @Test fun testMaxFunctionFloatListEquals() = successTest( + @Test + fun testMaxFunctionFloatListEquals() = successTest( GetFunctionMaxEqualsRequest { name = "test" }, WaitersTestClient::waitUntilMaxFunctionFloatListEquals, GetFunctionMaxEqualsResponse { lists = EntityLists { floats = listOf(10f, 20f) } }, GetFunctionMaxEqualsResponse { lists = EntityLists { floats = listOf(0f, 10f) } }, ) - @Test fun testMaxFunctionDoubleListEquals() = successTest( + @Test + fun testMaxFunctionDoubleListEquals() = successTest( GetFunctionMaxEqualsRequest { name = "test" }, WaitersTestClient::waitUntilMaxFunctionDoubleListEquals, GetFunctionMaxEqualsResponse { lists = EntityLists { doubles = listOf(10.0, 20.0) } }, GetFunctionMaxEqualsResponse { lists = EntityLists { doubles = listOf(0.0, 10.0) } }, ) - @Test fun testMaxFunctionStringListEquals() = successTest( + @Test + fun testMaxFunctionStringListEquals() = successTest( GetFunctionMaxEqualsRequest { name = "test" }, WaitersTestClient::waitUntilMaxFunctionStringListEquals, GetFunctionMaxEqualsResponse { lists = EntityLists { strings = listOf("foo", "fooooo") } }, diff --git a/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionMergeTest.kt b/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionMergeTest.kt index 5a9df2a29..cca2d0bb9 100644 --- a/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionMergeTest.kt +++ b/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionMergeTest.kt @@ -12,10 +12,11 @@ import com.test.utils.successTest import com.test.waiters.waitUntilMergeFunctionOverrideObjectsOneEquals import com.test.waiters.waitUntilMergeFunctionOverrideObjectsThreeEquals import com.test.waiters.waitUntilMergeFunctionOverrideObjectsTwoEquals -import org.junit.jupiter.api.Test +import kotlin.test.Test class FunctionMergeTest { - @Test fun testMergeFunctionOverrideObjectsOneEquals() = successTest( + @Test + fun testMergeFunctionOverrideObjectsOneEquals() = successTest( GetFunctionMergeEqualsRequest { name = "test" }, WaitersTestClient::waitUntilMergeFunctionOverrideObjectsOneEquals, GetFunctionMergeEqualsResponse { @@ -44,7 +45,8 @@ class FunctionMergeTest { }, ) - @Test fun testMergeFunctionOverrideObjectsTwoEquals() = successTest( + @Test + fun testMergeFunctionOverrideObjectsTwoEquals() = successTest( GetFunctionMergeEqualsRequest { name = "test" }, WaitersTestClient::waitUntilMergeFunctionOverrideObjectsTwoEquals, GetFunctionMergeEqualsResponse { @@ -73,7 +75,8 @@ class FunctionMergeTest { }, ) - @Test fun testMergeFunctionOverrideObjectsThreeEquals() = successTest( + @Test + fun testMergeFunctionOverrideObjectsThreeEquals() = successTest( GetFunctionMergeEqualsRequest { name = "test" }, WaitersTestClient::waitUntilMergeFunctionOverrideObjectsThreeEquals, GetFunctionMergeEqualsResponse { diff --git a/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionMinByTest.kt b/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionMinByTest.kt index 680a3843c..009a23ea9 100644 --- a/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionMinByTest.kt +++ b/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionMinByTest.kt @@ -11,10 +11,11 @@ import com.test.model.Struct import com.test.utils.successTest import com.test.waiters.waitUntilMinByNumberEquals import com.test.waiters.waitUntilMinByStringEquals -import org.junit.jupiter.api.Test +import kotlin.test.Test class FunctionMinByTest { - @Test fun testMinByNumberEquals() = successTest( + @Test + fun testMinByNumberEquals() = successTest( GetFunctionMinByEqualsRequest { name = "test" }, WaitersTestClient::waitUntilMinByNumberEquals, GetFunctionMinByEqualsResponse { @@ -31,7 +32,8 @@ class FunctionMinByTest { }, ) - @Test fun testMinByStringEquals() = successTest( + @Test + fun testMinByStringEquals() = successTest( GetFunctionMinByEqualsRequest { name = "test" }, WaitersTestClient::waitUntilMinByStringEquals, GetFunctionMinByEqualsResponse { diff --git a/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionMinTest.kt b/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionMinTest.kt index ee5221b37..8a6218d71 100644 --- a/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionMinTest.kt +++ b/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionMinTest.kt @@ -10,45 +10,51 @@ import com.test.model.GetFunctionMinEqualsRequest import com.test.model.GetFunctionMinEqualsResponse import com.test.utils.successTest import com.test.waiters.* -import org.junit.jupiter.api.Test +import kotlin.test.Test class FunctionMinTest { - @Test fun testMinFunctionShortListEquals() = successTest( + @Test + fun testMinFunctionShortListEquals() = successTest( GetFunctionMinEqualsRequest { name = "test" }, WaitersTestClient::waitUntilMinFunctionShortListEquals, GetFunctionMinEqualsResponse { lists = EntityLists { shorts = listOf(0, 10) } }, GetFunctionMinEqualsResponse { lists = EntityLists { shorts = listOf(10, 20) } }, ) - @Test fun testMinFunctionIntegerListEquals() = successTest( + @Test + fun testMinFunctionIntegerListEquals() = successTest( GetFunctionMinEqualsRequest { name = "test" }, WaitersTestClient::waitUntilMinFunctionIntegerListEquals, GetFunctionMinEqualsResponse { lists = EntityLists { integers = listOf(0, 10) } }, GetFunctionMinEqualsResponse { lists = EntityLists { integers = listOf(10, 20) } }, ) - @Test fun testMinFunctionLongListEquals() = successTest( + @Test + fun testMinFunctionLongListEquals() = successTest( GetFunctionMinEqualsRequest { name = "test" }, WaitersTestClient::waitUntilMinFunctionLongListEquals, GetFunctionMinEqualsResponse { lists = EntityLists { longs = listOf(0L, 10L) } }, GetFunctionMinEqualsResponse { lists = EntityLists { longs = listOf(10L, 20L) } }, ) - @Test fun testMinFunctionFloatListEquals() = successTest( + @Test + fun testMinFunctionFloatListEquals() = successTest( GetFunctionMinEqualsRequest { name = "test" }, WaitersTestClient::waitUntilMinFunctionFloatListEquals, GetFunctionMinEqualsResponse { lists = EntityLists { floats = listOf(0f, 10f) } }, GetFunctionMinEqualsResponse { lists = EntityLists { floats = listOf(10f, 20f) } }, ) - @Test fun testMinFunctionDoubleListEquals() = successTest( + @Test + fun testMinFunctionDoubleListEquals() = successTest( GetFunctionMinEqualsRequest { name = "test" }, WaitersTestClient::waitUntilMinFunctionDoubleListEquals, GetFunctionMinEqualsResponse { lists = EntityLists { doubles = listOf(0.0, 10.0) } }, GetFunctionMinEqualsResponse { lists = EntityLists { doubles = listOf(10.0, 20.0) } }, ) - @Test fun testMinFunctionStringListEquals() = successTest( + @Test + fun testMinFunctionStringListEquals() = successTest( GetFunctionMinEqualsRequest { name = "test" }, WaitersTestClient::waitUntilMinFunctionStringListEquals, GetFunctionMinEqualsResponse { lists = EntityLists { strings = listOf("bar", "foo") } }, diff --git a/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionNotNullTest.kt b/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionNotNullTest.kt index 9ca1df013..f058aea84 100644 --- a/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionNotNullTest.kt +++ b/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionNotNullTest.kt @@ -11,10 +11,11 @@ import com.test.model.GetFunctionNotNullEqualsRequest import com.test.model.GetFunctionNotNullEqualsResponse import com.test.utils.successTest import com.test.waiters.waitUntilNotNullFunctionStringEquals -import org.junit.jupiter.api.Test +import kotlin.test.Test class FunctionNotNullTest { - @Test fun testNotNullFunctionStringEquals() = successTest( + @Test + fun testNotNullFunctionStringEquals() = successTest( GetFunctionNotNullEqualsRequest { name = "test" }, WaitersTestClient::waitUntilNotNullFunctionStringEquals, GetFunctionNotNullEqualsResponse { diff --git a/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionReverseTest.kt b/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionReverseTest.kt index 2aab170db..38c8d079c 100644 --- a/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionReverseTest.kt +++ b/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionReverseTest.kt @@ -12,17 +12,19 @@ import com.test.model.GetFunctionReverseEqualsResponse import com.test.utils.successTest import com.test.waiters.waitUntilReverseFunctionStringEquals import com.test.waiters.waitUntilReverseFunctionStringListEquals -import org.junit.jupiter.api.Test +import kotlin.test.Test class FunctionReverseTest { - @Test fun testReverseFunctionStringListEquals() = successTest( + @Test + fun testReverseFunctionStringListEquals() = successTest( GetFunctionReverseEqualsRequest { name = "test" }, WaitersTestClient::waitUntilReverseFunctionStringListEquals, GetFunctionReverseEqualsResponse { lists = EntityLists { strings = listOf("foo", "bar") } }, GetFunctionReverseEqualsResponse { lists = EntityLists { strings = listOf("bar", "foo") } }, ) - @Test fun testReverseFunctionStringEquals() = successTest( + @Test + fun testReverseFunctionStringEquals() = successTest( GetFunctionReverseEqualsRequest { name = "test" }, WaitersTestClient::waitUntilReverseFunctionStringEquals, GetFunctionReverseEqualsResponse { primitives = EntityPrimitives { string = "foo" } }, diff --git a/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionSortByTest.kt b/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionSortByTest.kt index b3fb760a6..3d21a8260 100644 --- a/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionSortByTest.kt +++ b/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionSortByTest.kt @@ -11,10 +11,11 @@ import com.test.model.Struct import com.test.utils.successTest import com.test.waiters.waitUntilSortByNumberEquals import com.test.waiters.waitUntilSortByStringEquals -import org.junit.jupiter.api.Test +import kotlin.test.Test class FunctionSortByTest { - @Test fun testSortedByNumberEquals() = successTest( + @Test + fun testSortedByNumberEquals() = successTest( GetFunctionSortByEqualsRequest { name = "test" }, WaitersTestClient::waitUntilSortByNumberEquals, GetFunctionSortByEqualsResponse { @@ -34,7 +35,8 @@ class FunctionSortByTest { }, ) - @Test fun testSortByStringEquals() = successTest( + @Test + fun testSortByStringEquals() = successTest( GetFunctionSortByEqualsRequest { name = "test" }, WaitersTestClient::waitUntilSortByStringEquals, GetFunctionSortByEqualsResponse { diff --git a/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionSortTest.kt b/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionSortTest.kt index f09869482..ae934b130 100644 --- a/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionSortTest.kt +++ b/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionSortTest.kt @@ -10,10 +10,11 @@ import com.test.model.GetFunctionSortEqualsResponse import com.test.utils.successTest import com.test.waiters.waitUntilSortNumberEquals import com.test.waiters.waitUntilSortStringEquals -import org.junit.jupiter.api.Test +import kotlin.test.Test class FunctionSortTest { - @Test fun testSortNumberEquals() = successTest( + @Test + fun testSortNumberEquals() = successTest( GetFunctionSortEqualsRequest { name = "test" }, WaitersTestClient::waitUntilSortNumberEquals, GetFunctionSortEqualsResponse { @@ -23,7 +24,8 @@ class FunctionSortTest { }, ) - @Test fun testSortStringEquals() = successTest( + @Test + fun testSortStringEquals() = successTest( GetFunctionSortEqualsRequest { name = "test" }, WaitersTestClient::waitUntilSortStringEquals, GetFunctionSortEqualsResponse { diff --git a/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionStartsWithTest.kt b/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionStartsWithTest.kt index 40bddf56b..5e91e253c 100644 --- a/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionStartsWithTest.kt +++ b/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionStartsWithTest.kt @@ -9,10 +9,11 @@ import com.test.model.GetFunctionStartsWithEqualsRequest import com.test.model.GetFunctionStartsWithEqualsResponse import com.test.utils.successTest import com.test.waiters.waitUntilStringStartsWithEquals -import org.junit.jupiter.api.Test +import kotlin.test.Test class FunctionStartsWithTest { - @Test fun testStringStartsWithEquals() = successTest( + @Test + fun testStringStartsWithEquals() = successTest( GetFunctionStartsWithEqualsRequest { name = "test" }, WaitersTestClient::waitUntilStringStartsWithEquals, GetFunctionStartsWithEqualsResponse { primitives = EntityPrimitives { string = "baz" } }, diff --git a/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionSumTest.kt b/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionSumTest.kt index 475b31948..7a19a10fc 100644 --- a/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionSumTest.kt +++ b/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionSumTest.kt @@ -9,10 +9,11 @@ import com.test.model.GetFunctionSumEqualsRequest import com.test.model.GetFunctionSumEqualsResponse import com.test.utils.successTest import com.test.waiters.* -import org.junit.jupiter.api.Test +import kotlin.test.Test class FunctionSumTest { - @Test fun testShortListSumNotEquals() = successTest( + @Test + fun testShortListSumNotEquals() = successTest( GetFunctionSumEqualsRequest { name = "test" }, WaitersTestClient::waitUntilShortListSumNotEquals, GetFunctionSumEqualsResponse { lists = EntityLists { shorts = listOf(1, 2, 3, 4) } }, @@ -20,7 +21,8 @@ class FunctionSumTest { GetFunctionSumEqualsResponse { lists = EntityLists { shorts = listOf(0) } }, ) - @Test fun testIntegerListSumNotEquals() = successTest( + @Test + fun testIntegerListSumNotEquals() = successTest( GetFunctionSumEqualsRequest { name = "test" }, WaitersTestClient::waitUntilIntegerListSumNotEquals, GetFunctionSumEqualsResponse { lists = EntityLists { integers = listOf(1, 2, 3, 4) } }, @@ -28,7 +30,8 @@ class FunctionSumTest { GetFunctionSumEqualsResponse { lists = EntityLists { integers = listOf(0) } }, ) - @Test fun testLongListSumNotEquals() = successTest( + @Test + fun testLongListSumNotEquals() = successTest( GetFunctionSumEqualsRequest { name = "test" }, WaitersTestClient::waitUntilLongListSumNotEquals, GetFunctionSumEqualsResponse { lists = EntityLists { longs = listOf(1L, 2L, 3L, 4L) } }, @@ -36,7 +39,8 @@ class FunctionSumTest { GetFunctionSumEqualsResponse { lists = EntityLists { longs = listOf(0L) } }, ) - @Test fun testFloatListSumNotEquals() = successTest( + @Test + fun testFloatListSumNotEquals() = successTest( GetFunctionSumEqualsRequest { name = "test" }, WaitersTestClient::waitUntilFloatListSumNotEquals, GetFunctionSumEqualsResponse { lists = EntityLists { floats = listOf(1f, 2f, 3f, 4f) } }, @@ -44,7 +48,8 @@ class FunctionSumTest { GetFunctionSumEqualsResponse { lists = EntityLists { floats = listOf(0f) } }, ) - @Test fun testDoubleListSumNotEquals() = successTest( + @Test + fun testDoubleListSumNotEquals() = successTest( GetFunctionSumEqualsRequest { name = "test" }, WaitersTestClient::waitUntilDoubleListSumNotEquals, GetFunctionSumEqualsResponse { lists = EntityLists { doubles = listOf(1.0, 2.0, 3.0, 4.0) } }, diff --git a/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionToArrayTest.kt b/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionToArrayTest.kt index d2a8f781f..4a1cc4bd8 100644 --- a/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionToArrayTest.kt +++ b/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionToArrayTest.kt @@ -12,10 +12,11 @@ import com.test.model.GetFunctionToArrayEqualsResponse import com.test.utils.successTest import com.test.waiters.waitUntilToArrayFunctionBooleanEquals import com.test.waiters.waitUntilToArrayFunctionStringListEquals -import org.junit.jupiter.api.Test +import kotlin.test.Test class FunctionToArrayTest { - @Test fun testToArrayFunctionStringListEquals() = successTest( + @Test + fun testToArrayFunctionStringListEquals() = successTest( GetFunctionToArrayEqualsRequest { name = "test" }, WaitersTestClient::waitUntilToArrayFunctionStringListEquals, GetFunctionToArrayEqualsResponse { @@ -26,7 +27,8 @@ class FunctionToArrayTest { }, ) - @Test fun testToArrayFunctionBooleanEquals() = successTest( + @Test + fun testToArrayFunctionBooleanEquals() = successTest( GetFunctionToArrayEqualsRequest { name = "test" }, WaitersTestClient::waitUntilToArrayFunctionBooleanEquals, GetFunctionToArrayEqualsResponse { diff --git a/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionToNumberTest.kt b/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionToNumberTest.kt index 9ecf5337a..feffad424 100644 --- a/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionToNumberTest.kt +++ b/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionToNumberTest.kt @@ -11,10 +11,11 @@ import com.test.model.GetFunctionToNumberEqualsResponse import com.test.utils.successTest import com.test.waiters.waitUntilToNumberFunctionIntegerEquals import com.test.waiters.waitUntilToNumberFunctionStringEquals -import org.junit.jupiter.api.Test +import kotlin.test.Test class FunctionToNumberTest { - @Test fun testToNumberFunctionStringEquals() = successTest( + @Test + fun testToNumberFunctionStringEquals() = successTest( GetFunctionToNumberEqualsRequest { name = "test" }, WaitersTestClient::waitUntilToNumberFunctionStringEquals, GetFunctionToNumberEqualsResponse { @@ -25,7 +26,8 @@ class FunctionToNumberTest { }, ) - @Test fun testToNumberFunctionIntegerEquals() = successTest( + @Test + fun testToNumberFunctionIntegerEquals() = successTest( GetFunctionToNumberEqualsRequest { name = "test" }, WaitersTestClient::waitUntilToNumberFunctionIntegerEquals, GetFunctionToNumberEqualsResponse { diff --git a/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionToStringTest.kt b/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionToStringTest.kt index 29b38c54e..30b8e228b 100644 --- a/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionToStringTest.kt +++ b/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionToStringTest.kt @@ -11,10 +11,11 @@ import com.test.model.GetFunctionToStringEqualsResponse import com.test.utils.successTest import com.test.waiters.waitUntilToStringFunctionBooleanEquals import com.test.waiters.waitUntilToStringFunctionStringEquals -import org.junit.jupiter.api.Test +import kotlin.test.Test class FunctionToStringTest { - @Test fun testToStringFunctionStringEquals() = successTest( + @Test + fun testToStringFunctionStringEquals() = successTest( GetFunctionToStringEqualsRequest { name = "test" }, WaitersTestClient::waitUntilToStringFunctionStringEquals, GetFunctionToStringEqualsResponse { @@ -25,7 +26,8 @@ class FunctionToStringTest { }, ) - @Test fun testToStringFunctionBooleanEquals() = successTest( + @Test + fun testToStringFunctionBooleanEquals() = successTest( GetFunctionToStringEqualsRequest { name = "test" }, WaitersTestClient::waitUntilToStringFunctionBooleanEquals, GetFunctionToStringEqualsResponse { diff --git a/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionTypeTest.kt b/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionTypeTest.kt index e5d772c80..63e977ff7 100644 --- a/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionTypeTest.kt +++ b/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionTypeTest.kt @@ -14,7 +14,8 @@ import com.test.waiters.* import kotlin.test.Test class FunctionTypeTest { - @Test fun testTypeFunctionStringEquals() = successTest( + @Test + fun testTypeFunctionStringEquals() = successTest( GetFunctionTypeEqualsRequest { name = "test" }, WaitersTestClient::waitUntilTypeFunctionStringEquals, GetFunctionTypeEqualsResponse { @@ -22,7 +23,8 @@ class FunctionTypeTest { }, ) - @Test fun testTypeFunctionBooleanEquals() = successTest( + @Test + fun testTypeFunctionBooleanEquals() = successTest( GetFunctionTypeEqualsRequest { name = "test" }, WaitersTestClient::waitUntilTypeFunctionBooleanEquals, GetFunctionTypeEqualsResponse { @@ -30,7 +32,8 @@ class FunctionTypeTest { }, ) - @Test fun testTypeFunctionArrayEquals() = successTest( + @Test + fun testTypeFunctionArrayEquals() = successTest( GetFunctionTypeEqualsRequest { name = "test" }, WaitersTestClient::waitUntilTypeFunctionArrayEquals, GetFunctionTypeEqualsResponse { @@ -38,7 +41,8 @@ class FunctionTypeTest { }, ) - @Test fun testTypeFunctionShortEquals() = successTest( + @Test + fun testTypeFunctionShortEquals() = successTest( GetFunctionTypeEqualsRequest { name = "test" }, WaitersTestClient::waitUntilTypeFunctionShortEquals, GetFunctionTypeEqualsResponse { @@ -46,7 +50,8 @@ class FunctionTypeTest { }, ) - @Test fun testTypeFunctionIntegerEquals() = successTest( + @Test + fun testTypeFunctionIntegerEquals() = successTest( GetFunctionTypeEqualsRequest { name = "test" }, WaitersTestClient::waitUntilTypeFunctionIntegerEquals, GetFunctionTypeEqualsResponse { @@ -54,7 +59,8 @@ class FunctionTypeTest { }, ) - @Test fun testTypeFunctionLongEquals() = successTest( + @Test + fun testTypeFunctionLongEquals() = successTest( GetFunctionTypeEqualsRequest { name = "test" }, WaitersTestClient::waitUntilTypeFunctionLongEquals, GetFunctionTypeEqualsResponse { @@ -62,7 +68,8 @@ class FunctionTypeTest { }, ) - @Test fun testTypeFunctionFloatEquals() = successTest( + @Test + fun testTypeFunctionFloatEquals() = successTest( GetFunctionTypeEqualsRequest { name = "test" }, WaitersTestClient::waitUntilTypeFunctionFloatEquals, GetFunctionTypeEqualsResponse { @@ -70,7 +77,8 @@ class FunctionTypeTest { }, ) - @Test fun testTypeFunctionDoubleEquals() = successTest( + @Test + fun testTypeFunctionDoubleEquals() = successTest( GetFunctionTypeEqualsRequest { name = "test" }, WaitersTestClient::waitUntilTypeFunctionDoubleEquals, GetFunctionTypeEqualsResponse { @@ -78,7 +86,8 @@ class FunctionTypeTest { }, ) - @Test fun testTypeFunctionObjectEquals() = successTest( + @Test + fun testTypeFunctionObjectEquals() = successTest( GetFunctionTypeEqualsRequest { name = "test" }, WaitersTestClient::waitUntilTypeFunctionObjectEquals, GetFunctionTypeEqualsResponse { @@ -86,7 +95,8 @@ class FunctionTypeTest { }, ) - @Test fun testTypeFunctionMergedObjectEquals() = successTest( + @Test + fun testTypeFunctionMergedObjectEquals() = successTest( GetFunctionTypeEqualsRequest { name = "test" }, WaitersTestClient::waitUntilTypeFunctionMergedObjectEquals, GetFunctionTypeEqualsResponse { @@ -94,7 +104,8 @@ class FunctionTypeTest { }, ) - @Test fun testTypeFunctionNullEquals() = successTest( + @Test + fun testTypeFunctionNullEquals() = successTest( GetFunctionTypeEqualsRequest { name = "test" }, WaitersTestClient::waitUntilTypeFunctionNullEquals, GetFunctionTypeEqualsResponse { diff --git a/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionValuesTest.kt b/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionValuesTest.kt index 2b4d01156..7698fba05 100644 --- a/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionValuesTest.kt +++ b/tests/codegen/waiter-tests/src/test/kotlin/com/test/FunctionValuesTest.kt @@ -11,10 +11,11 @@ import com.test.model.Values import com.test.utils.successTest import com.test.waiters.waitUntilValuesFunctionAnySampleValuesEquals import com.test.waiters.waitUntilValuesFunctionSampleValuesEquals -import org.junit.jupiter.api.Test +import kotlin.test.Test class FunctionValuesTest { - @Test fun testValuesFunctionSampleValuesEquals() = successTest( + @Test + fun testValuesFunctionSampleValuesEquals() = successTest( GetFunctionValuesEqualsRequest { name = "test" }, WaitersTestClient::waitUntilValuesFunctionSampleValuesEquals, GetFunctionValuesEqualsResponse { @@ -33,7 +34,8 @@ class FunctionValuesTest { }, ) - @Test fun testValuesFunctionAnySampleValuesEquals() = successTest( + @Test + fun testValuesFunctionAnySampleValuesEquals() = successTest( GetFunctionValuesEqualsRequest { name = "test" }, WaitersTestClient::waitUntilValuesFunctionAnySampleValuesEquals, GetFunctionValuesEqualsResponse { diff --git a/tests/codegen/waiter-tests/src/test/kotlin/com/test/ListOperationsTest.kt b/tests/codegen/waiter-tests/src/test/kotlin/com/test/ListOperationsTest.kt index 51d592793..9c3d66942 100644 --- a/tests/codegen/waiter-tests/src/test/kotlin/com/test/ListOperationsTest.kt +++ b/tests/codegen/waiter-tests/src/test/kotlin/com/test/ListOperationsTest.kt @@ -7,18 +7,20 @@ package com.test import com.test.model.* import com.test.utils.successTest import com.test.waiters.* -import org.junit.jupiter.api.Test +import kotlin.test.Test class ListOperationsTest { // list indexing - @Test fun testBooleanListIndexZeroEquals() = successTest( + @Test + fun testBooleanListIndexZeroEquals() = successTest( GetListOperationRequest { name = "test" }, WaitersTestClient::waitUntilBooleanListIndexZeroEquals, GetListOperationResponse { lists = EntityLists { booleans = listOf(false) } }, GetListOperationResponse { lists = EntityLists { booleans = listOf(true) } }, ) - @Test fun testBooleanListIndexOneEquals() = successTest( + @Test + fun testBooleanListIndexOneEquals() = successTest( GetListOperationRequest { name = "test" }, WaitersTestClient::waitUntilBooleanListIndexOneEquals, GetListOperationResponse { lists = EntityLists { booleans = listOf(false, false) } }, @@ -26,7 +28,8 @@ class ListOperationsTest { GetListOperationResponse { lists = EntityLists { booleans = listOf(false, true) } }, ) - @Test fun testBooleanListIndexNegativeTwoEquals() = successTest( + @Test + fun testBooleanListIndexNegativeTwoEquals() = successTest( GetListOperationRequest { name = "test" }, WaitersTestClient::waitUntilBooleanListIndexNegativeTwoEquals, GetListOperationResponse { lists = EntityLists { booleans = listOf(false, false) } }, @@ -34,21 +37,24 @@ class ListOperationsTest { GetListOperationResponse { lists = EntityLists { booleans = listOf(true, false) } }, ) - @Test fun testTwoDimensionalBooleanListIndexZeroZeroEquals() = successTest( + @Test + fun testTwoDimensionalBooleanListIndexZeroZeroEquals() = successTest( GetListOperationRequest { name = "test" }, WaitersTestClient::waitUntilTwoDimensionalBooleanListIndexZeroZeroEquals, GetListOperationResponse { twoDimensionalLists = TwoDimensionalEntityLists { booleansList = listOf(listOf(false)) } }, GetListOperationResponse { twoDimensionalLists = TwoDimensionalEntityLists { booleansList = listOf(listOf(true)) } }, ) - @Test fun testStructListIndexOneStringsIndexZeroEquals() = successTest( + @Test + fun testStructListIndexOneStringsIndexZeroEquals() = successTest( GetListOperationRequest { name = "test" }, WaitersTestClient::waitUntilStructListIndexOneStringsIndexZeroEquals, GetListOperationResponse { lists = EntityLists { structs = listOf(Struct { strings = listOf("bar") }, Struct { strings = listOf("bar") }) } }, GetListOperationResponse { lists = EntityLists { structs = listOf(Struct { strings = listOf("bar") }, Struct { strings = listOf("foo") }) } }, ) - @Test fun testStructListIndexOneSubStructsIndexZeroSubStructPrimitivesBooleanEquals() = successTest( + @Test + fun testStructListIndexOneSubStructsIndexZeroSubStructPrimitivesBooleanEquals() = successTest( GetListOperationRequest { name = "test" }, WaitersTestClient::waitUntilStructListIndexOneSubStructsIndexZeroSubStructPrimitivesBooleanEquals, GetListOperationResponse { lists = EntityLists { structs = listOf(Struct { }, Struct { subStructs = listOf(SubStruct { subStructPrimitives = EntityPrimitives { boolean = false } }) }) } }, @@ -56,70 +62,80 @@ class ListOperationsTest { ) // list slicing - @Test fun testStringListStepSlicingEquals() = successTest( + @Test + fun testStringListStepSlicingEquals() = successTest( GetListOperationRequest { name = "test" }, WaitersTestClient::waitUntilStringListStepSlicingEquals, GetListOperationResponse { lists = EntityLists { strings = listOf("bar", "foo", "bar", "foo") } }, GetListOperationResponse { lists = EntityLists { strings = listOf("foo", "bar", "foo", "bar") } }, ) - @Test fun testStringListStopSlicingEquals() = successTest( + @Test + fun testStringListStopSlicingEquals() = successTest( GetListOperationRequest { name = "test" }, WaitersTestClient::waitUntilStringListStopSlicingEquals, GetListOperationResponse { lists = EntityLists { strings = listOf("bar", "bar", "foo", "foo") } }, GetListOperationResponse { lists = EntityLists { strings = listOf("foo", "foo", "bar", "bar") } }, ) - @Test fun testStringListStartSlicingEquals() = successTest( + @Test + fun testStringListStartSlicingEquals() = successTest( GetListOperationRequest { name = "test" }, WaitersTestClient::waitUntilStringListStartSlicingEquals, GetListOperationResponse { lists = EntityLists { strings = listOf("foo", "foo", "bar", "bar") } }, GetListOperationResponse { lists = EntityLists { strings = listOf("bar", "bar", "foo", "foo") } }, ) - @Test fun testStringListStopStepSlicingEquals() = successTest( + @Test + fun testStringListStopStepSlicingEquals() = successTest( GetListOperationRequest { name = "test" }, WaitersTestClient::waitUntilStringListStopStepSlicingEquals, GetListOperationResponse { lists = EntityLists { strings = listOf("bar", "foo", "bar", "foo", "foo", "foo", "foo", "foo") } }, GetListOperationResponse { lists = EntityLists { strings = listOf("foo", "bar", "foo", "bar", "bar", "bar", "bar", "bar") } }, ) - @Test fun testStringListStartStepSlicingEquals() = successTest( + @Test + fun testStringListStartStepSlicingEquals() = successTest( GetListOperationRequest { name = "test" }, WaitersTestClient::waitUntilStringListStartStepSlicingEquals, GetListOperationResponse { lists = EntityLists { strings = listOf("foo", "foo", "bar", "foo", "foo", "bar") } }, GetListOperationResponse { lists = EntityLists { strings = listOf("bar", "bar", "foo", "bar", "bar", "foo") } }, ) - @Test fun testStringListStartStopSlicingEquals() = successTest( + @Test + fun testStringListStartStopSlicingEquals() = successTest( GetListOperationRequest { name = "test" }, WaitersTestClient::waitUntilStringListStartStopSlicingEquals, GetListOperationResponse { lists = EntityLists { strings = listOf("foo", "foo", "foo", "bar", "foo", "foo") } }, GetListOperationResponse { lists = EntityLists { strings = listOf("bar", "bar", "bar", "foo", "bar", "bar") } }, ) - @Test fun testStringListStartStopStepSlicingEquals() = successTest( + @Test + fun testStringListStartStopStepSlicingEquals() = successTest( GetListOperationRequest { name = "test" }, WaitersTestClient::waitUntilStringListStartStopStepSlicingEquals, GetListOperationResponse { lists = EntityLists { strings = listOf("foo", "foo", "bar", "foo", "bar", "foo") } }, GetListOperationResponse { lists = EntityLists { strings = listOf("bar", "bar", "foo", "bar", "foo", "bar") } }, ) - @Test fun testStringListNegativeStartStopSlicingEquals() = successTest( + @Test + fun testStringListNegativeStartStopSlicingEquals() = successTest( GetListOperationRequest { name = "test" }, WaitersTestClient::waitUntilStringListNegativeStartStopSlicingEquals, GetListOperationResponse { lists = EntityLists { strings = listOf("foo", "foo", "bar", "foo") } }, GetListOperationResponse { lists = EntityLists { strings = listOf("bar", "bar", "foo", "bar") } }, ) - @Test fun testStringListStartNegativeStopSlicingEquals() = successTest( + @Test + fun testStringListStartNegativeStopSlicingEquals() = successTest( GetListOperationRequest { name = "test" }, WaitersTestClient::waitUntilStringListStartNegativeStopSlicingEquals, GetListOperationResponse { lists = EntityLists { strings = listOf("foo", "bar", "foo", "foo") } }, GetListOperationResponse { lists = EntityLists { strings = listOf("bar", "foo", "bar", "bar") } }, ) - @Test fun testStringListStopNegativeStartSlicingEquals() = successTest( + @Test + fun testStringListStopNegativeStartSlicingEquals() = successTest( GetListOperationRequest { name = "test" }, WaitersTestClient::waitUntilStringListStopNegativeStartSlicingEquals, GetListOperationResponse { lists = EntityLists { strings = listOf("foo", "bar", "bar", "foo") } }, diff --git a/tests/codegen/waiter-tests/src/test/kotlin/com/test/MultiSelectHashTest.kt b/tests/codegen/waiter-tests/src/test/kotlin/com/test/MultiSelectHashTest.kt index 56de2244f..899b5031d 100644 --- a/tests/codegen/waiter-tests/src/test/kotlin/com/test/MultiSelectHashTest.kt +++ b/tests/codegen/waiter-tests/src/test/kotlin/com/test/MultiSelectHashTest.kt @@ -10,17 +10,19 @@ import com.test.waiters.waitUntilStructListStringMultiSelectHash import com.test.waiters.waitUntilStructListStringsAnyMultiSelectHash import com.test.waiters.waitUntilStructListStringsMultiSelectHash import com.test.waiters.waitUntilStructListSubStructPrimitivesBooleanMultiSelectHash -import org.junit.jupiter.api.Test +import kotlin.test.Test class MultiSelectHashTest { - @Test fun testStructListStringMultiSelectHash() = successTest( + @Test + fun testStructListStringMultiSelectHash() = successTest( GetMultiSelectHashRequest { name = "test" }, WaitersTestClient::waitUntilStructListStringMultiSelectHash, GetMultiSelectHashResponse { lists = EntityLists { structs = listOf(Struct { primitives = EntityPrimitives { string = "bar" } }, Struct { primitives = EntityPrimitives { string = "foo" } }) } }, GetMultiSelectHashResponse { lists = EntityLists { structs = listOf(Struct { primitives = EntityPrimitives { string = "foo" } }, Struct { primitives = EntityPrimitives { string = "bar" } }) } }, ) - @Test fun testStructListStringsMultiSelectHash() = successTest( + @Test + fun testStructListStringsMultiSelectHash() = successTest( GetMultiSelectHashRequest { name = "test" }, WaitersTestClient::waitUntilStructListStringsMultiSelectHash, GetMultiSelectHashResponse { @@ -53,7 +55,8 @@ class MultiSelectHashTest { }, ) - @Test fun testStructListStringsAnyMultiSelectHash() = successTest( + @Test + fun testStructListStringsAnyMultiSelectHash() = successTest( GetMultiSelectHashRequest { name = "test" }, WaitersTestClient::waitUntilStructListStringsAnyMultiSelectHash, GetMultiSelectHashResponse { @@ -86,7 +89,8 @@ class MultiSelectHashTest { }, ) - @Test fun testStructListSubStructPrimitivesBooleanMultiSelectHash() = successTest( + @Test + fun testStructListSubStructPrimitivesBooleanMultiSelectHash() = successTest( GetMultiSelectHashRequest { name = "test" }, WaitersTestClient::waitUntilStructListSubStructPrimitivesBooleanMultiSelectHash, GetMultiSelectHashResponse { diff --git a/tests/codegen/waiter-tests/src/test/kotlin/com/test/MultiSelectListTest.kt b/tests/codegen/waiter-tests/src/test/kotlin/com/test/MultiSelectListTest.kt index 23590b9da..09015a80b 100644 --- a/tests/codegen/waiter-tests/src/test/kotlin/com/test/MultiSelectListTest.kt +++ b/tests/codegen/waiter-tests/src/test/kotlin/com/test/MultiSelectListTest.kt @@ -9,24 +9,27 @@ import com.test.utils.successTest import com.test.waiters.waitUntilStructListStringListMultiSelectList import com.test.waiters.waitUntilStructListStringMultiSelectList import com.test.waiters.waitUntilStructListSubStructPrimitivesBooleanMultiSelectList -import org.junit.jupiter.api.Test +import kotlin.test.Test class MultiSelectListTest { - @Test fun testStructListStringMultiSelectList() = successTest( + @Test + fun testStructListStringMultiSelectList() = successTest( GetMultiSelectListRequest { name = "test" }, WaitersTestClient::waitUntilStructListStringMultiSelectList, GetMultiSelectListResponse { lists = EntityLists { structs = listOf(Struct { primitives = EntityPrimitives { string = "bar" } }, Struct { primitives = EntityPrimitives { string = "foo" } }) } }, GetMultiSelectListResponse { lists = EntityLists { structs = listOf(Struct { primitives = EntityPrimitives { string = "foo" } }, Struct { primitives = EntityPrimitives { string = "bar" } }) } }, ) - @Test fun testStructListStringListMultiSelectList() = successTest( + @Test + fun testStructListStringListMultiSelectList() = successTest( GetMultiSelectListRequest { name = "test" }, WaitersTestClient::waitUntilStructListStringListMultiSelectList, GetMultiSelectListResponse { lists = EntityLists { structs = listOf(Struct { primitives = EntityPrimitives { string = "foo" } }, Struct { primitives = EntityPrimitives { string = "bar" } }) } }, GetMultiSelectListResponse { lists = EntityLists { structs = listOf(Struct { primitives = EntityPrimitives { string = "bar" } }, Struct { primitives = EntityPrimitives { string = "foo" } }) } }, ) - @Test fun testStructListSubStructPrimitivesBooleanMultiSelectList() = successTest( + @Test + fun testStructListSubStructPrimitivesBooleanMultiSelectList() = successTest( GetMultiSelectListRequest { name = "test" }, WaitersTestClient::waitUntilStructListSubStructPrimitivesBooleanMultiSelectList, GetMultiSelectListResponse { diff --git a/tests/codegen/waiter-tests/src/test/kotlin/com/test/PrimitiveEqualityTest.kt b/tests/codegen/waiter-tests/src/test/kotlin/com/test/PrimitiveEqualityTest.kt index 112d324e6..a9c96f0e4 100644 --- a/tests/codegen/waiter-tests/src/test/kotlin/com/test/PrimitiveEqualityTest.kt +++ b/tests/codegen/waiter-tests/src/test/kotlin/com/test/PrimitiveEqualityTest.kt @@ -8,94 +8,107 @@ import com.test.model.* import com.test.model.Enum import com.test.utils.successTest import com.test.waiters.* -import org.junit.jupiter.api.Test +import kotlin.test.Test class PrimitiveEqualityTest { - @Test fun testBooleanEquals() = successTest( + @Test + fun testBooleanEquals() = successTest( GetPrimitiveRequest { name = "test" }, WaitersTestClient::waitUntilBooleanEquals, GetPrimitiveResponse { primitives = EntityPrimitives { boolean = false } }, GetPrimitiveResponse { primitives = EntityPrimitives { boolean = true } }, ) - @Test fun testBooleanEqualsByCompare() = successTest( + @Test + fun testBooleanEqualsByCompare() = successTest( GetPrimitiveRequest { name = "test" }, WaitersTestClient::waitUntilBooleanEqualsByCompare, GetPrimitiveResponse { primitives = EntityPrimitives { boolean = false } }, GetPrimitiveResponse { primitives = EntityPrimitives { boolean = true } }, ) - @Test fun testStringEquals() = successTest( + @Test + fun testStringEquals() = successTest( GetPrimitiveRequest { name = "test" }, WaitersTestClient::waitUntilStringEquals, GetPrimitiveResponse { primitives = EntityPrimitives { string = "bar" } }, GetPrimitiveResponse { primitives = EntityPrimitives { string = "foo" } }, ) - @Test fun testStringEqualsByCompare() = successTest( + @Test + fun testStringEqualsByCompare() = successTest( GetPrimitiveRequest { name = "test" }, WaitersTestClient::waitUntilStringEqualsByCompare, GetPrimitiveResponse { primitives = EntityPrimitives { string = "bar" } }, GetPrimitiveResponse { primitives = EntityPrimitives { string = "foo" } }, ) - @Test fun testByteEquals() = successTest( + @Test + fun testByteEquals() = successTest( GetPrimitiveRequest { name = "test" }, WaitersTestClient::waitUntilByteEquals, GetPrimitiveResponse { primitives = EntityPrimitives { byte = 0x00 } }, GetPrimitiveResponse { primitives = EntityPrimitives { byte = 0x01 } }, ) - @Test fun testShortEquals() = successTest( + @Test + fun testShortEquals() = successTest( GetPrimitiveRequest { name = "test" }, WaitersTestClient::waitUntilShortEquals, GetPrimitiveResponse { primitives = EntityPrimitives { short = 1 } }, GetPrimitiveResponse { primitives = EntityPrimitives { short = 2 } }, ) - @Test fun testIntegerEquals() = successTest( + @Test + fun testIntegerEquals() = successTest( GetPrimitiveRequest { name = "test" }, WaitersTestClient::waitUntilIntegerEquals, GetPrimitiveResponse { primitives = EntityPrimitives { integer = 2 } }, GetPrimitiveResponse { primitives = EntityPrimitives { integer = 3 } }, ) - @Test fun testLongEquals() = successTest( + @Test + fun testLongEquals() = successTest( GetPrimitiveRequest { name = "test" }, WaitersTestClient::waitUntilLongEquals, GetPrimitiveResponse { primitives = EntityPrimitives { long = 3L } }, GetPrimitiveResponse { primitives = EntityPrimitives { long = 4L } }, ) - @Test fun testFloatEquals() = successTest( + @Test + fun testFloatEquals() = successTest( GetPrimitiveRequest { name = "test" }, WaitersTestClient::waitUntilFloatEquals, GetPrimitiveResponse { primitives = EntityPrimitives { float = 4f } }, GetPrimitiveResponse { primitives = EntityPrimitives { float = 5f } }, ) - @Test fun testDoubleEquals() = successTest( + @Test + fun testDoubleEquals() = successTest( GetPrimitiveRequest { name = "test" }, WaitersTestClient::waitUntilDoubleEquals, GetPrimitiveResponse { primitives = EntityPrimitives { double = 5.0 } }, GetPrimitiveResponse { primitives = EntityPrimitives { double = 6.0 } }, ) - @Test fun testEnumEquals() = successTest( + @Test + fun testEnumEquals() = successTest( GetPrimitiveRequest { name = "test" }, WaitersTestClient::waitUntilEnumEquals, GetPrimitiveResponse { primitives = EntityPrimitives { enum = Enum.Two } }, GetPrimitiveResponse { primitives = EntityPrimitives { enum = Enum.One } }, ) - @Test fun testEnumEqualsByCompare() = successTest( + @Test + fun testEnumEqualsByCompare() = successTest( GetPrimitiveRequest { name = "test" }, WaitersTestClient::waitUntilEnumEqualsByCompare, GetPrimitiveResponse { primitives = EntityPrimitives { enum = Enum.Two } }, GetPrimitiveResponse { primitives = EntityPrimitives { enum = Enum.One } }, ) - @Test fun testIntEnumEquals() = successTest( + @Test + fun testIntEnumEquals() = successTest( GetPrimitiveRequest { name = "test" }, WaitersTestClient::waitUntilIntEnumEquals, GetPrimitiveResponse { primitives = EntityPrimitives { intEnum = IntEnum.Two } }, diff --git a/tests/codegen/waiter-tests/src/test/kotlin/com/test/StringEqualsTest.kt b/tests/codegen/waiter-tests/src/test/kotlin/com/test/StringEqualsTest.kt index 47060cb84..dca4b5a80 100644 --- a/tests/codegen/waiter-tests/src/test/kotlin/com/test/StringEqualsTest.kt +++ b/tests/codegen/waiter-tests/src/test/kotlin/com/test/StringEqualsTest.kt @@ -13,18 +13,20 @@ import com.test.waiters.waitUntilEnumListAllStringEquals import com.test.waiters.waitUntilEnumListAnyStringEquals import com.test.waiters.waitUntilStringListAllStringEquals import com.test.waiters.waitUntilStringListAnyStringEquals -import org.junit.jupiter.api.Test +import kotlin.test.Test class StringEqualsTest { // anyStringEquals - @Test fun testStringListAnyListStringEquals() = successTest( + @Test + fun testStringListAnyListStringEquals() = successTest( GetStringEqualsRequest { name = "test" }, WaitersTestClient::waitUntilStringListAnyStringEquals, GetStringEqualsResponse { lists = EntityLists { strings = listOf("bar", "baz") } }, GetStringEqualsResponse { lists = EntityLists { strings = listOf("foo", "bar") } }, ) - @Test fun testEnumListAnyStringEquals() = successTest( + @Test + fun testEnumListAnyStringEquals() = successTest( GetStringEqualsRequest { name = "test" }, WaitersTestClient::waitUntilEnumListAnyStringEquals, GetStringEqualsResponse { lists = EntityLists { enums = listOf(Enum.Two, Enum.Two) } }, @@ -32,14 +34,16 @@ class StringEqualsTest { ) // allStringEquals - @Test fun testStringListAllStringEquals() = successTest( + @Test + fun testStringListAllStringEquals() = successTest( GetStringEqualsRequest { name = "test" }, WaitersTestClient::waitUntilStringListAllStringEquals, GetStringEqualsResponse { lists = EntityLists { strings = listOf("foo", "bar") } }, GetStringEqualsResponse { lists = EntityLists { strings = listOf("foo", "foo") } }, ) - @Test fun testEnumListAllStringEquals() = successTest( + @Test + fun testEnumListAllStringEquals() = successTest( GetStringEqualsRequest { name = "test" }, WaitersTestClient::waitUntilEnumListAllStringEquals, GetStringEqualsResponse { lists = EntityLists { enums = listOf(Enum.One, Enum.Two) } }, diff --git a/tests/codegen/waiter-tests/src/test/kotlin/com/test/SubFieldProjectionTest.kt b/tests/codegen/waiter-tests/src/test/kotlin/com/test/SubFieldProjectionTest.kt index 8bcde5c59..580f5d553 100644 --- a/tests/codegen/waiter-tests/src/test/kotlin/com/test/SubFieldProjectionTest.kt +++ b/tests/codegen/waiter-tests/src/test/kotlin/com/test/SubFieldProjectionTest.kt @@ -9,10 +9,11 @@ import com.test.utils.successTest import com.test.waiters.waitUntilHasFilteredSubStruct import com.test.waiters.waitUntilHasStructWithStringByProjection import com.test.waiters.waitUntilHasStructWithSubstructWithStringByProjection -import org.junit.jupiter.api.Test +import kotlin.test.Test class SubFieldProjectionTest { - @Test fun testHasStructWithStringByProjection() = successTest( + @Test + fun testHasStructWithStringByProjection() = successTest( GetSubFieldProjectionRequest { name = "test" }, WaitersTestClient::waitUntilHasStructWithStringByProjection, GetSubFieldProjectionResponse { }, @@ -40,7 +41,8 @@ class SubFieldProjectionTest { }, ) - @Test fun testHasStructWithSubstructWithStringByProjection() = successTest( + @Test + fun testHasStructWithSubstructWithStringByProjection() = successTest( GetSubFieldProjectionRequest { name = "test" }, WaitersTestClient::waitUntilHasStructWithSubstructWithStringByProjection, GetSubFieldProjectionResponse { }, @@ -78,7 +80,8 @@ class SubFieldProjectionTest { }, ) - @Test fun testHasFilteredSubStruct() = successTest( + @Test + fun testHasFilteredSubStruct() = successTest( GetSubFieldProjectionRequest { name = "test" }, WaitersTestClient::waitUntilHasFilteredSubStruct, GetSubFieldProjectionResponse { },