From 19914a1829aacf46238b3e6233e4194416a6fdbb Mon Sep 17 00:00:00 2001 From: Sichan Yoo Date: Wed, 16 Oct 2024 16:25:57 -0700 Subject: [PATCH] Revert temporarily commented logic in PrepareRelease. Fix client name bug. Add convenience script for running every smoke test. --- .../Subcommands/PrepareRelease.swift | 20 ++++---- .../swift/codegen/AWSSmokeTestGenerator.kt | 6 +-- scripts/run-every-smoke-test.sh | 46 +++++++++++++++++++ 3 files changed, 59 insertions(+), 13 deletions(-) create mode 100755 scripts/run-every-smoke-test.sh diff --git a/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Commands/AWSSDKSwiftCLI/Subcommands/PrepareRelease.swift b/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Commands/AWSSDKSwiftCLI/Subcommands/PrepareRelease.swift index b1f58b72234..1d21c45ea1c 100644 --- a/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Commands/AWSSDKSwiftCLI/Subcommands/PrepareRelease.swift +++ b/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Commands/AWSSDKSwiftCLI/Subcommands/PrepareRelease.swift @@ -81,16 +81,16 @@ struct PrepareRelease { try FileManager.default.changeWorkingDirectory(repoPath) let previousVersion = try getPreviousVersion() -// guard try repoHasChanges(previousVersion) else { -// /// If repo has no changes, create an empty release-manifest.json file. -// /// Empty manifest file makes GitHubReleasePublisher be no-op. -// /// The manifest file is required regardless of whether there should -// /// be a release or not. -// try createEmptyReleaseManifest() -// /// Return without creating new commit or tag in local repos. -// /// This makes GitPublisher be no-op. -// return -// } + guard try repoHasChanges(previousVersion) else { + /// If repo has no changes, create an empty release-manifest.json file. + /// Empty manifest file makes GitHubReleasePublisher be no-op. + /// The manifest file is required regardless of whether there should + /// be a release or not. + try createEmptyReleaseManifest() + /// Return without creating new commit or tag in local repos. + /// This makes GitPublisher be no-op. + return + } let newVersion = try createNewVersion(previousVersion) try stageFiles() diff --git a/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/AWSSmokeTestGenerator.kt b/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/AWSSmokeTestGenerator.kt index 53e4d81c95b..aeb317c8557 100644 --- a/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/AWSSmokeTestGenerator.kt +++ b/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/AWSSmokeTestGenerator.kt @@ -13,11 +13,11 @@ class AWSSmokeTestGenerator( // Filter out tests by name or tag at codegen time. // Each element must have the prefix ":" before the test name or tag name. // E.g., "AWSS3:GetObjectTest" or "AWSS3:BucketTests" - override val testIdsToIgnore = setOf( + override val smokeTestIdsToIgnore = setOf( // Add smoke test name to ignore here: // E.g., "AWSACM:GetCertificateFailure", ) - override val testTagsToIgnore = setOf( + override val smokeTestTagsToIgnore = setOf( // Add smoke test tag to ignore here: // E.g., "AWSACM:TagToIgnore", ) @@ -27,7 +27,7 @@ class AWSSmokeTestGenerator( } override fun getClientName(): String { - return ctx.service.getTrait(ServiceTrait::class.java).get().sdkId.toUpperCamelCase() + "Client" + return ctx.service.getTrait(ServiceTrait::class.java).get().sdkId.toUpperCamelCase().removeSuffix("Service") + "Client" } override fun renderCustomFilePrivateVariables(writer: SwiftWriter) { diff --git a/scripts/run-every-smoke-test.sh b/scripts/run-every-smoke-test.sh new file mode 100755 index 00000000000..3cb3dd77f99 --- /dev/null +++ b/scripts/run-every-smoke-test.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +# This is a convenience script for developers for running every smoke test under SmokeTests/. +# The script must be run from aws-sdk-swift/, the directory containing SmokeTests/. + +# cd into test module dir +cd SmokeTests/ || { echo "ERROR: Failed to change directory to SmokeTests."; exit 1; } + +# Build and discard output for clean log +echo "INFO: Building SmokeTests module..." +swift build > /dev/null 2>&1 + +# Header print helpers +print_header() { + print_spacer + local header=$1 + echo "##### $header #####" + print_spacer +} + +print_spacer() { + echo "" +} + +# Build and run each and every test runner; save result to results array +print_header "TEST RUNS" +results=() +for runnerName in ./*; do + if [ -d "$runnerName" ]; then + swift run "${runnerName#./}" + if [ $? -eq 0 ]; then + # Record success + results+=("SUCCESS: ${runnerName#./}") + else + # record failure + results+=("FAILURE: ${runnerName#./}") + fi + print_spacer + fi +done + +# Print result summary +print_header "TEST RESULT SUMMARY" +for result in "${results[@]}"; do + echo "$result" +done