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

testsys: cargo make test for ECS variants #2348

Merged
merged 1 commit into from Aug 31, 2022

Conversation

ecpullen
Copy link
Contributor

@ecpullen ecpullen commented Aug 15, 2022

Issue number:

Closes #2150

Description of changes:

Adds support for ECS variants testing. Everything works the same way as aws-k8s variants except ECS clusters are created instead of EKS, and there is not supported conformance testing for ECS variants.

Testing done:

Tested with quick and migration tests.

Terms of contribution:

By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.

TESTING.md Outdated
@@ -137,7 +137,7 @@ If you run `cargo make test` for a variant that is not yet enabled, it will prin
Check back here and follow the issues relevant to your variant of interest.

- `aws-k8s` conformance testing is working!
- `aws-ecs`: https://github.com/bottlerocket-os/bottlerocket/issues/2150
- `aws-ecs`: conformance and migration testing is working!
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In your PR description you said that conformance isn't supported

@@ -137,7 +137,7 @@ If you run `cargo make test` for a variant that is not yet enabled, it will prin
Check back here and follow the issues relevant to your variant of interest.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: for the lack of a better place

Could you please add a description in the commit message? You could just use what you used in the PR description. This is useful for the community if they want to know more about the reasoning behind the change, without having to chase down pull requests.

TESTING.md Outdated Show resolved Hide resolved
TESTING.md Outdated
@@ -219,7 +248,8 @@ WORKING_BRANCH="develop"
git checkout "${WORKING_BRANCH}"
```

Next, build Bottlerocket images and repos and sync TUF repos.
Next, build Bottlerocket images and repos and sync TUF repos.
The architecture and variant can be configured with `-e BUILDSYS_ARCH="aws-k8s-1.21"` and `-e BUILDSYS_VARIANT="x86_64"`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: You could just say "by setting BUILDSYS_ARCH and BUILDSYS_VARIANT``"

tools/testsys/src/aws_resources.rs Show resolved Hide resolved
self.variant.replace('.', "")
}

/// Bottlerocket cluster naming convention.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Maybe an example of how does that look like? Or is the convention documented somewhere?

}
}

/// In order to easily create migration tests for `aws-k8s` variants we need to implement
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not for aws-k8s variants

Comment on lines 219 to 221
if let Some(name) = crd.name() {
info!("Successfully added '{}'", name)
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it safe to assume that at this point name() won't return None and thus you can do unwrap?

@@ -252,6 +278,14 @@ pub(crate) struct TestsysImages {
)]
pub(crate) eks_resource: String,

/// Ecs resource agent uri. If not provided the latest released resource agent will be used.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: s|Ecs|ECS for all occurrences

@@ -268,6 +302,14 @@ pub(crate) struct TestsysImages {
)]
pub(crate) sonobuoy_test: String,

/// Ecs test agent uri. If not provided the latest released test agent will be used.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: s|uri|URI

TESTING.md Outdated
@@ -136,8 +136,8 @@ We haven't yet enabled `cargo make test` for every variant, though much of the u
If you run `cargo make test` for a variant that is not yet enabled, it will print an error message.
Check back here and follow the issues relevant to your variant of interest.

- `aws-k8s` conformance testing is working!
- `aws-ecs`: https://github.com/bottlerocket-os/bottlerocket/issues/2150
- `aws-k8s` conformance and migration testing are working!
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll keep updates in the readme related to the k8s variants in either a different commit, or a different PR.

TESTING.md Show resolved Hide resolved
&get_ami_id(
format!(
"bottlerocket-{}-{}-{}-{}",
self.variant, self.arch, self.starting_version.as_ref().context("The starting version must be provided for migration testing")?, self.migrate_starting_commit.as_ref().context("The commit for the starting version must be provided if the starting image id is not")?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this being formatted by cargo fmt? It seems like a very long line.

tools/testsys/src/aws_resources.rs Show resolved Hide resolved
vpc: None,
}
.into_map()
.context("Unable to convert ecs config to map")?,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pedantic nit: s/ecs/ECS, or if you are referring to the structure, use the whole name EcsClusterConfig, the same applies to s/ec2/EC2

@ecpullen ecpullen changed the title testsys: cargo make test for ecs variants testsys: cargo make test for ECS variants Aug 26, 2022
Copy link
Contributor

@bcressey bcressey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM once @arnaldo2792 is happy.

@@ -244,31 +268,47 @@ pub(crate) struct Image {

#[derive(Debug, Parser)]
pub(crate) struct TestsysImages {
/// Eks resource agent uri. If not provided the latest released resource agent will be used.
/// Eks resource agent URI. If not provided the latest released resource agent will be used.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:

Suggested change
/// Eks resource agent URI. If not provided the latest released resource agent will be used.
/// EKS resource agent URI. If not provided the latest released resource agent will be used.

Comment on lines +470 to +476
fn kube_arch(&self) -> String {
self.arch.replace('_', "-")
}

fn kube_variant(&self) -> String {
self.variant.replace('.', "")
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we rename these helper functions?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have any suggestions?

TESTING.md Outdated
### aws-ecs

You need to [build](BUILDING.md) Bottlerocket and create an AMI before you can run a test.
The instance type can be configured for nvidia variants by setting `TESTSYS_INSTANCE_TYPE="p3.2xlarge"`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say something along these lines

The default instance type to be used is <blah>, but can be controlled by setting the environment variable `TESTSYS_INSTANCE_TYPE`.
This is useful while testing NVIDIA variants, since they require instance types with support for NVIDIA GPUs.

Adds support for ecs variants testing. Everything works the same way as aws-k8s variants except ECS clusters are created instead of EKS, and there is not supported conformance testing for ecs variants.
@ecpullen ecpullen merged commit 006adf0 into bottlerocket-os:develop Aug 31, 2022
@ecpullen ecpullen deleted the cargo-make-ecs branch August 31, 2022 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cargo make test for aws-ecs variants
3 participants