Skip to content

Commit

Permalink
Merge branch 'awslabs:main' into relax-credentials-chain-logs
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleksandr Kolomiiets authored Jul 26, 2022
2 parents 5fac53f + 2670831 commit 37f9368
Showing 1 changed file with 15 additions and 26 deletions.
41 changes: 15 additions & 26 deletions tools/publisher/src/subcommand/fix_manifests/validate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ use tracing::info;
/// Validations that run before the manifests are fixed.
///
/// For now, this validates:
/// - `aws-config` version number matches all `aws-sdk-` prefixed versions
/// - `aws-smithy-` prefixed versions match `aws-` (NOT `aws-sdk-`) prefixed versions
pub(super) fn validate_before_fixes(
versions: &BTreeMap<String, Version>,
Expand All @@ -27,21 +26,14 @@ pub(super) fn validate_before_fixes(
}

info!("Pre-validation manifests...");
let maybe_sdk_version = versions.get("aws-config");
let expected_smithy_version = versions
let expected_runtime_version = versions
.get("aws-smithy-types")
.ok_or_else(|| anyhow!("`aws-smithy-types` crate missing"))?;

for (name, version) in versions {
let category = PackageCategory::from_package_name(name);
if category == PackageCategory::SmithyRuntime {
confirm_version(name, expected_smithy_version, version)?;
} else if let Some(expected_sdk_version) = maybe_sdk_version {
if category.is_sdk() {
confirm_version(name, expected_sdk_version, version)?;
}
} else if category.is_sdk() {
bail!("`aws-config` crate missing");
if category == PackageCategory::SmithyRuntime || category == PackageCategory::AwsRuntime {
confirm_version(name, expected_runtime_version, version)?;
}
}
Ok(())
Expand Down Expand Up @@ -98,10 +90,10 @@ mod test {
#[test]
fn pre_validate() {
expect_success(&[
("aws-config", "0.5.1"),
("aws-config", "0.35.1"),
("aws-sdk-s3", "0.5.1"),
("aws-smithy-types", "0.35.1"),
("aws-types", "0.5.1"),
("aws-types", "0.35.1"),
]);

expect_success(&[
Expand All @@ -119,30 +111,27 @@ mod test {
],
);

expect_failure(
"Crate named `aws-sdk-s3` should be at version `0.5.1` but is at `0.5.0`",
&[
("aws-config", "0.5.1"),
("aws-sdk-s3", "0.5.0"),
("aws-smithy-types", "0.35.1"),
("aws-types", "0.5.1"),
],
);
expect_success(&[
("aws-config", "0.35.1"),
("aws-sdk-s3", "0.5.0"),
("aws-smithy-types", "0.35.1"),
("aws-types", "0.35.1"),
]);

expect_failure(
"Crate named `aws-types` should be at version `0.5.1` but is at `0.5.0`",
"Crate named `aws-types` should be at version `0.35.1` but is at `0.35.0`",
&[
("aws-config", "0.5.1"),
("aws-config", "0.35.1"),
("aws-sdk-s3", "0.5.1"),
("aws-smithy-types", "0.35.1"),
("aws-types", "0.5.0"),
("aws-types", "0.35.0"),
],
);

expect_failure(
"Crate named `aws-smithy-http` should be at version `0.35.1` but is at `0.35.0`",
&[
("aws-config", "0.5.1"),
("aws-config", "0.35.1"),
("aws-sdk-s3", "0.5.1"),
("aws-smithy-types", "0.35.1"),
("aws-smithy-http", "0.35.0"),
Expand Down

0 comments on commit 37f9368

Please sign in to comment.