Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the check manifests tool #1576

Merged
merged 2 commits into from
Jul 26, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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