Skip to content

Commit

Permalink
Change the default runtime mode to orchestrator
Browse files Browse the repository at this point in the history
  • Loading branch information
jdisanti committed Jul 14, 2023
1 parent c240478 commit 2c9d3be
Show file tree
Hide file tree
Showing 16 changed files with 53 additions and 75 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ jobs:
test:
- action: check-aws-sdk-adhoc-tests
runner: ubuntu-latest
# TODO(enableNewSmithyRuntimeCleanup): Remove `check-aws-sdk-orchestrator-impl` when cleaning up middleware
- action: check-aws-sdk-orchestrator-impl
# TODO(enableNewSmithyRuntimeCleanup): Remove `check-aws-sdk-middleware-impl` when cleaning up middleware
- action: check-aws-sdk-middleware-impl
runner: smithy_ubuntu-latest_8-core
- action: check-client-codegen-integration-tests
runner: smithy_ubuntu-latest_8-core
Expand Down
2 changes: 1 addition & 1 deletion aws/rust-runtime/aws-config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,7 @@ mod loader {
assert_eq!(Some(&app_name), conf.app_name());
}

#[cfg(aws_sdk_orchestrator_mode)]
#[cfg(not(aws_sdk_middleware_mode))]
#[tokio::test]
async fn disable_default_credentials() {
let config = from_env().no_credentials().load().await;
Expand Down
2 changes: 1 addition & 1 deletion aws/sdk-adhoc-test/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ dependencies {
implementation("software.amazon.smithy:smithy-aws-traits:$smithyVersion")
}

fun getSmithyRuntimeMode(): String = properties.get("smithy.runtime.mode") ?: "middleware"
fun getSmithyRuntimeMode(): String = properties.get("smithy.runtime.mode") ?: "orchestrator"

val allCodegenTests = listOf(
CodegenTest(
Expand Down
2 changes: 1 addition & 1 deletion aws/sdk/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ val crateVersioner by lazy { aws.sdk.CrateVersioner.defaultFor(rootProject, prop

fun getRustMSRV(): String = properties.get("rust.msrv") ?: throw Exception("Rust MSRV missing")
fun getPreviousReleaseVersionManifestPath(): String? = properties.get("aws.sdk.previous.release.versions.manifest")
fun getSmithyRuntimeMode(): String = properties.get("smithy.runtime.mode") ?: "middleware"
fun getSmithyRuntimeMode(): String = properties.get("smithy.runtime.mode") ?: "orchestrator"

fun loadServiceMembership(): Membership {
val membershipOverride = properties.get("aws.services")?.let { parseMembership(it) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use criterion::{criterion_group, criterion_main, Criterion};

fn do_bench() {
#[cfg(not(aws_sdk_orchestrator_mode))]
#[cfg(aws_sdk_middleware_mode)]
{
use aws_sdk_dynamodb::operation::query::Query;
use aws_smithy_http::response::ParseHttpResponse;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ macro_rules! attr_obj {
}

fn do_bench(_config: &Config, _input: &PutItemInput) {
#[cfg(not(aws_sdk_orchestrator_mode))]
#[cfg(aws_sdk_middleware_mode)]
{
use futures_util::FutureExt;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

#[cfg(aws_sdk_orchestrator_mode)]
#[cfg(not(aws_sdk_middleware_mode))]
mod test {
use aws_sdk_dynamodb::config::{Credentials, Region, SharedAsyncSleep};
use aws_sdk_dynamodb::{config::retry::RetryConfig, error::ProvideErrorMetadata};
Expand Down
4 changes: 2 additions & 2 deletions aws/sdk/integration-tests/kms/tests/retryable_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

#[cfg(not(aws_sdk_orchestrator_mode))]
#[cfg(aws_sdk_middleware_mode)]
mod middleware_mode_tests {
use aws_http::retry::AwsResponseRetryClassifier;
use aws_sdk_kms as kms;
Expand Down Expand Up @@ -66,7 +66,7 @@ mod middleware_mode_tests {
}
}

#[cfg(aws_sdk_orchestrator_mode)]
#[cfg(not(aws_sdk_middleware_mode))]
mod orchestrator_mode_tests {
use aws_credential_types::Credentials;
use aws_runtime::retries::classifier::AwsErrorCodeClassifier;
Expand Down
10 changes: 5 additions & 5 deletions aws/sdk/integration-tests/s3/tests/alternative-async-runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use aws_smithy_types::timeout::TimeoutConfig;
use std::fmt::Debug;
use std::time::{Duration, Instant};

#[cfg(aws_sdk_orchestrator_mode)]
#[cfg(not(aws_sdk_middleware_mode))]
use aws_smithy_runtime::test_util::capture_test_logs::capture_test_logs;

#[derive(Debug)]
Expand All @@ -36,7 +36,7 @@ impl AsyncSleep for SmolSleep {

#[test]
fn test_smol_runtime_timeouts() {
#[cfg(aws_sdk_orchestrator_mode)]
#[cfg(not(aws_sdk_middleware_mode))]
let _guard = capture_test_logs();

if let Err(err) = smol::block_on(async { timeout_test(SharedAsyncSleep::new(SmolSleep)).await })
Expand All @@ -48,7 +48,7 @@ fn test_smol_runtime_timeouts() {

#[test]
fn test_smol_runtime_retry() {
#[cfg(aws_sdk_orchestrator_mode)]
#[cfg(not(aws_sdk_middleware_mode))]
let _guard = capture_test_logs();

if let Err(err) = smol::block_on(async { retry_test(SharedAsyncSleep::new(SmolSleep)).await }) {
Expand All @@ -68,7 +68,7 @@ impl AsyncSleep for AsyncStdSleep {

#[test]
fn test_async_std_runtime_timeouts() {
#[cfg(aws_sdk_orchestrator_mode)]
#[cfg(not(aws_sdk_middleware_mode))]
let _guard = capture_test_logs();

if let Err(err) = async_std::task::block_on(async {
Expand All @@ -81,7 +81,7 @@ fn test_async_std_runtime_timeouts() {

#[test]
fn test_async_std_runtime_retry() {
#[cfg(aws_sdk_orchestrator_mode)]
#[cfg(not(aws_sdk_middleware_mode))]
let _guard = capture_test_logs();

if let Err(err) =
Expand Down
10 changes: 5 additions & 5 deletions aws/sdk/integration-tests/s3/tests/config-override.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use aws_sdk_s3::Client;
use aws_smithy_client::test_connection::{capture_request, CaptureRequestReceiver};
use aws_types::SdkConfig;

// TODO(enableNewSmithyRuntimeCleanup): Remove this attribute once #[cfg(aws_sdk_orchestrator_mode)]
// TODO(enableNewSmithyRuntimeCleanup): Remove this attribute once #[cfg(aws_sdk_middleware_mode)]
// has been removed
#[allow(dead_code)]
fn test_client() -> (CaptureRequestReceiver, Client) {
Expand All @@ -23,7 +23,7 @@ fn test_client() -> (CaptureRequestReceiver, Client) {
(captured_request, client)
}

#[cfg(aws_sdk_orchestrator_mode)]
#[cfg(not(aws_sdk_middleware_mode))]
#[tokio::test]
async fn operation_overrides_force_path_style() {
let (captured_request, client) = test_client();
Expand All @@ -42,7 +42,7 @@ async fn operation_overrides_force_path_style() {
);
}

#[cfg(aws_sdk_orchestrator_mode)]
#[cfg(not(aws_sdk_middleware_mode))]
#[tokio::test]
async fn operation_overrides_fips() {
let (captured_request, client) = test_client();
Expand All @@ -61,7 +61,7 @@ async fn operation_overrides_fips() {
);
}

#[cfg(aws_sdk_orchestrator_mode)]
#[cfg(not(aws_sdk_middleware_mode))]
#[tokio::test]
async fn operation_overrides_dual_stack() {
let (captured_request, client) = test_client();
Expand All @@ -84,7 +84,7 @@ async fn operation_overrides_dual_stack() {
// accessed in ServiceRuntimePlugin::config. Currently, a credentials cache created for a single
// operation invocation is not picked up by an identity resolver.
/*
#[cfg(aws_sdk_orchestrator_mode)]
#[cfg(not(aws_sdk_middleware_mode))]
#[tokio::test]
async fn operation_overrides_credentials_provider() {
let (captured_request, client) = test_client();
Expand Down
4 changes: 2 additions & 2 deletions aws/sdk/integration-tests/s3/tests/endpoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ async fn dual_stack() {
);
}

#[cfg(aws_sdk_orchestrator_mode)]
#[cfg(not(aws_sdk_middleware_mode))]
#[tokio::test]
async fn multi_region_access_points() {
let (_captured_request, client) = test_client(|b| b);
Expand All @@ -84,7 +84,7 @@ async fn multi_region_access_points() {
);
}

#[cfg(not(aws_sdk_orchestrator_mode))]
#[cfg(aws_sdk_middleware_mode)]
#[tokio::test]
async fn multi_region_access_points() {
let (_captured_request, client) = test_client(|b| b);
Expand Down
4 changes: 2 additions & 2 deletions aws/sdk/integration-tests/sts/tests/signing-it.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ async fn assume_role_signed() {
}

// TODO(enableNewSmithyRuntimeCleanup): Delete the middleware version of this test
#[cfg(not(aws_sdk_orchestrator_mode))]
#[cfg(aws_sdk_middleware_mode)]
#[tokio::test]
async fn web_identity_unsigned() {
let creds = Credentials::for_tests();
Expand All @@ -44,7 +44,7 @@ async fn web_identity_unsigned() {
);
}

#[cfg(aws_sdk_orchestrator_mode)]
#[cfg(not(aws_sdk_middleware_mode))]
#[tokio::test]
async fn web_identity_unsigned() {
let (server, request) = capture_request(None);
Expand Down
2 changes: 1 addition & 1 deletion codegen-client-test/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ plugins {
val smithyVersion: String by project
val defaultRustDocFlags: String by project
val properties = PropertyRetriever(rootProject, project)
fun getSmithyRuntimeMode(): String = properties.get("smithy.runtime.mode") ?: "middleware"
fun getSmithyRuntimeMode(): String = properties.get("smithy.runtime.mode") ?: "orchestrator"

val pluginName = "rust-client-codegen"
val workingDirUnderBuildDir = "smithyprojections/codegen-client-test/"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ data class ClientCodegenConfig(
private const val defaultIncludeFluentClient = true
private const val defaultAddMessageToErrors = true
private val defaultEventStreamAllowList: Set<String> = emptySet()
private val defaultEnableNewSmithyRuntime = SmithyRuntimeMode.Middleware
private val defaultEnableNewSmithyRuntime = SmithyRuntimeMode.Orchestrator

fun fromCodegenConfigAndNode(coreCodegenConfig: CoreCodegenConfig, node: Optional<ObjectNode>) =
if (node.isPresent) {
Expand Down
27 changes: 27 additions & 0 deletions tools/ci-scripts/check-aws-sdk-middleware-impl
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash
#
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
#

# This script tests the SDK smoke test services against the middleware implementation

C_YELLOW='\033[1;33m'
C_RESET='\033[0m'

set -eu
cd smithy-rs

./gradlew aws:sdk:assemble -Psmithy.runtime.mode=middleware

cd aws/sdk/build/aws-sdk/sdk
for service in */; do
pushd "${service}"
echo -e "${C_YELLOW}# Running 'cargo test --all-features' on '${service}'${C_RESET}"
RUSTFLAGS="${RUSTFLAGS:-} --cfg aws_sdk_middleware_mode" cargo test --all-features --all-targets --no-fail-fast
echo -e "${C_YELLOW}# Running 'cargo clippy --all-features' on '${service}'${C_RESET}"
RUSTFLAGS="${RUSTFLAGS:-} --cfg aws_sdk_middleware_mode" cargo clippy --all-features
popd
done

echo "SUCCESS"
49 changes: 0 additions & 49 deletions tools/ci-scripts/check-aws-sdk-orchestrator-impl

This file was deleted.

0 comments on commit 2c9d3be

Please sign in to comment.