-
Notifications
You must be signed in to change notification settings - Fork 45
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
Support local deployment's param version matching #404
Changes from all commits
1a2dc0a
6e7ec30
713e14f
e552aed
a4170b1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,6 @@ | |
import com.aws.iot.evergreen.deployment.model.DeploymentPackageConfiguration; | ||
import com.aws.iot.evergreen.kernel.EvergreenService; | ||
import com.aws.iot.evergreen.kernel.Kernel; | ||
import com.aws.iot.evergreen.packagemanager.exceptions.PackageLoadingException; | ||
import com.aws.iot.evergreen.packagemanager.models.PackageIdentifier; | ||
import com.aws.iot.evergreen.packagemanager.models.PackageParameter; | ||
import com.aws.iot.evergreen.packagemanager.models.PackageRecipe; | ||
|
@@ -111,9 +110,9 @@ void GIVEN_deployment_for_package_WHEN_config_resolution_requested_THEN_add_serv | |
TEST_INPUT_PACKAGE_B); | ||
|
||
DeploymentPackageConfiguration rootPackageDeploymentConfig = | ||
new DeploymentPackageConfiguration(TEST_INPUT_PACKAGE_A, true, "1.2", Collections.emptyMap()); | ||
new DeploymentPackageConfiguration(TEST_INPUT_PACKAGE_A, true, "=1.2", Collections.emptyMap()); | ||
DeploymentPackageConfiguration dependencyPackageDeploymentConfig = | ||
new DeploymentPackageConfiguration(TEST_INPUT_PACKAGE_B, false, "2.3", Collections.emptyMap()); | ||
new DeploymentPackageConfiguration(TEST_INPUT_PACKAGE_B, false, "=2.3", Collections.emptyMap()); | ||
DeploymentDocument document = DeploymentDocument.builder() | ||
.rootPackages(Arrays.asList(TEST_INPUT_PACKAGE_A)) | ||
.deploymentPackageConfigurationList( | ||
|
@@ -149,7 +148,6 @@ void GIVEN_deployment_for_package_WHEN_config_resolution_requested_THEN_add_serv | |
dependencyListContains("main", TEST_INPUT_PACKAGE_A, servicesConfig)); | ||
assertThat("Main service must depend on existing service", | ||
dependencyListContains("main", "IpcService" + ":" + DependencyType.HARD, servicesConfig)); | ||
System.out.println(servicesConfig); | ||
assertThat("New service must depend on dependency service", | ||
dependencyListContains(TEST_INPUT_PACKAGE_A, TEST_INPUT_PACKAGE_B, servicesConfig)); | ||
|
||
|
@@ -167,7 +165,7 @@ void GIVEN_deployment_for_existing_package_WHEN_config_resolution_requested_THEN | |
TEST_INPUT_PACKAGE_A); | ||
|
||
DeploymentPackageConfiguration rootPackageDeploymentConfig = | ||
new DeploymentPackageConfiguration(TEST_INPUT_PACKAGE_A, true, "1.2", Collections.emptyMap()); | ||
new DeploymentPackageConfiguration(TEST_INPUT_PACKAGE_A, true, "=1.2", Collections.emptyMap()); | ||
DeploymentDocument document = DeploymentDocument.builder() | ||
.rootPackages(Arrays.asList(TEST_INPUT_PACKAGE_A)) | ||
.deploymentPackageConfigurationList( | ||
|
@@ -213,7 +211,7 @@ void GIVEN_deployment_with_parameters_set_WHEN_config_resolution_requested_THEN_ | |
getSimpleParameterMap(TEST_INPUT_PACKAGE_A), TEST_INPUT_PACKAGE_A); | ||
|
||
DeploymentPackageConfiguration rootPackageDeploymentConfig = | ||
new DeploymentPackageConfiguration(TEST_INPUT_PACKAGE_A, true, "1.2", new HashMap<String, Object>() {{ | ||
new DeploymentPackageConfiguration(TEST_INPUT_PACKAGE_A, true, ">=1.2", new HashMap<String, Object>() {{ | ||
put("PackageA_Param_1", "PackageA_Param_1_value"); | ||
}}); | ||
DeploymentDocument document = DeploymentDocument.builder() | ||
|
@@ -273,22 +271,24 @@ void GIVEN_deployment_with_parameters_set_WHEN_config_resolution_requested_THEN_ | |
|
||
PackageRecipe rootPackageRecipe = getPackage(TEST_INPUT_PACKAGE_A, "1.2", Collections.emptyMap(), | ||
getSimpleParameterMap(TEST_INPUT_PACKAGE_A), TEST_INPUT_PACKAGE_A); | ||
|
||
// B-1.5 -> A-1.2 | ||
PackageRecipe package2Recipe = getPackage(TEST_INPUT_PACKAGE_B, "1.5", Utils.immutableMap(TEST_INPUT_PACKAGE_A, | ||
new RecipeDependencyProperties("=1.2", DependencyType.HARD.toString())), | ||
getSimpleParameterMap(TEST_INPUT_PACKAGE_B), TEST_INPUT_PACKAGE_A); | ||
PackageRecipe package3Recipe = getPackage(TEST_INPUT_PACKAGE_C, "1.5", Collections.emptyMap(), | ||
getSimpleParameterMap(TEST_INPUT_PACKAGE_C), TEST_INPUT_PACKAGE_A); | ||
|
||
DeploymentPackageConfiguration rootPackageDeploymentConfig = | ||
new DeploymentPackageConfiguration(TEST_INPUT_PACKAGE_A, true, "1.2", new HashMap<String, Object>() {{ | ||
new DeploymentPackageConfiguration(TEST_INPUT_PACKAGE_A, true, "=1.2", new HashMap<String, Object>() {{ | ||
put("PackageA_Param_1", "PackageA_Param_1_value"); | ||
}}); | ||
DeploymentPackageConfiguration package2DeploymentConfig = | ||
new DeploymentPackageConfiguration(TEST_INPUT_PACKAGE_B, true, "1.2", new HashMap<String, Object>() {{ | ||
new DeploymentPackageConfiguration(TEST_INPUT_PACKAGE_B, true, "=1.5", new HashMap<String, Object>() {{ | ||
put("PackageB_Param_1", "PackageB_Param_1_value"); | ||
}}); | ||
DeploymentPackageConfiguration package3DeploymentConfig = | ||
new DeploymentPackageConfiguration(TEST_INPUT_PACKAGE_C, true, "1.2", Collections.emptyMap()); | ||
new DeploymentPackageConfiguration(TEST_INPUT_PACKAGE_C, true, "=1.5", Collections.emptyMap()); | ||
DeploymentDocument document = DeploymentDocument.builder() | ||
.rootPackages(Arrays.asList(TEST_INPUT_PACKAGE_A, | ||
TEST_INPUT_PACKAGE_B, TEST_INPUT_PACKAGE_C)) | ||
|
@@ -342,7 +342,7 @@ void GIVEN_deployment_with_params_not_set_WHEN_previous_deployment_had_params_TH | |
getSimpleParameterMap(TEST_INPUT_PACKAGE_A), TEST_INPUT_PACKAGE_A); | ||
|
||
DeploymentPackageConfiguration rootPackageDeploymentConfig = | ||
new DeploymentPackageConfiguration(TEST_INPUT_PACKAGE_A, true, "1.2", Collections.emptyMap()); | ||
new DeploymentPackageConfiguration(TEST_INPUT_PACKAGE_A, true, "=1.2", Collections.emptyMap()); | ||
DeploymentDocument document = DeploymentDocument.builder() | ||
.rootPackages(Arrays.asList(TEST_INPUT_PACKAGE_A)) | ||
.deploymentPackageConfigurationList( | ||
|
@@ -406,7 +406,7 @@ void GIVEN_deployment_with_artifact_WHEN_config_resolution_requested_THEN_artifa | |
}}, Collections.emptyList(), Collections.emptyMap(), null); | ||
|
||
DeploymentPackageConfiguration rootPackageDeploymentConfig = | ||
new DeploymentPackageConfiguration(TEST_INPUT_PACKAGE_A, true, "1.2", Collections.emptyMap()); | ||
new DeploymentPackageConfiguration(TEST_INPUT_PACKAGE_A, true, "=1.2", Collections.emptyMap()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What if the customer isn't specifying requirements? What if it is just There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If it needs to be a version range, then we need to make this clear in the cloud There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
But in reality, right now cloud and local will send a valid "x.y.z" with patch version specified, so we should be good. |
||
DeploymentDocument document = DeploymentDocument.builder() | ||
.rootPackages(Arrays.asList(TEST_INPUT_PACKAGE_A)) | ||
.deploymentPackageConfigurationList( | ||
|
@@ -437,8 +437,7 @@ void GIVEN_deployment_with_artifact_WHEN_config_resolution_requested_THEN_artifa | |
// utilities for mocking input | ||
private PackageRecipe getPackage(String packageName, String packageVersion, | ||
Map<String, RecipeDependencyProperties> dependencies, | ||
Map<String, String> packageParamsWithDefaultsRaw, String crossComponentName) | ||
throws PackageLoadingException { | ||
Map<String, String> packageParamsWithDefaultsRaw, String crossComponentName) { | ||
|
||
Set<PackageParameter> parameters = packageParamsWithDefaultsRaw.entrySet() | ||
.stream() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is findAny() still correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question.
findAny
andfindFirst
might both be correct, as a deployment doc could have multiple entries that satisfy the resolved version (which might change). Let's keep it for now I guess.