@spinnaker/amazon 2026.3.1 → 2026.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/common/AwsModalFooter.d.ts +1 -1
- package/dist/deploymentStrategy/AdditionalFields.d.ts +1 -1
- package/dist/function/CreateLambdaFunction.d.ts +1 -1
- package/dist/function/configure/ExecutionRole.d.ts +1 -1
- package/dist/function/configure/FunctionBasicInformation.d.ts +1 -1
- package/dist/function/configure/FunctionDebugAndErrorHandling.d.ts +1 -1
- package/dist/function/configure/FunctionEnvironmentVariables.d.ts +1 -1
- package/dist/function/configure/FunctionSettings.d.ts +1 -1
- package/dist/function/configure/FunctionTags.d.ts +1 -1
- package/dist/function/configure/Network.d.ts +1 -1
- package/dist/function/details/AmazonFunctionDetails.d.ts +1 -1
- package/dist/function/details/FunctionActions.d.ts +1 -1
- package/dist/index.js +279 -1
- package/dist/index.js.map +1 -1
- package/dist/instance/details/AmazonInstanceInformation.d.ts +2 -2
- package/dist/instance/details/CostFactor.d.ts +2 -2
- package/dist/instance/details/InstanceDns.d.ts +2 -2
- package/dist/instance/details/InstanceInformation.d.ts +2 -2
- package/dist/instance/details/InstanceSecurityGroups.d.ts +2 -2
- package/dist/instance/details/InstanceStatus.d.ts +2 -2
- package/dist/instance/details/InstanceTags.d.ts +2 -2
- package/dist/loadBalancer/configure/AmazonLoadBalancerChoiceModal.d.ts +1 -1
- package/dist/loadBalancer/configure/application/ALBListeners.d.ts +1 -1
- package/dist/loadBalancer/configure/application/ConfigureOidcConfigModal.d.ts +1 -1
- package/dist/loadBalancer/configure/application/ConfigureRedirectConfigModal.d.ts +1 -1
- package/dist/loadBalancer/configure/application/CreateApplicationLoadBalancer.d.ts +1 -1
- package/dist/loadBalancer/configure/application/TargetGroups.d.ts +1 -1
- package/dist/loadBalancer/configure/classic/AdvancedSettings.d.ts +1 -1
- package/dist/loadBalancer/configure/classic/HealthCheck.d.ts +1 -1
- package/dist/loadBalancer/configure/classic/Listeners.d.ts +1 -1
- package/dist/loadBalancer/configure/common/AmazonCertificateSelectField.d.ts +1 -1
- package/dist/loadBalancer/configure/common/LoadBalancerLocation.d.ts +1 -1
- package/dist/loadBalancer/configure/common/SecurityGroups.d.ts +1 -1
- package/dist/loadBalancer/configure/network/CertificateSelectors.d.ts +2 -2
- package/dist/loadBalancer/configure/network/NLBListeners.d.ts +1 -1
- package/dist/loadBalancer/configure/network/TargetGroups.d.ts +1 -1
- package/dist/loadBalancer/details/LoadBalancerActions.d.ts +1 -1
- package/dist/pipeline/stages/AmazonStageConfig.d.ts +2 -2
- package/dist/pipeline/stages/bake/AwsBakeStageConfig.d.ts +2 -2
- package/dist/pipeline/stages/cloneServerGroup/AwsCloneServerGroupStageConfig.d.ts +2 -2
- package/dist/pipeline/stages/deleteLambda/DeleteLambdaFunctionStageForm.d.ts +2 -2
- package/dist/pipeline/stages/deleteLambda/LambdaDeleteStage.d.ts +2 -2
- package/dist/pipeline/stages/deleteLambda/constants/deleteVersion.picker.d.ts +1 -1
- package/dist/pipeline/stages/deployCloudFormation/CloudFormationChangeSetInfo.d.ts +2 -2
- package/dist/pipeline/stages/deployCloudFormation/DeployCloudFormationStackStageConfig.d.ts +2 -2
- package/dist/pipeline/stages/deployCloudFormation/deployCloudFormationExecutionDetails.d.ts +1 -1
- package/dist/pipeline/stages/deployCloudFormation/evaluateCloudFormationChangeSetExecutionApproval.d.ts +2 -2
- package/dist/pipeline/stages/deployCloudFormation/evaluateCloudFormationChangeSetExecutionDetails.d.ts +1 -1
- package/dist/pipeline/stages/deployCloudFormation/evaluateCloudFormationChangeSetExecutionLabel.d.ts +1 -1
- package/dist/pipeline/stages/deployCloudFormation/evaluateCloudFormationChangeSetExecutionMarkerIcon.d.ts +1 -1
- package/dist/pipeline/stages/deployLambda/components/AwsLambdaFunctionStageForm.d.ts +2 -2
- package/dist/pipeline/stages/deployLambda/components/BasicSettingsForm.d.ts +2 -2
- package/dist/pipeline/stages/deployLambda/components/EnvironmentForm.d.ts +2 -2
- package/dist/pipeline/stages/deployLambda/components/ExecutionRoleForm.d.ts +2 -2
- package/dist/pipeline/stages/deployLambda/components/LambdaAtEdgeForm.d.ts +2 -2
- package/dist/pipeline/stages/deployLambda/components/NetworkForm.d.ts +2 -2
- package/dist/pipeline/stages/deployLambda/components/TriggerEventsForm.d.ts +2 -2
- package/dist/pipeline/stages/deployLambda/config/LambdaDeploymentStageConfig.d.ts +2 -2
- package/dist/pipeline/stages/deployLambda/config/LambdaDeploymentStageExecutionDetails.d.ts +2 -2
- package/dist/pipeline/stages/disableAsg/AwsDisableAsgStageConfig.d.ts +2 -2
- package/dist/pipeline/stages/disableCluster/AwsDisableClusterStageConfig.d.ts +2 -2
- package/dist/pipeline/stages/enableAsg/AwsEnableAsgStageConfig.d.ts +2 -2
- package/dist/pipeline/stages/findImageFromTags/AwsFindImageFromTagsStageConfig.d.ts +2 -2
- package/dist/pipeline/stages/invokeLambda/InvokeLambdaFunctionStageForm.d.ts +2 -2
- package/dist/pipeline/stages/invokeLambda/LambdaInvokeStage.d.ts +2 -2
- package/dist/pipeline/stages/invokeLambda/components/InvokeLambdaOperation.d.ts +2 -2
- package/dist/pipeline/stages/modifyScalingProcess/ModifyScalingProcessStageConfig.d.ts +2 -2
- package/dist/pipeline/stages/modifyWarmPool/ModifyWarmPoolStageConfig.d.ts +2 -2
- package/dist/pipeline/stages/resizeAsg/AwsResizeAsgStageConfig.d.ts +2 -2
- package/dist/pipeline/stages/rollbackCluster/AwsRollbackClusterStageConfig.d.ts +2 -2
- package/dist/pipeline/stages/routeLambda/LambdaRouteStage.d.ts +2 -2
- package/dist/pipeline/stages/routeLambda/RouteLambdaFunctionStageForm.d.ts +2 -2
- package/dist/pipeline/stages/routeLambda/TriggerEventsForm.d.ts +2 -2
- package/dist/pipeline/stages/routeLambda/components/BlueGreenDeployment/BlueGreenDeploymentForm.d.ts +2 -2
- package/dist/pipeline/stages/routeLambda/components/BlueGreenDeployment/HealthCheckStrategy.d.ts +2 -2
- package/dist/pipeline/stages/routeLambda/components/BlueGreenDeployment/InvocationHealthCheck.d.ts +2 -2
- package/dist/pipeline/stages/routeLambda/components/DeploymentStrategyForm.d.ts +2 -2
- package/dist/pipeline/stages/routeLambda/components/RenderStrategy.d.ts +2 -2
- package/dist/pipeline/stages/routeLambda/components/SimpleDeploymentForm.d.ts +2 -2
- package/dist/pipeline/stages/routeLambda/components/VersionPicker.d.ts +1 -1
- package/dist/pipeline/stages/routeLambda/components/WeightedDeploymentForm.d.ts +2 -2
- package/dist/pipeline/stages/routeLambda/constants/strategy.picker.d.ts +1 -1
- package/dist/pipeline/stages/scaleDownCluster/AwsScaleDownClusterStageConfig.d.ts +2 -2
- package/dist/pipeline/stages/shrinkCluster/AwsShrinkClusterStageConfig.d.ts +2 -2
- package/dist/pipeline/stages/tagImage/awsTagImageStage.d.ts +2 -2
- package/dist/pipeline/stages/updateCodeLambda/LambdaUpdateCodeStageConfig.d.ts +2 -2
- package/dist/pipeline/stages/updateCodeLambda/LambdaUpdateCodeStageExecutionDetails.d.ts +2 -2
- package/dist/pipeline/stages/updateCodeLambda/components/UpdateCodeStageForm.d.ts +2 -2
- package/dist/securityGroup/details/IPRangeRules.d.ts +1 -1
- package/dist/serverGroup/configure/AmazonImageSelectInput.d.ts +1 -1
- package/dist/serverGroup/configure/wizard/AmazonCloneServerGroupModal.d.ts +1 -1
- package/dist/serverGroup/configure/wizard/ServerGroupTemplateSelection.d.ts +1 -1
- package/dist/serverGroup/configure/wizard/capacity/CapacitySelector.d.ts +1 -1
- package/dist/serverGroup/configure/wizard/capacity/MinMaxDesired.d.ts +1 -1
- package/dist/serverGroup/configure/wizard/instanceType/CpuCreditsToggle.d.ts +2 -2
- package/dist/serverGroup/configure/wizard/instanceType/InstanceTypeSelector.d.ts +2 -2
- package/dist/serverGroup/configure/wizard/instanceType/InstanceTypeWarning.d.ts +2 -2
- package/dist/serverGroup/configure/wizard/instanceType/advancedMode/AdvancedModeSelector.d.ts +2 -2
- package/dist/serverGroup/configure/wizard/instanceType/advancedMode/AmazonInstanceTypeInfoRenderer.d.ts +2 -2
- package/dist/serverGroup/configure/wizard/instanceType/advancedMode/InstanceProfileSelector.d.ts +2 -2
- package/dist/serverGroup/configure/wizard/instanceType/advancedMode/InstanceTypeRow.d.ts +2 -2
- package/dist/serverGroup/configure/wizard/instanceType/advancedMode/InstanceTypeSelect.d.ts +2 -2
- package/dist/serverGroup/configure/wizard/instanceType/advancedMode/InstanceTypeTable.d.ts +2 -2
- package/dist/serverGroup/configure/wizard/instanceType/advancedMode/InstanceTypeTableBody.d.ts +2 -2
- package/dist/serverGroup/configure/wizard/instanceType/advancedMode/InstanceTypeTableParts.d.ts +4 -4
- package/dist/serverGroup/configure/wizard/instanceType/advancedMode/InstancesDistribution.d.ts +2 -2
- package/dist/serverGroup/configure/wizard/instanceType/simpleMode/SimpleModeSelector.d.ts +2 -2
- package/dist/serverGroup/configure/wizard/pages/ServerGroupBasicSettings.d.ts +1 -1
- package/dist/serverGroup/configure/wizard/pages/ServerGroupCapacity.d.ts +1 -1
- package/dist/serverGroup/configure/wizard/pages/ServerGroupInstanceType.d.ts +1 -1
- package/dist/serverGroup/configure/wizard/pages/ServerGroupLoadBalancers.d.ts +1 -1
- package/dist/serverGroup/configure/wizard/pages/ServerGroupSecurityGroups.d.ts +1 -1
- package/dist/serverGroup/configure/wizard/pages/ServerGroupZones.d.ts +1 -1
- package/dist/serverGroup/configure/wizard/pages/advancedSettings/ServerGroupAdvancedSettings.d.ts +1 -1
- package/dist/serverGroup/configure/wizard/pages/advancedSettings/ServerGroupAdvancedSettingsCommon.d.ts +1 -1
- package/dist/serverGroup/configure/wizard/pages/advancedSettings/ServerGroupAdvancedSettingsInner.d.ts +1 -1
- package/dist/serverGroup/configure/wizard/securityGroups/SecurityGroupSelector.d.ts +1 -1
- package/dist/serverGroup/configure/wizard/securityGroups/ServerGroupSecurityGroupsRemoved.d.ts +1 -1
- package/dist/serverGroup/details/advancedSettings/EditAsgAdvancedSettingsModal.d.ts +2 -1
- package/dist/serverGroup/details/resize/AmazonResizeServerGroupModal.d.ts +1 -1
- package/dist/serverGroup/details/scalingPolicy/CreateScalingPolicyButton.d.ts +1 -1
- package/dist/serverGroup/details/scalingPolicy/ScalingPolicySummary.d.ts +2 -2
- package/dist/serverGroup/details/scalingPolicy/StepPolicySummary.d.ts +2 -2
- package/dist/serverGroup/details/scalingPolicy/chart/DateLineChart.d.ts +2 -2
- package/dist/serverGroup/details/scalingPolicy/chart/MetricAlarmChart.d.ts +3 -3
- package/dist/serverGroup/details/scalingPolicy/popover/AlarmSummary.d.ts +2 -2
- package/dist/serverGroup/details/scalingPolicy/popover/StepPolicyPopoverContent.d.ts +2 -2
- package/dist/serverGroup/details/scalingPolicy/targetTracking/TargetMetricFields.d.ts +2 -2
- package/dist/serverGroup/details/scalingPolicy/targetTracking/TargetTrackingAdditionalSettings.d.ts +2 -3
- package/dist/serverGroup/details/scalingPolicy/targetTracking/TargetTrackingChart.d.ts +2 -2
- package/dist/serverGroup/details/scalingPolicy/targetTracking/TargetTrackingSummary.d.ts +2 -2
- package/dist/serverGroup/details/scalingPolicy/targetTracking/UpsertTargetTrackingModal.d.ts +2 -2
- package/dist/serverGroup/details/scalingPolicy/upsert/PolicyTypeSelectionModal.d.ts +2 -2
- package/dist/serverGroup/details/scalingPolicy/upsert/ScalingPolicyAdditionalSettings.d.ts +2 -2
- package/dist/serverGroup/details/scalingPolicy/upsert/UpsertScalingPolicyModal.d.ts +2 -2
- package/dist/serverGroup/details/scalingPolicy/upsert/alarm/AlarmConfigurer.d.ts +2 -2
- package/dist/serverGroup/details/scalingPolicy/upsert/alarm/DimensionsEditor.d.ts +2 -2
- package/dist/serverGroup/details/scalingPolicy/upsert/alarm/MetricSelector.d.ts +2 -2
- package/dist/serverGroup/details/scalingPolicy/upsert/simple/SimplePolicyAction.d.ts +2 -2
- package/dist/serverGroup/details/scalingPolicy/upsert/step/StepPolicyAction.d.ts +2 -2
- package/dist/serverGroup/details/scalingProcesses/ModifyScalingProcessesModal.d.ts +1 -1
- package/dist/serverGroup/details/scheduledAction/ScheduledAction.d.ts +1 -1
- package/dist/serverGroup/details/scheduledActions/EditScheduledActionsModal.d.ts +1 -1
- package/dist/serverGroup/details/sections/InstancesDistributionDetailsSection.d.ts +2 -2
- package/dist/serverGroup/details/sections/LaunchTemplateDetailsSection.d.ts +2 -2
- package/dist/serverGroup/details/sections/MultipleInstanceTypesSubSection.d.ts +2 -2
- package/dist/serverGroup/details/securityGroups/EditSecurityGroupsModal.d.ts +1 -1
- package/dist/serverGroup/details/warmPool/ModifyWarmPoolModal.d.ts +1 -1
- package/dist/subnet/SubnetSelectField.d.ts +1 -1
- package/dist/subnet/SubnetSelectInput.d.ts +1 -1
- package/dist/vpc/VpcTag.d.ts +2 -2
- package/package.json +5 -7
- package/src/aws.module.spec.ts +20 -21
- package/src/function/details/AmazonFunctionDetails.tsx +1 -1
- package/src/function/details/FunctionActions.spec.tsx +56 -36
- package/src/instance/awsInstanceType.service.spec.js +24 -22
- package/src/instance/details/AmazonInstanceDetails.spec.tsx +7 -7
- package/src/instance/details/InstanceInformation.spec.tsx +44 -24
- package/src/loadBalancer/AmazonLoadBalancersTag.spec.tsx +1 -1
- package/src/loadBalancer/TargetGroupDetails.spec.tsx +5 -5
- package/src/loadBalancer/configure/application/TargetGroups.tsx +1 -1
- package/src/loadBalancer/configure/common/SecurityGroups.spec.tsx +4 -4
- package/src/loadBalancer/configure/network/TargetGroups.tsx +1 -1
- package/src/loadBalancer/details/amazonLoadBalancerDetails.spec.tsx +31 -53
- package/src/pipeline/stages/AmazonStageConfig.spec.tsx +37 -46
- package/src/pipeline/stages/deployCloudFormation/DeployCloudFormationStackStageConfig.tsx +1 -0
- package/src/pipeline/stages/deployCloudFormation/deployCloudFormationStackStage.spec.tsx +316 -279
- package/src/pipeline/stages/findImageFromTags/AwsFindImageFromTagsStageConfig.spec.tsx +70 -90
- package/src/pipeline/stages/modifyScalingProcess/modifyScalingProcessStage.spec.tsx +198 -130
- package/src/pipeline/stages/modifyWarmPool/modifyWarmPoolStage.spec.tsx +49 -40
- package/src/pipeline/stages/resizeAsg/AwsResizeAsgStageConfig.spec.tsx +341 -427
- package/src/pipeline/stages/resizeAsg/AwsResizeAsgStageConfig.tsx +7 -0
- package/src/pipeline/stages/tagImage/awsTagImageStage.spec.tsx +62 -107
- package/src/routerConsumers.spec.tsx +23 -23
- package/src/securityGroup/configure/AmazonSecurityGroupModal.spec.tsx +38 -47
- package/src/securityGroup/details/AmazonSecurityGroupDetails.spec.tsx +7 -6
- package/src/serverGroup/configure/AmazonImageSelectInput.spec.tsx +47 -65
- package/src/serverGroup/configure/AmazonImageSelectInput.tsx +1 -1
- package/src/serverGroup/configure/serverGroupCommandBuilder.aws.service.spec.js +18 -19
- package/src/serverGroup/configure/serverGroupCommandBuilder.spec.js +41 -26
- package/src/serverGroup/configure/wizard/instanceType/simpleMode/SimpleModeSelector.spec.tsx +52 -75
- package/src/serverGroup/configure/wizard/pages/ServerGroupBasicSettings.spec.tsx +1 -1
- package/src/serverGroup/configure/wizard/pages/advancedSettings/ServerGroupAdvancedSettingsCommon.spec.tsx +36 -33
- package/src/serverGroup/configure/wizard/pages/advancedSettings/ServerGroupAdvancedSettingsCommon.tsx +7 -1
- package/src/serverGroup/configure/wizard/securityGroups/SecurityGroupSelector.spec.tsx +2 -2
- package/src/serverGroup/details/AmazonServerGroupActions.spec.tsx +79 -67
- package/src/serverGroup/details/advancedSettings/EditAsgAdvancedSettingsModal.spec.tsx +78 -66
- package/src/serverGroup/details/advancedSettings/EditAsgAdvancedSettingsModal.tsx +23 -6
- package/src/serverGroup/details/rollback/AmazonRollbackServerGroupModal.spec.tsx +86 -94
- package/src/serverGroup/details/rollback/AmazonRollbackServerGroupModal.tsx +3 -0
- package/src/serverGroup/details/scalingPolicy/targetTracking/TargetTrackingAdditionalSettings.tsx +1 -39
- package/src/serverGroup/details/scalingPolicy/targetTracking/UpsertTargetTrackingModal.tsx +0 -1
- package/src/serverGroup/details/scalingProcesses/ModifyScalingProcessesModal.spec.tsx +5 -5
- package/src/serverGroup/details/scheduledActions/EditScheduledActionsModal.spec.tsx +8 -8
- package/src/serverGroup/details/sections/AmazonServerGroupMaintenanceActions.spec.tsx +71 -60
- package/src/serverGroup/details/sections/InstancesDistributionDetailsSection.spec.tsx +21 -39
- package/src/serverGroup/details/sections/LaunchTemplateDetailsSection.spec.tsx +56 -97
- package/src/serverGroup/details/securityGroups/EditSecurityGroupsModal.spec.tsx +48 -77
- package/src/serverGroup/details/warmPool/ModifyWarmPoolModal.spec.tsx +5 -5
- package/src/vpc/VpcReader.spec.ts +1 -1
- package/src/vpc/VpcTag.spec.tsx +11 -15
- /package/dist/{amazon.logo352d4e042476837f.svg → amazon.logoBzC5E-3F.svg} +0 -0
|
@@ -2,7 +2,7 @@ import { ServerGroupBasicSettingsComponent } from './ServerGroupBasicSettings';
|
|
|
2
2
|
|
|
3
3
|
describe('Amazon ServerGroupBasicSettings', () => {
|
|
4
4
|
it('opens the latest server group through the injected state service', () => {
|
|
5
|
-
const stateService = { go:
|
|
5
|
+
const stateService = { go: vi.fn(), is: () => true };
|
|
6
6
|
const component = new ServerGroupBasicSettingsComponent({
|
|
7
7
|
app: {
|
|
8
8
|
clusters: [],
|
|
@@ -1,53 +1,56 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import { Form, Formik } from 'formik';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
|
|
5
5
|
import { ServerGroupAdvancedSettingsCommon } from './ServerGroupAdvancedSettingsCommon';
|
|
6
6
|
|
|
7
7
|
describe('ServerGroupAdvancedSettingsCommon', () => {
|
|
8
8
|
it('uses the standard wizard label grid instead of centering the form controls', () => {
|
|
9
|
-
|
|
10
|
-
<
|
|
9
|
+
render(
|
|
10
|
+
<Formik initialValues={buildValues() as any} onSubmit={vi.fn()}>
|
|
11
|
+
{(formik) => (
|
|
12
|
+
<Form>
|
|
13
|
+
<ServerGroupAdvancedSettingsCommon app={buildApplication() as any} formik={formik as any} />
|
|
14
|
+
</Form>
|
|
15
|
+
)}
|
|
16
|
+
</Formik>,
|
|
11
17
|
);
|
|
12
18
|
|
|
13
|
-
|
|
14
|
-
expect(
|
|
19
|
+
const cooldown = screen.getByRole('textbox', { name: 'Cooldown' });
|
|
20
|
+
expect(screen.getByText('Cooldown').closest('.sm-label-right')).toHaveClass('col-md-3');
|
|
21
|
+
expect(cooldown.closest('.form-group')).toHaveClass('form-group');
|
|
22
|
+
expect(cooldown.parentElement).toHaveClass('col-md-2');
|
|
15
23
|
});
|
|
16
24
|
});
|
|
17
25
|
|
|
18
26
|
function buildApplication() {
|
|
19
|
-
return {
|
|
20
|
-
attributes: {
|
|
21
|
-
platformHealthOnlyShowOverride: false,
|
|
22
|
-
},
|
|
23
|
-
};
|
|
27
|
+
return { attributes: { platformHealthOnlyShowOverride: false } };
|
|
24
28
|
}
|
|
25
29
|
|
|
26
|
-
function
|
|
30
|
+
function buildValues() {
|
|
27
31
|
return {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
associatePublicIpAddress: null,
|
|
31
|
-
backingData: {
|
|
32
|
-
enabledMetrics: [],
|
|
33
|
-
filtered: { keyPairs: [] },
|
|
34
|
-
healthCheckTypes: [],
|
|
35
|
-
scalingProcesses: [],
|
|
36
|
-
terminationPolicies: [],
|
|
37
|
-
},
|
|
38
|
-
ebsOptimized: false,
|
|
32
|
+
associatePublicIpAddress: null,
|
|
33
|
+
backingData: {
|
|
39
34
|
enabledMetrics: [],
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
keyPair: '',
|
|
44
|
-
requireIMDSv2: false,
|
|
45
|
-
selectBlockDeviceMappingsSource: jasmine.createSpy('selectBlockDeviceMappingsSource'),
|
|
46
|
-
suspendedProcesses: [],
|
|
47
|
-
tags: {},
|
|
35
|
+
filtered: { keyPairs: [] },
|
|
36
|
+
healthCheckTypes: [],
|
|
37
|
+
scalingProcesses: [],
|
|
48
38
|
terminationPolicies: [],
|
|
49
|
-
toggleSuspendedProcess: jasmine.createSpy('toggleSuspendedProcess'),
|
|
50
|
-
viewState: { useSimpleInstanceTypeSelector: true },
|
|
51
39
|
},
|
|
40
|
+
cooldown: 0,
|
|
41
|
+
ebsOptimized: false,
|
|
42
|
+
enabledMetrics: [],
|
|
43
|
+
getBlockDeviceMappingsSource: vi.fn().mockReturnValue('default'),
|
|
44
|
+
healthCheckGracePeriod: 0,
|
|
45
|
+
healthCheckType: 'EC2',
|
|
46
|
+
instanceMonitoring: false,
|
|
47
|
+
keyPair: '',
|
|
48
|
+
requireIMDSv2: false,
|
|
49
|
+
selectBlockDeviceMappingsSource: vi.fn(),
|
|
50
|
+
suspendedProcesses: [],
|
|
51
|
+
tags: {},
|
|
52
|
+
terminationPolicies: [],
|
|
53
|
+
toggleSuspendedProcess: vi.fn(),
|
|
54
|
+
viewState: { useSimpleInstanceTypeSelector: true },
|
|
52
55
|
};
|
|
53
56
|
}
|
|
@@ -62,7 +62,13 @@ export class ServerGroupAdvancedSettingsCommon extends React.Component<IServerGr
|
|
|
62
62
|
<b>Cooldown</b>
|
|
63
63
|
</div>
|
|
64
64
|
<div className="col-md-2">
|
|
65
|
-
<Field
|
|
65
|
+
<Field
|
|
66
|
+
type="text"
|
|
67
|
+
required={true}
|
|
68
|
+
name="cooldown"
|
|
69
|
+
aria-label="Cooldown"
|
|
70
|
+
className="form-control input-sm no-spel"
|
|
71
|
+
/>
|
|
66
72
|
</div>{' '}
|
|
67
73
|
seconds
|
|
68
74
|
</div>
|
|
@@ -4,7 +4,7 @@ import { SecurityGroupSelector } from './SecurityGroupSelector';
|
|
|
4
4
|
|
|
5
5
|
describe('SecurityGroupSelector', () => {
|
|
6
6
|
it('renders when the security group cache has not been registered', () => {
|
|
7
|
-
spyOn(InfrastructureCaches, 'get').
|
|
7
|
+
vi.spyOn(InfrastructureCaches, 'get').mockReturnValue(undefined);
|
|
8
8
|
|
|
9
9
|
expect(() => new SecurityGroupSelector(buildProps() as any)).not.toThrow();
|
|
10
10
|
});
|
|
@@ -15,6 +15,6 @@ function buildProps() {
|
|
|
15
15
|
command: { selectedProvider: 'aws' },
|
|
16
16
|
availableGroups: [],
|
|
17
17
|
groupsToEdit: [],
|
|
18
|
-
onChange:
|
|
18
|
+
onChange: vi.fn(),
|
|
19
19
|
};
|
|
20
20
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { act, render, screen } from '@testing-library/react';
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
2
3
|
import React from 'react';
|
|
3
4
|
|
|
4
5
|
import type { Application } from '@spinnaker/core';
|
|
5
|
-
import { ConfirmationModalService,
|
|
6
|
+
import { ConfirmationModalService, DeckRuntimeContext, ServerGroupWarningMessageService } from '@spinnaker/core';
|
|
6
7
|
|
|
7
8
|
import type { IAmazonServerGroupView } from '../../domain';
|
|
8
9
|
import { AWSProviderSettings } from '../../aws.settings';
|
|
@@ -11,13 +12,6 @@ import { AmazonRollbackServerGroupModal } from './rollback';
|
|
|
11
12
|
|
|
12
13
|
describe('<AmazonServerGroupActions /> rollback integration', () => {
|
|
13
14
|
const originalAdHocInfraWritesEnabled = AWSProviderSettings.adHocInfraWritesEnabled;
|
|
14
|
-
const runtimeServices = {} as any;
|
|
15
|
-
|
|
16
|
-
const shallowActions = (component: React.ReactElement) => {
|
|
17
|
-
const wrapper = shallow(component);
|
|
18
|
-
(wrapper.instance() as any).context = { services: runtimeServices };
|
|
19
|
-
return wrapper;
|
|
20
|
-
};
|
|
21
15
|
|
|
22
16
|
const buildServerGroup = (overrides: Partial<IAmazonServerGroupView> = {}): IAmazonServerGroupView =>
|
|
23
17
|
({
|
|
@@ -41,11 +35,30 @@ describe('<AmazonServerGroupActions /> rollback integration', () => {
|
|
|
41
35
|
getDataSource: (key: string) => (key === 'serverGroups' ? { data: serverGroups } : undefined),
|
|
42
36
|
isManagementPaused: false,
|
|
43
37
|
name: 'test-app',
|
|
44
|
-
serverGroups: { refresh:
|
|
38
|
+
serverGroups: { refresh: vi.fn() },
|
|
45
39
|
} as any);
|
|
46
40
|
|
|
47
|
-
const
|
|
48
|
-
|
|
41
|
+
const renderActions = (
|
|
42
|
+
app: Application,
|
|
43
|
+
serverGroup: IAmazonServerGroupView,
|
|
44
|
+
stateService: any = { go: vi.fn(), includes: vi.fn() },
|
|
45
|
+
runtimeServices: any = {},
|
|
46
|
+
) => ({
|
|
47
|
+
runtimeServices,
|
|
48
|
+
...render(
|
|
49
|
+
<DeckRuntimeContext.Provider value={{ services: runtimeServices } as any}>
|
|
50
|
+
<AmazonServerGroupActions
|
|
51
|
+
app={app}
|
|
52
|
+
router={{} as any}
|
|
53
|
+
serverGroup={serverGroup}
|
|
54
|
+
stateParams={{}}
|
|
55
|
+
stateService={stateService}
|
|
56
|
+
/>
|
|
57
|
+
</DeckRuntimeContext.Provider>,
|
|
58
|
+
),
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
const openActions = () => userEvent.click(screen.getByRole('button', { name: 'Server Group Actions' }));
|
|
49
62
|
|
|
50
63
|
beforeEach(() => {
|
|
51
64
|
AWSProviderSettings.adHocInfraWritesEnabled = true;
|
|
@@ -55,23 +68,18 @@ describe('<AmazonServerGroupActions /> rollback integration', () => {
|
|
|
55
68
|
AWSProviderSettings.adHocInfraWritesEnabled = originalAdHocInfraWritesEnabled;
|
|
56
69
|
});
|
|
57
70
|
|
|
58
|
-
it('renders standalone Rollback as a managed action and opens the modal with exact enriched state', () => {
|
|
71
|
+
it('renders standalone Rollback as a managed action and opens the modal with exact enriched state', async () => {
|
|
59
72
|
const selected = buildServerGroup({ isDisabled: true, name: 'test-app-main-v001' });
|
|
60
73
|
const rollbackSource = buildServerGroup();
|
|
61
74
|
const unrelated = buildServerGroup({ app: 'other-app', cluster: 'other-app-main', name: 'other-app-main-v001' });
|
|
62
75
|
const application = buildApplication([selected, rollbackSource, unrelated]);
|
|
63
|
-
const show = spyOn(AmazonRollbackServerGroupModal, 'show').
|
|
64
|
-
const
|
|
76
|
+
const show = vi.spyOn(AmazonRollbackServerGroupModal, 'show').mockReturnValue(Promise.resolve({} as any));
|
|
77
|
+
const { runtimeServices } = renderActions(application, selected);
|
|
65
78
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
expect(rollback.props()).toEqual(
|
|
69
|
-
jasmine.objectContaining({ application, resource: selected, onClick: jasmine.any(Function) }),
|
|
70
|
-
);
|
|
79
|
+
await openActions();
|
|
80
|
+
await userEvent.click(screen.getByText('Rollback'));
|
|
71
81
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
expect(show).toHaveBeenCalledOnceWith(
|
|
82
|
+
expect(show).toHaveBeenCalledExactlyOnceWith(
|
|
75
83
|
{
|
|
76
84
|
allServerGroups: [selected],
|
|
77
85
|
application,
|
|
@@ -82,26 +90,28 @@ describe('<AmazonServerGroupActions /> rollback integration', () => {
|
|
|
82
90
|
);
|
|
83
91
|
});
|
|
84
92
|
|
|
85
|
-
it('does not render Rollback when a disabled server group has no enabled rollback source', () => {
|
|
93
|
+
it('does not render Rollback when a disabled server group has no enabled rollback source', async () => {
|
|
86
94
|
const selected = buildServerGroup({ isDisabled: true, name: 'test-app-main-v001' });
|
|
87
|
-
|
|
95
|
+
renderActions(buildApplication([selected]), selected);
|
|
96
|
+
await openActions();
|
|
88
97
|
|
|
89
|
-
expect(
|
|
98
|
+
expect(screen.queryByText('Rollback')).not.toBeInTheDocument();
|
|
90
99
|
});
|
|
91
100
|
|
|
92
101
|
it('opens rollback settings when orchestrated rollback is accepted from Enable', async () => {
|
|
93
102
|
const selected = buildServerGroup({ isDisabled: true, name: 'test-app-main-v001' });
|
|
94
103
|
const rollbackSource = buildServerGroup();
|
|
95
104
|
const application = buildApplication([selected, rollbackSource]);
|
|
96
|
-
const confirm = spyOn(ConfirmationModalService, 'confirm').
|
|
97
|
-
const show = spyOn(AmazonRollbackServerGroupModal, 'show').
|
|
98
|
-
const
|
|
105
|
+
const confirm = vi.spyOn(ConfirmationModalService, 'confirm').mockReturnValue(Promise.resolve() as any);
|
|
106
|
+
const show = vi.spyOn(AmazonRollbackServerGroupModal, 'show').mockReturnValue(Promise.resolve({} as any));
|
|
107
|
+
const { runtimeServices } = renderActions(application, selected);
|
|
99
108
|
|
|
100
|
-
|
|
109
|
+
await openActions();
|
|
110
|
+
await userEvent.click(screen.getByText('Enable'));
|
|
101
111
|
await settle();
|
|
102
112
|
|
|
103
113
|
expect(confirm).toHaveBeenCalledTimes(1);
|
|
104
|
-
expect(show).
|
|
114
|
+
expect(show).toHaveBeenCalledExactlyOnceWith(
|
|
105
115
|
{
|
|
106
116
|
allServerGroups: [selected],
|
|
107
117
|
application,
|
|
@@ -116,21 +126,24 @@ describe('<AmazonServerGroupActions /> rollback integration', () => {
|
|
|
116
126
|
const selected = buildServerGroup({ isDisabled: true, name: 'test-app-main-v001' });
|
|
117
127
|
const rollbackSource = buildServerGroup();
|
|
118
128
|
const application = buildApplication([selected, rollbackSource]);
|
|
119
|
-
const confirm =
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
129
|
+
const confirm = vi
|
|
130
|
+
.spyOn(ConfirmationModalService, 'confirm')
|
|
131
|
+
.mockImplementation((params: any) =>
|
|
132
|
+
params.header === 'Rolling back?' ? (Promise.reject({ source: 'footer' }) as any) : (Promise.resolve() as any),
|
|
133
|
+
);
|
|
134
|
+
const show = vi.spyOn(AmazonRollbackServerGroupModal, 'show').mockReturnValue(Promise.resolve({} as any));
|
|
135
|
+
renderActions(application, selected);
|
|
136
|
+
|
|
137
|
+
await openActions();
|
|
138
|
+
await userEvent.click(screen.getByText('Enable'));
|
|
126
139
|
await settle();
|
|
127
140
|
|
|
128
141
|
expect(show).not.toHaveBeenCalled();
|
|
129
142
|
expect(confirm).toHaveBeenCalledTimes(2);
|
|
130
|
-
expect(confirm.
|
|
131
|
-
|
|
143
|
+
expect(confirm.mock.lastCall[0]).toEqual(
|
|
144
|
+
expect.objectContaining({
|
|
132
145
|
header: `Really enable ${selected.name}?`,
|
|
133
|
-
submitMethod:
|
|
146
|
+
submitMethod: expect.any(Function),
|
|
134
147
|
}),
|
|
135
148
|
);
|
|
136
149
|
});
|
|
@@ -139,40 +152,39 @@ describe('<AmazonServerGroupActions /> rollback integration', () => {
|
|
|
139
152
|
const selected = buildServerGroup({ isDisabled: true, name: 'test-app-main-v001' });
|
|
140
153
|
const rollbackSource = buildServerGroup();
|
|
141
154
|
const application = buildApplication([selected, rollbackSource]);
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
const
|
|
155
|
+
let rejectConfirmation: (reason: any) => void;
|
|
156
|
+
const confirmation = new Promise((_, reject) => {
|
|
157
|
+
rejectConfirmation = reject;
|
|
158
|
+
});
|
|
159
|
+
const confirm = vi.spyOn(ConfirmationModalService, 'confirm').mockReturnValue(confirmation as any);
|
|
160
|
+
const show = vi.spyOn(AmazonRollbackServerGroupModal, 'show').mockReturnValue(Promise.resolve({} as any));
|
|
161
|
+
const writer = { enableServerGroup: vi.fn() };
|
|
147
162
|
const enable = writer.enableServerGroup;
|
|
148
|
-
const
|
|
149
|
-
(
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
await
|
|
163
|
+
const runtimeServices = { serverGroupWriter: writer } as any;
|
|
164
|
+
renderActions(application, selected, undefined, runtimeServices);
|
|
165
|
+
|
|
166
|
+
await openActions();
|
|
167
|
+
await userEvent.click(screen.getByText('Enable'));
|
|
168
|
+
await act(async () => {
|
|
169
|
+
rejectConfirmation({ source: 'header' });
|
|
170
|
+
await confirmation.catch(() => undefined);
|
|
171
|
+
});
|
|
153
172
|
|
|
154
173
|
expect(confirm).toHaveBeenCalledTimes(1);
|
|
155
174
|
expect(show).not.toHaveBeenCalled();
|
|
156
175
|
expect(enable).not.toHaveBeenCalled();
|
|
157
176
|
});
|
|
158
177
|
|
|
159
|
-
it('closes destroyed server group details through the injected state service', () => {
|
|
178
|
+
it('closes destroyed server group details through the injected state service', async () => {
|
|
160
179
|
const selected = buildServerGroup();
|
|
161
|
-
const stateService = { go:
|
|
162
|
-
const confirm = spyOn(ConfirmationModalService, 'confirm');
|
|
163
|
-
spyOn(ServerGroupWarningMessageService, 'addDestroyWarningMessage');
|
|
164
|
-
|
|
165
|
-
<AmazonServerGroupActions
|
|
166
|
-
app={buildApplication([selected])}
|
|
167
|
-
router={{} as any}
|
|
168
|
-
serverGroup={selected}
|
|
169
|
-
stateParams={{}}
|
|
170
|
-
stateService={stateService as any}
|
|
171
|
-
/>,
|
|
172
|
-
);
|
|
180
|
+
const stateService = { go: vi.fn(), includes: vi.fn().mockReturnValue(true) };
|
|
181
|
+
const confirm = vi.spyOn(ConfirmationModalService, 'confirm').mockReturnValue(undefined);
|
|
182
|
+
vi.spyOn(ServerGroupWarningMessageService, 'addDestroyWarningMessage').mockReturnValue(undefined);
|
|
183
|
+
renderActions(buildApplication([selected]), selected, stateService);
|
|
173
184
|
|
|
174
|
-
|
|
175
|
-
|
|
185
|
+
await openActions();
|
|
186
|
+
await userEvent.click(screen.getByText('Destroy'));
|
|
187
|
+
confirm.mock.lastCall[0].taskMonitorConfig.onTaskComplete();
|
|
176
188
|
|
|
177
189
|
expect(stateService.includes).toHaveBeenCalledWith('**.serverGroup', {
|
|
178
190
|
accountId: 'test-account',
|
|
@@ -183,4 +195,4 @@ describe('<AmazonServerGroupActions /> rollback integration', () => {
|
|
|
183
195
|
});
|
|
184
196
|
});
|
|
185
197
|
|
|
186
|
-
const settle = () => new Promise((resolve) => setTimeout(resolve));
|
|
198
|
+
const settle = () => act(() => new Promise((resolve) => setTimeout(resolve)));
|
|
@@ -1,50 +1,37 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Mock } from 'vitest';
|
|
2
|
+
import { fireEvent, screen, waitFor } from '@testing-library/react';
|
|
2
3
|
import React from 'react';
|
|
3
4
|
|
|
4
|
-
import { DeckRuntimeContext,
|
|
5
|
+
import { DeckRuntimeContext, ReactModal, TaskExecutor } from '@spinnaker/core';
|
|
6
|
+
import { renderWithRouter } from '../../../../../core/src/utils/testUtils/rtl';
|
|
5
7
|
|
|
6
|
-
import { EditAsgAdvancedSettingsModal } from './EditAsgAdvancedSettingsModal';
|
|
8
|
+
import { EditAsgAdvancedSettingsModal, validateRequiredNonNegativeNumber } from './EditAsgAdvancedSettingsModal';
|
|
7
9
|
|
|
8
10
|
describe('EditAsgAdvancedSettingsModal', () => {
|
|
9
|
-
const application = { name: 'deck', serverGroups: { refresh:
|
|
11
|
+
const application = { name: 'deck', serverGroups: { refresh: vi.fn() } } as any;
|
|
10
12
|
const serverGroup = { name: 'deck-main-v001', account: 'test', region: 'us-east-1' } as any;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
dismissModal: jasmine.createSpy('dismissModal'),
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
function mountModal(command: any) {
|
|
20
|
-
buildUpdateServerGroupCommand = jasmine.createSpy().and.returnValue(command);
|
|
21
|
-
const commandBuilder = { buildUpdateServerGroupCommand };
|
|
13
|
+
const modalProps = { application, serverGroup, closeModal: vi.fn(), dismissModal: vi.fn() };
|
|
14
|
+
let buildUpdateServerGroupCommand: Mock;
|
|
15
|
+
|
|
16
|
+
function renderModal(command: any) {
|
|
17
|
+
buildUpdateServerGroupCommand = vi.fn().mockReturnValue(command);
|
|
22
18
|
const runtime = {
|
|
23
|
-
services: {
|
|
19
|
+
services: {
|
|
20
|
+
providerServiceDelegate: {
|
|
21
|
+
getDelegate: vi.fn().mockReturnValue({ buildUpdateServerGroupCommand }),
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
24
|
} as any;
|
|
25
|
-
|
|
25
|
+
const ui = (
|
|
26
26
|
<DeckRuntimeContext.Provider value={runtime}>
|
|
27
27
|
<EditAsgAdvancedSettingsModal {...modalProps} />
|
|
28
|
-
</DeckRuntimeContext.Provider
|
|
29
|
-
)
|
|
28
|
+
</DeckRuntimeContext.Provider>
|
|
29
|
+
);
|
|
30
|
+
return { ...renderWithRouter(ui), ui };
|
|
30
31
|
}
|
|
31
32
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
backingData: { enabledMetrics: [], healthCheckTypes: [], terminationPolicies: [] },
|
|
35
|
-
} as any;
|
|
36
|
-
const wrapper = mountModal(command);
|
|
37
|
-
const initialValues = wrapper.find(TaskMonitorModal).prop('initialValues');
|
|
38
|
-
|
|
39
|
-
wrapper.instance().forceUpdate();
|
|
40
|
-
wrapper.update();
|
|
41
|
-
|
|
42
|
-
expect(buildUpdateServerGroupCommand).toHaveBeenCalledTimes(1);
|
|
43
|
-
expect(wrapper.find(TaskMonitorModal).prop('initialValues')).toBe(initialValues);
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
it('uses the update command builder and exposes every advanced setting', () => {
|
|
47
|
-
const command = {
|
|
33
|
+
function command() {
|
|
34
|
+
return {
|
|
48
35
|
cooldown: 10,
|
|
49
36
|
enabledMetrics: ['GroupDesiredCapacity'],
|
|
50
37
|
healthCheckGracePeriod: 600,
|
|
@@ -57,45 +44,70 @@ describe('EditAsgAdvancedSettingsModal', () => {
|
|
|
57
44
|
terminationPolicies: ['Default'],
|
|
58
45
|
},
|
|
59
46
|
} as any;
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
expect(fields.map((field) => field.prop('name'))).toEqual([
|
|
68
|
-
'cooldown',
|
|
69
|
-
'enabledMetrics',
|
|
70
|
-
'healthCheckType',
|
|
71
|
-
'healthCheckGracePeriod',
|
|
72
|
-
'terminationPolicies',
|
|
73
|
-
'capacityRebalance',
|
|
74
|
-
]);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
it('rejects empty and non-finite numeric values while accepting non-negative numbers', () => {
|
|
50
|
+
[undefined, null, '', Number.NaN, Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY, -1].forEach((value) =>
|
|
51
|
+
expect(validateRequiredNonNegativeNumber(value)).toBe('Enter a finite non-negative number'),
|
|
52
|
+
);
|
|
53
|
+
[0, 0.5, 1].forEach((value) => expect(validateRequiredNonNegativeNumber(value)).toBeUndefined());
|
|
75
54
|
});
|
|
76
55
|
|
|
77
|
-
it('
|
|
78
|
-
const
|
|
79
|
-
cooldown: 10,
|
|
80
|
-
healthCheckGracePeriod: 600,
|
|
81
|
-
backingData: { enabledMetrics: [], healthCheckTypes: [], terminationPolicies: [] },
|
|
82
|
-
} as any;
|
|
83
|
-
const wrapper = mountModal(command);
|
|
84
|
-
const taskModal = wrapper.find(TaskMonitorModal);
|
|
85
|
-
const fields = shallow(<div>{taskModal.prop('render')({ values: command } as any)}</div>).find(FormikFormField);
|
|
56
|
+
it('builds one update command and preserves its form values across rerenders', () => {
|
|
57
|
+
const rendered = renderModal(command());
|
|
86
58
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
const validate = field.prop('validate') as (value: unknown) => string | undefined;
|
|
59
|
+
expect(screen.getByRole('spinbutton', { name: 'Cooldown' })).toHaveValue(10);
|
|
60
|
+
rendered.rerender(rendered.ui);
|
|
90
61
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
62
|
+
expect(buildUpdateServerGroupCommand).toHaveBeenCalledTimes(1);
|
|
63
|
+
expect(screen.getByRole('spinbutton', { name: 'Health Check Grace Period' })).toHaveValue(600);
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it('renders every advanced setting and submits the exact task envelope', async () => {
|
|
67
|
+
const values = command();
|
|
68
|
+
const executeTask = vi.spyOn(TaskExecutor, 'executeTask').mockResolvedValue({} as any);
|
|
69
|
+
renderModal(values);
|
|
70
|
+
|
|
71
|
+
const controls = [
|
|
72
|
+
screen.getByRole('spinbutton', { name: 'Cooldown' }),
|
|
73
|
+
screen.getByRole('combobox', { name: 'Enabled Metrics' }),
|
|
74
|
+
screen.getByRole('combobox', { name: 'Health Check Type' }),
|
|
75
|
+
screen.getByRole('spinbutton', { name: 'Health Check Grace Period' }),
|
|
76
|
+
screen.getByRole('combobox', { name: 'Termination Policies' }),
|
|
77
|
+
screen.getByRole('checkbox', { name: 'Enable capacity rebalance' }),
|
|
78
|
+
];
|
|
79
|
+
controls.forEach((control) => {
|
|
80
|
+
expect(control.closest('.sp-formItem')).toHaveClass('sp-formItem');
|
|
81
|
+
expect(control.closest('.sp-formItem')?.querySelector('.sp-formItem__right')).toContainElement(control);
|
|
94
82
|
});
|
|
83
|
+
|
|
84
|
+
fireEvent.click(screen.getByRole('button', { name: 'Submit' }));
|
|
85
|
+
await waitFor(() =>
|
|
86
|
+
expect(executeTask).toHaveBeenCalledWith({
|
|
87
|
+
application,
|
|
88
|
+
description: 'Update Advanced Settings for deck-main-v001',
|
|
89
|
+
job: [values],
|
|
90
|
+
}),
|
|
91
|
+
);
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
it('requires finite non-negative cooldown and health check grace period values', async () => {
|
|
95
|
+
renderModal(command());
|
|
96
|
+
const submit = screen.getByRole('button', { name: 'Submit' });
|
|
97
|
+
|
|
98
|
+
for (const name of ['Cooldown', 'Health Check Grace Period']) {
|
|
99
|
+
const input = screen.getByRole('spinbutton', { name });
|
|
100
|
+
for (const invalidValue of ['', '-1', 'Infinity']) {
|
|
101
|
+
fireEvent.change(input, { target: { value: invalidValue } });
|
|
102
|
+
await waitFor(() => expect(submit).toBeDisabled());
|
|
103
|
+
fireEvent.change(input, { target: { value: '0' } });
|
|
104
|
+
await waitFor(() => expect(submit).toBeEnabled());
|
|
105
|
+
}
|
|
106
|
+
}
|
|
95
107
|
});
|
|
96
108
|
|
|
97
109
|
it('opens only after managed-resource verification succeeds', async () => {
|
|
98
|
-
const show = spyOn(ReactModal, 'show').
|
|
110
|
+
const show = vi.spyOn(ReactModal, 'show').mockResolvedValue(undefined as any);
|
|
99
111
|
const runtimeServices = {} as any;
|
|
100
112
|
|
|
101
113
|
await EditAsgAdvancedSettingsModal.show({ application, serverGroup }, runtimeServices);
|
|
@@ -23,7 +23,7 @@ export interface IEditAsgAdvancedSettingsModalProps extends IModalComponentProps
|
|
|
23
23
|
serverGroup: IAmazonServerGroup;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
function validateRequiredNonNegativeNumber(value: unknown): string | undefined {
|
|
26
|
+
export function validateRequiredNonNegativeNumber(value: unknown): string | undefined {
|
|
27
27
|
return typeof value !== 'number' || !Number.isFinite(value) || value < 0
|
|
28
28
|
? 'Enter a finite non-negative number'
|
|
29
29
|
: undefined;
|
|
@@ -57,7 +57,7 @@ export class EditAsgAdvancedSettingsModal extends React.Component<IEditAsgAdvanc
|
|
|
57
57
|
label="Cooldown"
|
|
58
58
|
name="cooldown"
|
|
59
59
|
help="Seconds"
|
|
60
|
-
input={(props) => <NumberInput {...props} min={0} />}
|
|
60
|
+
input={(props) => <NumberInput {...props} aria-label="Cooldown" min={0} />}
|
|
61
61
|
required={true}
|
|
62
62
|
validate={validateRequiredNonNegativeNumber}
|
|
63
63
|
/>
|
|
@@ -65,20 +65,32 @@ export class EditAsgAdvancedSettingsModal extends React.Component<IEditAsgAdvanc
|
|
|
65
65
|
label="Enabled Metrics"
|
|
66
66
|
name="enabledMetrics"
|
|
67
67
|
help={<HelpField id="aws.serverGroup.enabledMetrics" />}
|
|
68
|
-
input={(props) =>
|
|
68
|
+
input={(props) => (
|
|
69
|
+
<ReactSelectInput
|
|
70
|
+
{...props}
|
|
71
|
+
aria-label="Enabled Metrics"
|
|
72
|
+
multi={true}
|
|
73
|
+
stringOptions={backingData.enabledMetrics}
|
|
74
|
+
/>
|
|
75
|
+
)}
|
|
69
76
|
/>
|
|
70
77
|
<FormikFormField
|
|
71
78
|
label="Health Check Type"
|
|
72
79
|
name="healthCheckType"
|
|
73
80
|
input={(props) => (
|
|
74
|
-
<ReactSelectInput
|
|
81
|
+
<ReactSelectInput
|
|
82
|
+
{...props}
|
|
83
|
+
aria-label="Health Check Type"
|
|
84
|
+
clearable={false}
|
|
85
|
+
stringOptions={backingData.healthCheckTypes}
|
|
86
|
+
/>
|
|
75
87
|
)}
|
|
76
88
|
/>
|
|
77
89
|
<FormikFormField
|
|
78
90
|
label="Health Check Grace Period"
|
|
79
91
|
name="healthCheckGracePeriod"
|
|
80
92
|
help="Seconds"
|
|
81
|
-
input={(props) => <NumberInput {...props} min={0} />}
|
|
93
|
+
input={(props) => <NumberInput {...props} aria-label="Health Check Grace Period" min={0} />}
|
|
82
94
|
required={true}
|
|
83
95
|
validate={validateRequiredNonNegativeNumber}
|
|
84
96
|
/>
|
|
@@ -86,7 +98,12 @@ export class EditAsgAdvancedSettingsModal extends React.Component<IEditAsgAdvanc
|
|
|
86
98
|
label="Termination Policies"
|
|
87
99
|
name="terminationPolicies"
|
|
88
100
|
input={(props) => (
|
|
89
|
-
<ReactSelectInput
|
|
101
|
+
<ReactSelectInput
|
|
102
|
+
{...props}
|
|
103
|
+
aria-label="Termination Policies"
|
|
104
|
+
multi={true}
|
|
105
|
+
stringOptions={backingData.terminationPolicies}
|
|
106
|
+
/>
|
|
90
107
|
)}
|
|
91
108
|
/>
|
|
92
109
|
<FormikFormField
|