Unverified Commit 26708311 authored by John DiSanti's avatar John DiSanti Committed by GitHub
Browse files

Fix the check manifests tool (#1576)

parent 720a106b
Loading
Loading
Loading
Loading
+15 −26
Original line number Diff line number Diff line
@@ -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>,
@@ -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(())
@@ -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(&[
@@ -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"),
        expect_success(&[
            ("aws-config", "0.35.1"),
            ("aws-sdk-s3", "0.5.0"),
            ("aws-smithy-types", "0.35.1"),
                ("aws-types", "0.5.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"),