-
Notifications
You must be signed in to change notification settings - Fork 42
Bg stop reorder #1761
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
base: master
Are you sure you want to change the base?
Bg stop reorder #1761
Conversation
ea825d7 to
dd016cb
Compare
LMCROSSITXSADEPLOY-3367
dd016cb to
7150540
Compare
|
Yavor16
left a comment
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.
Can you add also unit test for PrepareToStopDependentModulesStep
| package org.cloudfoundry.multiapps.controller.process.steps; | ||
|
|
||
| import jakarta.inject.Named; | ||
|
|
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.
I think you can remove this from the PR
| modifiedApp = ImmutableCloudApplicationExtended.builder() | ||
| .from(modifiedApp) | ||
| .staging(modifiedApp.getStaging()) | ||
| .routes(getApplicationRoutes(context, modifiedApp)) | ||
| .env(calculatedAppEnv) | ||
| .build(); |
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.
Can you exctract this this creatin logic in a new method
| Module applicationModule = findModuleInDeploymentDescriptor(context, getCurrentModuleToStop(context).getName()); | ||
| context.setVariable(Variables.MODULE_TO_DEPLOY, applicationModule); | ||
| CloudApplicationExtended modifiedApp = getApplicationCloudModelBuilder(context).build(applicationModule, moduleToDeployHelper); | ||
| Map<String, String> calculatedAppEnv = applicationEnvironmentCalculator.calculateNewApplicationEnv(context, modifiedApp); | ||
| modifiedApp = ImmutableCloudApplicationExtended.builder() | ||
| .from(modifiedApp) | ||
| .staging(modifiedApp.getStaging()) | ||
| .routes(getApplicationRoutes(context, modifiedApp)) | ||
| .env(calculatedAppEnv) | ||
| .build(); | ||
| context.setVariable(Variables.APP_TO_PROCESS, modifiedApp); | ||
| return StepPhase.DONE; |
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.
Why are you creating here new APP_TO_PROCESS here and what is the difference from the old one?
| import jakarta.inject.Inject; | ||
| import org.cloudfoundry.multiapps.controller.core.cf.metadata.processor.MtaMetadataParser; | ||
| import org.cloudfoundry.multiapps.controller.process.util.HooksCalculator; | ||
| import org.cloudfoundry.multiapps.controller.process.util.HooksExecutor; | ||
| import org.cloudfoundry.multiapps.controller.process.util.HooksPhaseBuilder; | ||
| import org.cloudfoundry.multiapps.controller.process.util.HooksPhaseGetter; | ||
| import org.cloudfoundry.multiapps.controller.process.util.ImmutableHooksCalculator; | ||
| import org.cloudfoundry.multiapps.controller.process.util.ImmutableModuleDeterminer; | ||
| import org.cloudfoundry.multiapps.controller.process.util.ModuleDeterminer; | ||
| import org.cloudfoundry.multiapps.controller.process.variables.Variables; | ||
| import org.cloudfoundry.multiapps.mta.model.Hook; | ||
| import org.cloudfoundry.multiapps.mta.model.Module; | ||
|
|
||
| import jakarta.inject.Inject; | ||
|
|
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.
This class can be removed
| private boolean supportsDeployedAfter(Module module) { | ||
| return module.getMajorSchemaVersion() >= 3; | ||
| } |
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.
Should we print a error message if the user is using verions older than 3 and want to use the parameter
| completeDeploymentDescriptor.setModules(List.of(module)); | ||
| context.setVariable(Variables.DEPENDENT_MODULES_TO_STOP, List.of(module)); | ||
| context.setVariable(Variables.APPS_TO_STOP_INDEX, 0); | ||
| context.setVariable(Variables.MTA_MAJOR_SCHEMA_VERSION, 3); |
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.
You can add unit test for schema version 2. So you can test the validation of the version
| ImmutableCloudApplicationExtended applicationExtended = ImmutableCloudApplicationExtended.builder() | ||
| .name("test-module") | ||
| .metadata(ImmutableCloudMetadata.of( | ||
| UUID.randomUUID() | ||
| )) | ||
| .staging(createStaging( | ||
| true)) | ||
| .build(); |
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.
Can you test with normal and idle route so we can conver this condition also
| import static org.mockito.Mockito.verify; | ||
| import static org.mockito.Mockito.when; | ||
|
|
||
| class StopDependentModuleStepTest extends SyncFlowableStepTest<StopDependentModuleStep> { |
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.
Can you add test if client.getApplication(idleName); returns null
| <sequenceFlow id="sid-0F200B9A-6462-48CD-BA2D-6E6F1CE15D96" sourceRef="deleteIdleRoutesTask" targetRef="shouldManageServiceBroker"></sequenceFlow> | ||
| <sequenceFlow id="skipDeleteIdleRoutesFlow" sourceRef="shouldDeleteIdleRoutes" targetRef="shouldManageServiceBroker"></sequenceFlow> |
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.
Why did you change the location of sequence flows?
| import org.cloudfoundry.multiapps.controller.process.variables.Variables; | ||
| import org.cloudfoundry.multiapps.mta.model.Hook; | ||
| import org.cloudfoundry.multiapps.mta.model.Module; | ||
|
|
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.
You may revert the changes as they are not part of this PR



No description provided.