@spinnaker/amazon 2026.3.2 → 2026.4.1
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
|
@@ -1,22 +1,28 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { act, fireEvent, render, screen, waitFor, within } from '@testing-library/react';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { AccountService } from '@spinnaker/core';
|
|
5
|
+
import { getFormGroupByLabel } from '../../../../../core/src/utils/testUtils/rtl';
|
|
5
6
|
|
|
6
7
|
import { AmazonStageConfig } from '../AmazonStageConfig';
|
|
7
|
-
|
|
8
8
|
import { awsResizeAsgStage } from './awsResizeAsgStage';
|
|
9
9
|
|
|
10
10
|
describe('AWS Resize Server Group stage', () => {
|
|
11
11
|
beforeEach(() => {
|
|
12
|
-
spyOn(AccountService, 'getUniqueAttributeForAllAccounts').
|
|
13
|
-
spyOn(AccountService, 'listAccounts').
|
|
12
|
+
vi.spyOn(AccountService, 'getUniqueAttributeForAllAccounts').mockResolvedValue([]);
|
|
13
|
+
vi.spyOn(AccountService, 'listAccounts').mockResolvedValue([]);
|
|
14
14
|
});
|
|
15
15
|
|
|
16
|
-
function renderStage(
|
|
17
|
-
|
|
16
|
+
function renderStage(
|
|
17
|
+
stageOverrides: Record<string, any> = {},
|
|
18
|
+
applicationOverrides: Record<string, any> = {},
|
|
19
|
+
pipelineOverrides: Record<string, any> = {},
|
|
20
|
+
) {
|
|
21
|
+
const initialStage = {
|
|
18
22
|
action: 'scale_up',
|
|
19
23
|
capacity: {},
|
|
24
|
+
cloudProvider: 'aws',
|
|
25
|
+
regions: [],
|
|
20
26
|
resizeType: 'pct',
|
|
21
27
|
scalePct: 150,
|
|
22
28
|
target: 'current_asg',
|
|
@@ -30,61 +36,67 @@ describe('AWS Resize Server Group stage', () => {
|
|
|
30
36
|
getDataSource: () => ({ data: [] }),
|
|
31
37
|
...applicationOverrides,
|
|
32
38
|
};
|
|
33
|
-
const updateStage =
|
|
34
|
-
const updateStageField =
|
|
39
|
+
const updateStage = vi.fn();
|
|
40
|
+
const updateStageField = vi.fn();
|
|
35
41
|
const Component = awsResizeAsgStage.component as React.ComponentType<any>;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
updateStage
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
42
|
+
let replaceStage: React.Dispatch<React.SetStateAction<any>>;
|
|
43
|
+
|
|
44
|
+
function StageHarness() {
|
|
45
|
+
const [stage, setStage] = React.useState(initialStage);
|
|
46
|
+
replaceStage = setStage;
|
|
47
|
+
const update = (changes: any) => {
|
|
48
|
+
updateStage(changes);
|
|
49
|
+
setStage((current: any) => ({ ...current, ...changes }));
|
|
50
|
+
};
|
|
51
|
+
const updateField = (changes: any) => {
|
|
52
|
+
updateStageField(changes);
|
|
53
|
+
setStage((current: any) => ({ ...current, ...changes }));
|
|
54
|
+
};
|
|
55
|
+
return (
|
|
56
|
+
<Component
|
|
57
|
+
application={application}
|
|
58
|
+
pipeline={{ strategy: true, ...pipelineOverrides }}
|
|
59
|
+
stage={stage}
|
|
60
|
+
stageFieldUpdated={vi.fn()}
|
|
61
|
+
updateStage={update}
|
|
62
|
+
updateStageField={updateField}
|
|
63
|
+
/>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return {
|
|
68
|
+
initialStage,
|
|
69
|
+
replaceStage: (stage: any) => act(() => replaceStage(stage)),
|
|
70
|
+
updateStage,
|
|
71
|
+
updateStageField,
|
|
72
|
+
...render(<StageHarness />),
|
|
73
|
+
};
|
|
48
74
|
}
|
|
49
75
|
|
|
50
|
-
|
|
51
|
-
expect(awsResizeAsgStage.component).not.toBe(AmazonStageConfig);
|
|
52
|
-
});
|
|
76
|
+
const validator = () => awsResizeAsgStage.validators.find(({ type }) => type === 'custom');
|
|
53
77
|
|
|
54
|
-
it('registers a prevent-save numeric validator', () => {
|
|
55
|
-
expect(awsResizeAsgStage.
|
|
78
|
+
it('registers a dedicated stage editor and prevent-save numeric validator', () => {
|
|
79
|
+
expect(awsResizeAsgStage.component).not.toBe(AmazonStageConfig);
|
|
80
|
+
expect(validator()).toEqual(expect.objectContaining({ type: 'custom', preventSave: true }));
|
|
56
81
|
});
|
|
57
82
|
|
|
58
|
-
it('
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
action: 'scale_up',
|
|
62
|
-
resizeType: 'pct',
|
|
63
|
-
scalePct: 25,
|
|
64
|
-
targetHealthyDeployPercentage: 75,
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
expect(validator.validate({}, { ...validStage, scalePct: 12.5 })).toBe(
|
|
68
|
-
'Resize percentage must be a nonnegative integer or pipeline expression.',
|
|
69
|
-
);
|
|
70
|
-
expect(validator.validate({}, { ...validStage, scalePct: -1 })).toBe(
|
|
83
|
+
it('validates percentage and health values while allowing integers and expressions', () => {
|
|
84
|
+
const valid = { action: 'scale_up', resizeType: 'pct', scalePct: 25, targetHealthyDeployPercentage: 75 };
|
|
85
|
+
expect(validator().validate({}, { ...valid, scalePct: 12.5 })).toBe(
|
|
71
86
|
'Resize percentage must be a nonnegative integer or pipeline expression.',
|
|
72
87
|
);
|
|
73
|
-
expect(validator.validate({}, { ...
|
|
88
|
+
expect(validator().validate({}, { ...valid, scalePct: -1 })).toBe(
|
|
74
89
|
'Resize percentage must be a nonnegative integer or pipeline expression.',
|
|
75
90
|
);
|
|
76
|
-
expect(validator.validate({}, { ...
|
|
91
|
+
expect(validator().validate({}, { ...valid, targetHealthyDeployPercentage: 101 })).toBe(
|
|
77
92
|
'Target healthy percentage must be an integer from 0 through 100 or pipeline expression.',
|
|
78
93
|
);
|
|
79
|
-
expect(validator.validate({}, { ...
|
|
80
|
-
'Target healthy percentage must be an integer from 0 through 100 or pipeline expression.',
|
|
81
|
-
);
|
|
82
|
-
expect(validator.validate({}, { ...validStage, scalePct: 125, targetHealthyDeployPercentage: 100 })).toBe('');
|
|
94
|
+
expect(validator().validate({}, { ...valid, scalePct: 125, targetHealthyDeployPercentage: 100 })).toBe('');
|
|
83
95
|
expect(
|
|
84
|
-
validator.validate(
|
|
96
|
+
validator().validate(
|
|
85
97
|
{},
|
|
86
98
|
{
|
|
87
|
-
...
|
|
99
|
+
...valid,
|
|
88
100
|
scalePct: '${ parameters.percentage }',
|
|
89
101
|
targetHealthyDeployPercentage: '${ parameters.healthPercentage }',
|
|
90
102
|
},
|
|
@@ -92,168 +104,165 @@ describe('AWS Resize Server Group stage', () => {
|
|
|
92
104
|
).toBe('');
|
|
93
105
|
});
|
|
94
106
|
|
|
95
|
-
it('only
|
|
96
|
-
const
|
|
97
|
-
|
|
107
|
+
it('validates only fields used by incremental and exact modes', () => {
|
|
108
|
+
const countMessage = 'Resize count must be a nonnegative integer or pipeline expression.';
|
|
109
|
+
expect(validator().validate({}, { action: 'scale_down', resizeType: 'incr', scaleNum: 2.5 })).toBe(countMessage);
|
|
110
|
+
expect(validator().validate({}, { action: 'scale_down', resizeType: 'incr', scaleNum: 0 })).toBe('');
|
|
98
111
|
expect(
|
|
99
|
-
validator.validate(
|
|
112
|
+
validator().validate(
|
|
100
113
|
{},
|
|
101
|
-
{
|
|
102
|
-
action: 'scale_up',
|
|
103
|
-
resizeType: 'capacity',
|
|
104
|
-
scalePct: 12.5,
|
|
105
|
-
targetHealthyDeployPercentage: 75,
|
|
106
|
-
},
|
|
114
|
+
{ action: 'scale_exact', resizeType: 'exact', capacity: { min: 1.5, max: -1, desired: Number.NaN } },
|
|
107
115
|
),
|
|
108
|
-
).toBe('');
|
|
116
|
+
).toBe('Minimum capacity must be a nonnegative integer or pipeline expression.');
|
|
109
117
|
expect(
|
|
110
|
-
validator.validate(
|
|
118
|
+
validator().validate(
|
|
119
|
+
{},
|
|
120
|
+
{ action: 'scale_exact', resizeType: 'exact', capacity: { min: 1, max: -1, desired: Number.NaN } },
|
|
121
|
+
),
|
|
122
|
+
).toBe('Maximum capacity must be a nonnegative integer or pipeline expression.');
|
|
123
|
+
expect(
|
|
124
|
+
validator().validate(
|
|
125
|
+
{},
|
|
126
|
+
{ action: 'scale_exact', resizeType: 'exact', capacity: { min: 1, max: 2, desired: Number.NaN } },
|
|
127
|
+
),
|
|
128
|
+
).toBe('Desired capacity must be a nonnegative integer or pipeline expression.');
|
|
129
|
+
expect(
|
|
130
|
+
validator().validate(
|
|
111
131
|
{},
|
|
112
132
|
{
|
|
113
|
-
action: '
|
|
133
|
+
action: 'scale_up',
|
|
114
134
|
resizeType: 'pct',
|
|
115
135
|
scalePct: 25,
|
|
116
|
-
|
|
136
|
+
scaleNum: -1,
|
|
137
|
+
capacity: { min: -1, max: -1, desired: -1 },
|
|
138
|
+
targetHealthyDeployPercentage: 75,
|
|
117
139
|
},
|
|
118
140
|
),
|
|
119
141
|
).toBe('');
|
|
120
142
|
});
|
|
121
143
|
|
|
122
|
-
it('
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
144
|
+
it('rejects a null percentage in percentage mode', () => {
|
|
145
|
+
expect(
|
|
146
|
+
validator().validate(
|
|
147
|
+
{},
|
|
148
|
+
{ action: 'scale_up', resizeType: 'pct', scalePct: null, targetHealthyDeployPercentage: 100 },
|
|
149
|
+
),
|
|
150
|
+
).toBe('Resize percentage must be a nonnegative integer or pipeline expression.');
|
|
151
|
+
});
|
|
126
152
|
|
|
127
|
-
|
|
128
|
-
expect(
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
153
|
+
it('rejects a fractional target health percentage', () => {
|
|
154
|
+
expect(
|
|
155
|
+
validator().validate(
|
|
156
|
+
{},
|
|
157
|
+
{ action: 'scale_up', resizeType: 'pct', scalePct: 25, targetHealthyDeployPercentage: 99.5 },
|
|
158
|
+
),
|
|
159
|
+
).toBe('Target healthy percentage must be an integer from 0 through 100 or pipeline expression.');
|
|
132
160
|
});
|
|
133
161
|
|
|
134
|
-
it('
|
|
135
|
-
const
|
|
136
|
-
const validStage = {
|
|
137
|
-
action: 'scale_exact',
|
|
138
|
-
resizeType: 'exact',
|
|
139
|
-
capacity: { min: 1, max: 2, desired: 3 },
|
|
140
|
-
};
|
|
162
|
+
it('rejects negative and non-finite incremental counts while accepting an expression', () => {
|
|
163
|
+
const message = 'Resize count must be a nonnegative integer or pipeline expression.';
|
|
141
164
|
|
|
142
|
-
expect(validator.validate({}, {
|
|
143
|
-
|
|
144
|
-
);
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
expect(validator.validate({}, { ...validStage, capacity: { min: 1, max: 2, desired: Number.NaN } })).toBe(
|
|
149
|
-
'Desired capacity must be a nonnegative integer or pipeline expression.',
|
|
150
|
-
);
|
|
165
|
+
expect(validator().validate({}, { action: 'scale_down', resizeType: 'incr', scaleNum: -1 })).toBe(message);
|
|
166
|
+
expect(validator().validate({}, { action: 'scale_down', resizeType: 'incr', scaleNum: Number.NaN })).toBe(message);
|
|
167
|
+
expect(validator().validate({}, { action: 'scale_down', resizeType: 'incr', scaleNum: '${ count }' })).toBe('');
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
it('accepts expressions for every exact capacity', () => {
|
|
151
171
|
expect(
|
|
152
|
-
validator.validate(
|
|
172
|
+
validator().validate(
|
|
153
173
|
{},
|
|
154
174
|
{
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
max: '${ parameters.max }',
|
|
159
|
-
desired: '${ parameters.desired }',
|
|
160
|
-
},
|
|
175
|
+
action: 'scale_exact',
|
|
176
|
+
resizeType: 'exact',
|
|
177
|
+
capacity: { min: '${ min }', max: '${ max }', desired: '${ desired }' },
|
|
161
178
|
},
|
|
162
179
|
),
|
|
163
180
|
).toBe('');
|
|
164
181
|
});
|
|
165
182
|
|
|
166
|
-
it('
|
|
167
|
-
const validator = awsResizeAsgStage.validators.find(({ type }) => type === 'custom');
|
|
168
|
-
|
|
183
|
+
it('validates only eligible fields across incremental, exact, and scale-down percentage modes', () => {
|
|
169
184
|
expect(
|
|
170
|
-
validator.validate(
|
|
185
|
+
validator().validate(
|
|
171
186
|
{},
|
|
172
187
|
{
|
|
173
188
|
action: 'scale_up',
|
|
174
|
-
resizeType: '
|
|
175
|
-
|
|
176
|
-
|
|
189
|
+
resizeType: 'incr',
|
|
190
|
+
scaleNum: 1,
|
|
191
|
+
scalePct: null,
|
|
177
192
|
capacity: { min: -1, max: -1, desired: -1 },
|
|
178
|
-
targetHealthyDeployPercentage:
|
|
193
|
+
targetHealthyDeployPercentage: 100,
|
|
179
194
|
},
|
|
180
195
|
),
|
|
181
196
|
).toBe('');
|
|
182
197
|
expect(
|
|
183
|
-
validator.validate(
|
|
198
|
+
validator().validate(
|
|
184
199
|
{},
|
|
185
200
|
{
|
|
186
|
-
action: '
|
|
187
|
-
resizeType: '
|
|
188
|
-
scaleNum:
|
|
189
|
-
|
|
201
|
+
action: 'scale_exact',
|
|
202
|
+
resizeType: 'exact',
|
|
203
|
+
scaleNum: -1,
|
|
204
|
+
scalePct: null,
|
|
205
|
+
capacity: { min: 1, max: 2, desired: 2 },
|
|
206
|
+
targetHealthyDeployPercentage: 99.5,
|
|
190
207
|
},
|
|
191
208
|
),
|
|
192
209
|
).toBe('');
|
|
193
210
|
expect(
|
|
194
|
-
validator.validate(
|
|
211
|
+
validator().validate(
|
|
195
212
|
{},
|
|
196
213
|
{
|
|
197
|
-
action: '
|
|
198
|
-
resizeType: '
|
|
199
|
-
scaleNum:
|
|
200
|
-
|
|
214
|
+
action: 'scale_down',
|
|
215
|
+
resizeType: 'pct',
|
|
216
|
+
scaleNum: Number.NaN,
|
|
217
|
+
scalePct: 25,
|
|
218
|
+
capacity: { min: -1, max: -1, desired: -1 },
|
|
219
|
+
targetHealthyDeployPercentage: 99.5,
|
|
201
220
|
},
|
|
202
221
|
),
|
|
203
222
|
).toBe('');
|
|
204
223
|
});
|
|
205
224
|
|
|
206
|
-
it('renders
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
expect(
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
expect(
|
|
220
|
-
expect(
|
|
225
|
+
it('renders target, action, percentage, health threshold, and task completion controls', () => {
|
|
226
|
+
renderStage();
|
|
227
|
+
|
|
228
|
+
expect(within(getFormGroupByLabel('Target')).getByRole('combobox')).toHaveAttribute(
|
|
229
|
+
'placeholder',
|
|
230
|
+
'(Deprecated) Current Server Group',
|
|
231
|
+
);
|
|
232
|
+
const action = within(getFormGroupByLabel('Action')).getByRole('combobox');
|
|
233
|
+
expect(
|
|
234
|
+
within(action)
|
|
235
|
+
.getAllByRole('option')
|
|
236
|
+
.map((option) => (option as HTMLOptionElement).value),
|
|
237
|
+
).toEqual(['scale_up', 'scale_down', 'scale_to_cluster', 'scale_exact']);
|
|
238
|
+
expect(screen.getByRole('textbox', { name: 'Resize percentage' })).toHaveValue('150');
|
|
239
|
+
expect(screen.getByRole('textbox', { name: 'Target healthy percentage' })).toHaveValue('100');
|
|
240
|
+
expect(getFormGroupByLabel('Task Completion')).toHaveTextContent('Amazon');
|
|
221
241
|
});
|
|
222
242
|
|
|
223
243
|
it('renders exact min, max, and desired capacity without percentage controls', () => {
|
|
224
|
-
|
|
244
|
+
renderStage({
|
|
225
245
|
action: 'scale_exact',
|
|
226
246
|
capacity: { desired: 4, max: '${ parameters.max }', min: 2 },
|
|
227
247
|
resizeType: 'exact',
|
|
228
248
|
});
|
|
229
249
|
|
|
230
|
-
expect(
|
|
231
|
-
|
|
232
|
-
expect(
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
'capacity.desired',
|
|
236
|
-
]);
|
|
237
|
-
expect(capacityInputs.map((input) => input.prop('value'))).toEqual([2, '${ parameters.max }', 4]);
|
|
238
|
-
expect(wrapper.find('input[name="targetHealthyDeployPercentage"]').exists()).toBe(false);
|
|
250
|
+
expect(screen.getByRole('textbox', { name: 'Minimum capacity' })).toHaveValue('2');
|
|
251
|
+
expect(screen.getByRole('textbox', { name: 'Maximum capacity' })).toHaveValue('${ parameters.max }');
|
|
252
|
+
expect(screen.getByRole('textbox', { name: 'Desired capacity' })).toHaveValue('4');
|
|
253
|
+
expect(screen.queryByRole('textbox', { name: 'Resize percentage' })).not.toBeInTheDocument();
|
|
254
|
+
expect(screen.queryByRole('textbox', { name: 'Target healthy percentage' })).not.toBeInTheDocument();
|
|
239
255
|
});
|
|
240
256
|
|
|
241
257
|
it('renders an incremental count for scale down without a health threshold', () => {
|
|
242
|
-
|
|
243
|
-
action: 'scale_down',
|
|
244
|
-
resizeType: 'incr',
|
|
245
|
-
scaleNum: '${ parameters.count }',
|
|
246
|
-
});
|
|
258
|
+
renderStage({ action: 'scale_down', resizeType: 'incr', scaleNum: '${ parameters.count }' });
|
|
247
259
|
|
|
248
|
-
expect(
|
|
249
|
-
|
|
250
|
-
]);
|
|
251
|
-
expect(wrapper.find('input[name="scalePct"]').exists()).toBe(false);
|
|
252
|
-
expect(wrapper.find('input[name="targetHealthyDeployPercentage"]').exists()).toBe(false);
|
|
260
|
+
expect(screen.getByRole('textbox', { name: 'Resize count' })).toHaveValue('${ parameters.count }');
|
|
261
|
+
expect(screen.queryByRole('textbox', { name: 'Target healthy percentage' })).not.toBeInTheDocument();
|
|
253
262
|
});
|
|
254
263
|
|
|
255
264
|
it('applies AWS defaults to a new stage', () => {
|
|
256
|
-
const
|
|
265
|
+
const rendered = renderStage(
|
|
257
266
|
{
|
|
258
267
|
action: undefined,
|
|
259
268
|
capacity: undefined,
|
|
@@ -273,7 +282,7 @@ describe('AWS Resize Server Group stage', () => {
|
|
|
273
282
|
},
|
|
274
283
|
);
|
|
275
284
|
|
|
276
|
-
expect(updateStageField).toHaveBeenCalledWith({
|
|
285
|
+
expect(rendered.updateStageField).toHaveBeenCalledWith({
|
|
277
286
|
action: 'scale_up',
|
|
278
287
|
capacity: {},
|
|
279
288
|
cloudProvider: 'aws',
|
|
@@ -286,313 +295,206 @@ describe('AWS Resize Server Group stage', () => {
|
|
|
286
295
|
});
|
|
287
296
|
});
|
|
288
297
|
|
|
289
|
-
|
|
290
|
-
it(
|
|
291
|
-
|
|
298
|
+
describe('mode transitions', () => {
|
|
299
|
+
it.each(['scale_up', 'scale_down', 'scale_to_cluster'])(
|
|
300
|
+
'defaults legacy exact mode to percentage when changing to %s',
|
|
301
|
+
(action) => {
|
|
302
|
+
const rendered = renderStage({
|
|
303
|
+
action: 'scale_exact',
|
|
304
|
+
capacity: { desired: 4, max: 4, min: 4 },
|
|
305
|
+
resizeType: 'exact',
|
|
306
|
+
scaleNum: 3,
|
|
307
|
+
scalePct: undefined,
|
|
308
|
+
});
|
|
309
|
+
const original = { ...rendered.initialStage, capacity: { ...rendered.initialStage.capacity } };
|
|
310
|
+
rendered.updateStage.mockClear();
|
|
311
|
+
rendered.updateStageField.mockClear();
|
|
312
|
+
|
|
313
|
+
fireEvent.change(within(getFormGroupByLabel('Action')).getByRole('combobox'), { target: { value: action } });
|
|
314
|
+
|
|
315
|
+
expect(rendered.initialStage).toEqual(original);
|
|
316
|
+
expect(rendered.updateStage.mock.lastCall?.[0]).toStrictEqual({
|
|
317
|
+
action,
|
|
318
|
+
capacity: {},
|
|
319
|
+
resizeType: 'pct',
|
|
320
|
+
scaleNum: undefined,
|
|
321
|
+
scalePct: 0,
|
|
322
|
+
});
|
|
323
|
+
expect(rendered.updateStageField).not.toHaveBeenCalled();
|
|
324
|
+
},
|
|
325
|
+
);
|
|
326
|
+
|
|
327
|
+
it('clears stale fields when changing between exact, incremental, and percentage modes', () => {
|
|
328
|
+
const exact = renderStage({ scaleNum: 3 });
|
|
329
|
+
const originalExact = { ...exact.initialStage, capacity: { ...exact.initialStage.capacity } };
|
|
330
|
+
exact.updateStage.mockClear();
|
|
331
|
+
exact.updateStageField.mockClear();
|
|
332
|
+
|
|
333
|
+
fireEvent.change(within(getFormGroupByLabel('Action')).getByRole('combobox'), {
|
|
334
|
+
target: { value: 'scale_exact' },
|
|
335
|
+
});
|
|
336
|
+
|
|
337
|
+
expect(exact.initialStage).toEqual(originalExact);
|
|
338
|
+
expect(exact.updateStage.mock.lastCall?.[0]).toStrictEqual({
|
|
292
339
|
action: 'scale_exact',
|
|
293
|
-
capacity: { desired: 4, max: 4, min: 4 },
|
|
294
340
|
resizeType: 'exact',
|
|
295
|
-
scaleNum:
|
|
341
|
+
scaleNum: undefined,
|
|
296
342
|
scalePct: undefined,
|
|
297
343
|
});
|
|
298
|
-
|
|
299
|
-
exact.updateStage.calls.reset();
|
|
300
|
-
exact.updateStageField.calls.reset();
|
|
344
|
+
expect(exact.updateStageField).not.toHaveBeenCalled();
|
|
301
345
|
|
|
302
|
-
exact.
|
|
346
|
+
exact.updateStage.mockClear();
|
|
347
|
+
fireEvent.change(within(getFormGroupByLabel('Action')).getByRole('combobox'), {
|
|
348
|
+
target: { value: 'scale_up' },
|
|
349
|
+
});
|
|
350
|
+
fireEvent.change(within(getFormGroupByLabel('Type')).getByRole('combobox'), {
|
|
351
|
+
target: { value: 'incr' },
|
|
352
|
+
});
|
|
353
|
+
expect(exact.updateStage.mock.lastCall?.[0]).toStrictEqual({
|
|
354
|
+
action: 'scale_up',
|
|
355
|
+
capacity: {},
|
|
356
|
+
resizeType: 'incr',
|
|
357
|
+
scaleNum: 0,
|
|
358
|
+
scalePct: undefined,
|
|
359
|
+
});
|
|
303
360
|
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
361
|
+
fireEvent.change(within(getFormGroupByLabel('Type')).getByRole('combobox'), {
|
|
362
|
+
target: { value: 'pct' },
|
|
363
|
+
});
|
|
364
|
+
expect(exact.updateStage.mock.lastCall?.[0]).toStrictEqual({
|
|
365
|
+
action: 'scale_up',
|
|
307
366
|
capacity: {},
|
|
308
367
|
resizeType: 'pct',
|
|
309
368
|
scaleNum: undefined,
|
|
310
369
|
scalePct: 0,
|
|
311
370
|
});
|
|
312
|
-
expect(exact.updateStageField).not.toHaveBeenCalled();
|
|
313
|
-
});
|
|
314
|
-
});
|
|
315
|
-
|
|
316
|
-
it('reports stale resize field removals without mutating the stage prop', () => {
|
|
317
|
-
const exact = renderStage({ scaleNum: 3 });
|
|
318
|
-
const originalExactStage = { ...exact.stage, capacity: { ...exact.stage.capacity } };
|
|
319
|
-
exact.updateStage.calls.reset();
|
|
320
|
-
exact.updateStageField.calls.reset();
|
|
321
|
-
|
|
322
|
-
exact.wrapper.find('select[name="action"]').simulate('change', { target: { value: 'scale_exact' } });
|
|
323
|
-
|
|
324
|
-
expect(exact.stage).toEqual(originalExactStage);
|
|
325
|
-
expect(exact.updateStage).toHaveBeenCalledWith({
|
|
326
|
-
action: 'scale_exact',
|
|
327
|
-
resizeType: 'exact',
|
|
328
|
-
scaleNum: undefined,
|
|
329
|
-
scalePct: undefined,
|
|
330
|
-
});
|
|
331
|
-
expect(exact.updateStageField).not.toHaveBeenCalled();
|
|
332
|
-
|
|
333
|
-
const incremental = renderStage({ capacity: { desired: 4 }, scalePct: 25 });
|
|
334
|
-
const originalIncrementalStage = { ...incremental.stage, capacity: { ...incremental.stage.capacity } };
|
|
335
|
-
incremental.updateStage.calls.reset();
|
|
336
|
-
incremental.updateStageField.calls.reset();
|
|
337
|
-
|
|
338
|
-
incremental.wrapper.find('select[name="resizeType"]').simulate('change', { target: { value: 'incr' } });
|
|
339
|
-
|
|
340
|
-
expect(incremental.stage).toEqual(originalIncrementalStage);
|
|
341
|
-
expect(incremental.updateStage).toHaveBeenCalledWith({
|
|
342
|
-
action: 'scale_up',
|
|
343
|
-
capacity: {},
|
|
344
|
-
resizeType: 'incr',
|
|
345
|
-
scaleNum: 0,
|
|
346
|
-
scalePct: undefined,
|
|
347
|
-
});
|
|
348
|
-
expect(incremental.updateStageField).not.toHaveBeenCalled();
|
|
349
|
-
|
|
350
|
-
const percentage = renderStage({ resizeType: 'incr', scaleNum: 3, scalePct: undefined });
|
|
351
|
-
const originalPercentageStage = { ...percentage.stage, capacity: { ...percentage.stage.capacity } };
|
|
352
|
-
percentage.updateStage.calls.reset();
|
|
353
|
-
percentage.updateStageField.calls.reset();
|
|
354
|
-
|
|
355
|
-
percentage.wrapper.find('select[name="resizeType"]').simulate('change', { target: { value: 'pct' } });
|
|
356
|
-
|
|
357
|
-
expect(percentage.stage).toEqual(originalPercentageStage);
|
|
358
|
-
expect(percentage.updateStage).toHaveBeenCalledWith({
|
|
359
|
-
action: 'scale_up',
|
|
360
|
-
capacity: {},
|
|
361
|
-
resizeType: 'pct',
|
|
362
|
-
scaleNum: undefined,
|
|
363
|
-
scalePct: 0,
|
|
364
|
-
});
|
|
365
|
-
expect(percentage.updateStageField).not.toHaveBeenCalled();
|
|
366
|
-
});
|
|
367
|
-
|
|
368
|
-
it('validates numeric modes while preserving pipeline expressions', () => {
|
|
369
|
-
const percentage = renderStage({ scalePct: 125 });
|
|
370
|
-
percentage.updateStageField.calls.reset();
|
|
371
|
-
const percentageInput = percentage.wrapper.find('input[name="scalePct"]');
|
|
372
|
-
|
|
373
|
-
expect(percentageInput.prop('aria-invalid')).toBe(false);
|
|
374
|
-
percentageInput.simulate('change', { target: { value: '${ parameters.percentage }' } });
|
|
375
|
-
expect(percentage.updateStageField).toHaveBeenCalledWith({ scalePct: '${ parameters.percentage }' });
|
|
376
|
-
|
|
377
|
-
const healthPercentage = renderStage({ targetHealthyDeployPercentage: 100 });
|
|
378
|
-
healthPercentage.updateStageField.calls.reset();
|
|
379
|
-
const healthPercentageInput = healthPercentage.wrapper.find('input[name="targetHealthyDeployPercentage"]');
|
|
380
|
-
|
|
381
|
-
expect(healthPercentageInput.prop('aria-invalid')).toBe(false);
|
|
382
|
-
healthPercentageInput.simulate('change', { target: { value: '${ parameters.healthPercentage }' } });
|
|
383
|
-
expect(healthPercentage.updateStageField).toHaveBeenCalledWith({
|
|
384
|
-
targetHealthyDeployPercentage: '${ parameters.healthPercentage }',
|
|
385
371
|
});
|
|
386
|
-
|
|
387
|
-
expect(renderStage({ scalePct: -1 }).wrapper.find('input[name="scalePct"]').prop('aria-invalid')).toBe(true);
|
|
388
|
-
expect(renderStage({ scalePct: 12.5 }).wrapper.find('input[name="scalePct"]').prop('aria-invalid')).toBe(true);
|
|
389
|
-
expect(
|
|
390
|
-
renderStage({ targetHealthyDeployPercentage: -1 })
|
|
391
|
-
.wrapper.find('input[name="targetHealthyDeployPercentage"]')
|
|
392
|
-
.prop('aria-invalid'),
|
|
393
|
-
).toBe(true);
|
|
394
|
-
expect(
|
|
395
|
-
renderStage({ targetHealthyDeployPercentage: 12.5 })
|
|
396
|
-
.wrapper.find('input[name="targetHealthyDeployPercentage"]')
|
|
397
|
-
.prop('aria-invalid'),
|
|
398
|
-
).toBe(true);
|
|
399
|
-
expect(
|
|
400
|
-
renderStage({ targetHealthyDeployPercentage: 101 })
|
|
401
|
-
.wrapper.find('input[name="targetHealthyDeployPercentage"]')
|
|
402
|
-
.prop('aria-invalid'),
|
|
403
|
-
).toBe(true);
|
|
404
|
-
expect(
|
|
405
|
-
renderStage({ action: 'scale_down', resizeType: 'incr', scaleNum: 2.5 })
|
|
406
|
-
.wrapper.find('input[name="scaleNum"]')
|
|
407
|
-
.prop('aria-invalid'),
|
|
408
|
-
).toBe(true);
|
|
409
|
-
expect(
|
|
410
|
-
renderStage({ action: 'scale_exact', capacity: { desired: 3, max: '${ parameters.max }', min: -1 } })
|
|
411
|
-
.wrapper.find('input[data-capacity-field="min"]')
|
|
412
|
-
.prop('aria-invalid'),
|
|
413
|
-
).toBe(true);
|
|
414
|
-
expect(
|
|
415
|
-
renderStage({ action: 'scale_exact', capacity: { desired: 3, max: '${ parameters.max }', min: 1 } })
|
|
416
|
-
.wrapper.find('input[data-capacity-field="max"]')
|
|
417
|
-
.prop('aria-invalid'),
|
|
418
|
-
).toBe(false);
|
|
419
372
|
});
|
|
420
373
|
|
|
421
|
-
it('keeps invalid
|
|
422
|
-
const
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
expect(
|
|
430
|
-
expect(
|
|
431
|
-
expect(
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
percentage.wrapper
|
|
440
|
-
.find('input[name="scalePct"]')
|
|
441
|
-
.simulate('change', { target: { value: '${ parameters.percentage }' } });
|
|
442
|
-
expect(percentage.updateStageField).toHaveBeenCalledWith({ scalePct: '${ parameters.percentage }' });
|
|
374
|
+
it('keeps invalid percentage edits local and reports valid values and expressions', () => {
|
|
375
|
+
const rendered = renderStage({ scalePct: 25 });
|
|
376
|
+
rendered.updateStageField.mockClear();
|
|
377
|
+
const percentage = screen.getByRole('textbox', { name: 'Resize percentage' });
|
|
378
|
+
|
|
379
|
+
for (const value of ['12.5', '-1', 'Infinity']) {
|
|
380
|
+
fireEvent.change(percentage, { target: { value } });
|
|
381
|
+
expect(percentage).toHaveValue(value);
|
|
382
|
+
expect(percentage).toHaveAttribute('aria-invalid', 'true');
|
|
383
|
+
expect(rendered.initialStage.scalePct).toBe(25);
|
|
384
|
+
expect(rendered.updateStageField).not.toHaveBeenCalled();
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
fireEvent.change(percentage, { target: { value: '125' } });
|
|
388
|
+
expect(rendered.updateStageField).toHaveBeenCalledWith({ scalePct: 125 });
|
|
389
|
+
rendered.updateStageField.mockClear();
|
|
390
|
+
fireEvent.change(percentage, { target: { value: '${ parameters.percentage }' } });
|
|
391
|
+
expect(rendered.updateStageField).toHaveBeenCalledWith({ scalePct: '${ parameters.percentage }' });
|
|
443
392
|
});
|
|
444
393
|
|
|
445
|
-
it('keeps invalid health
|
|
394
|
+
it('keeps invalid health and incremental edits local and reports valid values', () => {
|
|
446
395
|
const health = renderStage({ targetHealthyDeployPercentage: 75 });
|
|
447
|
-
health.updateStageField.
|
|
396
|
+
health.updateStageField.mockClear();
|
|
397
|
+
const healthPercentage = screen.getByRole('textbox', { name: 'Target healthy percentage' });
|
|
448
398
|
|
|
449
|
-
['75.5', '-1', '101', 'Infinity']
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
expect(input.prop('value')).toBe(value);
|
|
454
|
-
expect(input.prop('aria-invalid')).toBe(true);
|
|
455
|
-
expect(health.stage.targetHealthyDeployPercentage).toBe(75);
|
|
399
|
+
for (const value of ['75.5', '-1', '101', 'Infinity']) {
|
|
400
|
+
fireEvent.change(healthPercentage, { target: { value } });
|
|
401
|
+
expect(healthPercentage).toHaveValue(value);
|
|
402
|
+
expect(healthPercentage).toHaveAttribute('aria-invalid', 'true');
|
|
456
403
|
expect(health.updateStageField).not.toHaveBeenCalled();
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
health.wrapper.find('input[name="targetHealthyDeployPercentage"]').simulate('change', { target: { value: '100' } });
|
|
404
|
+
}
|
|
405
|
+
fireEvent.change(healthPercentage, { target: { value: '100' } });
|
|
460
406
|
expect(health.updateStageField).toHaveBeenCalledWith({ targetHealthyDeployPercentage: 100 });
|
|
407
|
+
health.unmount();
|
|
461
408
|
|
|
462
|
-
health.updateStageField.calls.reset();
|
|
463
|
-
health.wrapper
|
|
464
|
-
.find('input[name="targetHealthyDeployPercentage"]')
|
|
465
|
-
.simulate('change', { target: { value: '${ parameters.healthPercentage }' } });
|
|
466
|
-
expect(health.updateStageField).toHaveBeenCalledWith({
|
|
467
|
-
targetHealthyDeployPercentage: '${ parameters.healthPercentage }',
|
|
468
|
-
});
|
|
469
|
-
});
|
|
470
|
-
|
|
471
|
-
it('keeps invalid incremental edits local and only reports valid values', () => {
|
|
472
409
|
const incremental = renderStage({ action: 'scale_down', resizeType: 'incr', scaleNum: 2 });
|
|
473
|
-
incremental.updateStageField.
|
|
474
|
-
|
|
475
|
-
['2.5', '-1', 'NaN']
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
expect(input.prop('value')).toBe(value);
|
|
480
|
-
expect(input.prop('aria-invalid')).toBe(true);
|
|
481
|
-
expect(incremental.stage.scaleNum).toBe(2);
|
|
410
|
+
incremental.updateStageField.mockClear();
|
|
411
|
+
const count = screen.getByRole('textbox', { name: 'Resize count' });
|
|
412
|
+
for (const value of ['2.5', '-1', 'NaN']) {
|
|
413
|
+
fireEvent.change(count, { target: { value } });
|
|
414
|
+
expect(count).toHaveValue(value);
|
|
415
|
+
expect(count).toHaveAttribute('aria-invalid', 'true');
|
|
482
416
|
expect(incremental.updateStageField).not.toHaveBeenCalled();
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
incremental.wrapper.find('input[name="scaleNum"]').simulate('change', { target: { value: '3' } });
|
|
417
|
+
}
|
|
418
|
+
fireEvent.change(count, { target: { value: '3' } });
|
|
486
419
|
expect(incremental.updateStageField).toHaveBeenCalledWith({ scaleNum: 3 });
|
|
487
|
-
|
|
488
|
-
incremental.updateStageField.calls.reset();
|
|
489
|
-
incremental.wrapper
|
|
490
|
-
.find('input[name="scaleNum"]')
|
|
491
|
-
.simulate('change', { target: { value: '${ parameters.count }' } });
|
|
492
|
-
expect(incremental.updateStageField).toHaveBeenCalledWith({ scaleNum: '${ parameters.count }' });
|
|
493
|
-
|
|
494
|
-
incremental.wrapper.setProps({ stage: { ...incremental.stage, scaleNum: 4 } });
|
|
495
|
-
incremental.wrapper.update();
|
|
496
|
-
expect(incremental.wrapper.find('input[name="scaleNum"]').prop('value')).toBe(4);
|
|
497
420
|
});
|
|
498
421
|
|
|
499
|
-
it('keeps invalid exact capacity edits local
|
|
500
|
-
const
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
{ field: 'max', value: '-1' },
|
|
505
|
-
{ field: 'desired', value: 'NaN' },
|
|
506
|
-
].forEach(({ field, value }) => {
|
|
507
|
-
const exact = renderStage({ action: 'scale_exact', capacity, resizeType: 'exact' });
|
|
508
|
-
exact.updateStageField.calls.reset();
|
|
509
|
-
|
|
510
|
-
exact.wrapper.find(`input[data-capacity-field="${field}"]`).simulate('change', { target: { value } });
|
|
511
|
-
|
|
512
|
-
const input = exact.wrapper.find(`input[data-capacity-field="${field}"]`);
|
|
513
|
-
expect(input.prop('value')).toBe(value);
|
|
514
|
-
expect(input.prop('aria-invalid')).toBe(true);
|
|
515
|
-
expect(exact.stage.capacity).toEqual(capacity);
|
|
516
|
-
expect(exact.updateStageField).not.toHaveBeenCalled();
|
|
422
|
+
it('keeps invalid exact capacity edits local', () => {
|
|
423
|
+
const rendered = renderStage({
|
|
424
|
+
action: 'scale_exact',
|
|
425
|
+
capacity: { min: 1, max: 2, desired: 3 },
|
|
426
|
+
resizeType: 'exact',
|
|
517
427
|
});
|
|
428
|
+
rendered.updateStageField.mockClear();
|
|
429
|
+
|
|
430
|
+
for (const [name, value] of [
|
|
431
|
+
['Minimum capacity', '1.5'],
|
|
432
|
+
['Maximum capacity', '-1'],
|
|
433
|
+
['Desired capacity', 'NaN'],
|
|
434
|
+
]) {
|
|
435
|
+
const input = screen.getByRole('textbox', { name });
|
|
436
|
+
fireEvent.change(input, { target: { value } });
|
|
437
|
+
expect(input).toHaveValue(value);
|
|
438
|
+
expect(input).toHaveAttribute('aria-invalid', 'true');
|
|
439
|
+
}
|
|
440
|
+
expect(rendered.initialStage.capacity).toEqual({ min: 1, max: 2, desired: 3 });
|
|
441
|
+
expect(rendered.updateStageField).not.toHaveBeenCalled();
|
|
442
|
+
});
|
|
518
443
|
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
expect(
|
|
530
|
-
|
|
444
|
+
it('reports valid exact capacities in min, max, desired order', () => {
|
|
445
|
+
const rendered = renderStage({
|
|
446
|
+
action: 'scale_exact',
|
|
447
|
+
capacity: { min: 1, max: 2, desired: 3 },
|
|
448
|
+
resizeType: 'exact',
|
|
449
|
+
});
|
|
450
|
+
rendered.updateStageField.mockClear();
|
|
451
|
+
const input = (name: string) => screen.getByRole('textbox', { name });
|
|
452
|
+
|
|
453
|
+
fireEvent.change(input('Minimum capacity'), { target: { value: '4' } });
|
|
454
|
+
expect(rendered.updateStageField).toHaveBeenLastCalledWith({ capacity: { min: 4, max: 2, desired: 3 } });
|
|
455
|
+
fireEvent.change(input('Maximum capacity'), { target: { value: '${ parameters.max }' } });
|
|
456
|
+
expect(rendered.updateStageField).toHaveBeenLastCalledWith({
|
|
457
|
+
capacity: { min: 4, max: '${ parameters.max }', desired: 3 },
|
|
458
|
+
});
|
|
459
|
+
fireEvent.change(input('Desired capacity'), { target: { value: '5' } });
|
|
460
|
+
expect(rendered.updateStageField).toHaveBeenLastCalledWith({
|
|
461
|
+
capacity: { min: 4, max: '${ parameters.max }', desired: 5 },
|
|
531
462
|
});
|
|
532
|
-
|
|
533
|
-
exact.updateStageField.calls.reset();
|
|
534
|
-
exact.wrapper.find('input[data-capacity-field="desired"]').simulate('change', { target: { value: '5' } });
|
|
535
|
-
expect(exact.updateStageField).toHaveBeenCalledWith({ capacity: { min: 1, max: 2, desired: 5 } });
|
|
536
|
-
|
|
537
|
-
exact.wrapper.setProps({ stage: { ...exact.stage, capacity: { min: 4, max: 5, desired: 6 } } });
|
|
538
|
-
exact.wrapper.update();
|
|
539
|
-
const inputs = exact.wrapper.find('input[data-capacity-field]');
|
|
540
|
-
expect(inputs.map((input) => input.prop('data-capacity-field'))).toEqual(['min', 'max', 'desired']);
|
|
541
|
-
expect(inputs.map((input) => input.prop('value'))).toEqual([4, 5, 6]);
|
|
542
463
|
});
|
|
543
464
|
|
|
544
|
-
it('synchronizes controlled
|
|
545
|
-
const rendered = renderStage({ scalePct: 25, targetHealthyDeployPercentage: 75 });
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
.find('input[name="targetHealthyDeployPercentage"]')
|
|
550
|
-
.simulate('change', { target: { value: '101' } });
|
|
551
|
-
|
|
552
|
-
rendered.wrapper.setProps({
|
|
553
|
-
stage: { ...rendered.stage, scalePct: 50, targetHealthyDeployPercentage: 80 },
|
|
465
|
+
it('synchronizes controlled drafts when persisted stage values change', () => {
|
|
466
|
+
const rendered = renderStage({ refId: 'stage-a', scalePct: 25, targetHealthyDeployPercentage: 75 });
|
|
467
|
+
fireEvent.change(screen.getByRole('textbox', { name: 'Resize percentage' }), { target: { value: '12.5' } });
|
|
468
|
+
fireEvent.change(screen.getByRole('textbox', { name: 'Target healthy percentage' }), {
|
|
469
|
+
target: { value: '101' },
|
|
554
470
|
});
|
|
555
|
-
rendered.wrapper.update();
|
|
556
471
|
|
|
557
|
-
|
|
558
|
-
expect(rendered.wrapper.find('input[name="targetHealthyDeployPercentage"]').prop('value')).toBe(80);
|
|
559
|
-
});
|
|
472
|
+
rendered.replaceStage({ ...rendered.initialStage, scalePct: 50, targetHealthyDeployPercentage: 80 });
|
|
560
473
|
|
|
561
|
-
|
|
562
|
-
|
|
474
|
+
expect(screen.getByRole('textbox', { name: 'Resize percentage' })).toHaveValue('50');
|
|
475
|
+
expect(screen.getByRole('textbox', { name: 'Target healthy percentage' })).toHaveValue('80');
|
|
476
|
+
});
|
|
563
477
|
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
478
|
+
it('resets every controlled draft when refId changes with equal persisted values', () => {
|
|
479
|
+
const percentage = renderStage({ refId: 'stage-a', scalePct: 25, targetHealthyDeployPercentage: 75 });
|
|
480
|
+
fireEvent.change(screen.getByRole('textbox', { name: 'Resize percentage' }), { target: { value: '12.5' } });
|
|
481
|
+
fireEvent.change(screen.getByRole('textbox', { name: 'Target healthy percentage' }), {
|
|
482
|
+
target: { value: '101' },
|
|
568
483
|
});
|
|
569
|
-
percentage.updateStageField.
|
|
570
|
-
percentage.
|
|
571
|
-
percentage.
|
|
572
|
-
|
|
573
|
-
.simulate('change', { target: { value: '101' } });
|
|
574
|
-
const nextPercentageStage = { ...percentage.stage, refId: 'stage-b' };
|
|
575
|
-
percentage.wrapper.setProps({ stage: nextPercentageStage });
|
|
576
|
-
percentage.wrapper.update();
|
|
577
|
-
|
|
578
|
-
expect(percentage.wrapper.find('input[name="scalePct"]').prop('value')).toBe(25);
|
|
579
|
-
expect(percentage.wrapper.find('input[name="scalePct"]').prop('aria-invalid')).toBe(false);
|
|
580
|
-
expect(percentage.wrapper.find('input[name="targetHealthyDeployPercentage"]').prop('value')).toBe(75);
|
|
581
|
-
expect(percentage.wrapper.find('input[name="targetHealthyDeployPercentage"]').prop('aria-invalid')).toBe(false);
|
|
484
|
+
percentage.updateStageField.mockClear();
|
|
485
|
+
percentage.replaceStage({ ...percentage.initialStage, refId: 'stage-b' });
|
|
486
|
+
expect(screen.getByRole('textbox', { name: 'Resize percentage' })).toHaveValue('25');
|
|
487
|
+
expect(screen.getByRole('textbox', { name: 'Target healthy percentage' })).toHaveValue('75');
|
|
582
488
|
expect(percentage.updateStageField).not.toHaveBeenCalled();
|
|
583
|
-
|
|
489
|
+
percentage.unmount();
|
|
584
490
|
|
|
585
491
|
const incremental = renderStage({ action: 'scale_down', refId: 'stage-a', resizeType: 'incr', scaleNum: 2 });
|
|
586
|
-
|
|
587
|
-
incremental.
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
incremental.wrapper.update();
|
|
591
|
-
|
|
592
|
-
expect(incremental.wrapper.find('input[name="scaleNum"]').prop('value')).toBe(2);
|
|
593
|
-
expect(incremental.wrapper.find('input[name="scaleNum"]').prop('aria-invalid')).toBe(false);
|
|
492
|
+
fireEvent.change(screen.getByRole('textbox', { name: 'Resize count' }), { target: { value: '2.5' } });
|
|
493
|
+
incremental.updateStageField.mockClear();
|
|
494
|
+
incremental.replaceStage({ ...incremental.initialStage, refId: 'stage-b' });
|
|
495
|
+
expect(screen.getByRole('textbox', { name: 'Resize count' })).toHaveValue('2');
|
|
594
496
|
expect(incremental.updateStageField).not.toHaveBeenCalled();
|
|
595
|
-
|
|
497
|
+
incremental.unmount();
|
|
596
498
|
|
|
597
499
|
const exact = renderStage({
|
|
598
500
|
action: 'scale_exact',
|
|
@@ -600,18 +502,30 @@ describe('AWS Resize Server Group stage', () => {
|
|
|
600
502
|
refId: 'stage-a',
|
|
601
503
|
resizeType: 'exact',
|
|
602
504
|
});
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
const capacityInputs = exact.wrapper.find('input[data-capacity-field]');
|
|
612
|
-
expect(capacityInputs.map((input) => input.prop('value'))).toEqual([1, 2, 3]);
|
|
613
|
-
expect(capacityInputs.map((input) => input.prop('aria-invalid'))).toEqual([false, false, false]);
|
|
505
|
+
for (const name of ['Minimum capacity', 'Maximum capacity', 'Desired capacity']) {
|
|
506
|
+
fireEvent.change(screen.getByRole('textbox', { name }), { target: { value: 'NaN' } });
|
|
507
|
+
}
|
|
508
|
+
exact.updateStageField.mockClear();
|
|
509
|
+
exact.replaceStage({ ...exact.initialStage, refId: 'stage-b' });
|
|
510
|
+
expect(screen.getByRole('textbox', { name: 'Minimum capacity' })).toHaveValue('1');
|
|
511
|
+
expect(screen.getByRole('textbox', { name: 'Maximum capacity' })).toHaveValue('2');
|
|
512
|
+
expect(screen.getByRole('textbox', { name: 'Desired capacity' })).toHaveValue('3');
|
|
614
513
|
expect(exact.updateStageField).not.toHaveBeenCalled();
|
|
615
|
-
|
|
514
|
+
});
|
|
515
|
+
|
|
516
|
+
it('renders the account, region, and cluster selector outside strategy pipelines', async () => {
|
|
517
|
+
vi.spyOn(AccountService, 'listAccounts').mockResolvedValue([{ name: 'test-account' }] as any);
|
|
518
|
+
vi.spyOn(AccountService, 'getUniqueAttributeForAllAccounts').mockResolvedValue(['eu-west-1'] as any);
|
|
519
|
+
renderStage(
|
|
520
|
+
{ cloudProviderType: 'aws', credentials: 'test-account', regions: ['eu-west-1'] },
|
|
521
|
+
{},
|
|
522
|
+
{ strategy: false },
|
|
523
|
+
);
|
|
524
|
+
|
|
525
|
+
await waitFor(() =>
|
|
526
|
+
expect(within(getFormGroupByLabel('Account')).getByRole('combobox')).toHaveValue('test-account'),
|
|
527
|
+
);
|
|
528
|
+
expect(within(getFormGroupByLabel('Regions')).getByRole('checkbox', { name: 'eu-west-1' })).toBeChecked();
|
|
529
|
+
expect(within(getFormGroupByLabel('Cluster')).getByRole('combobox')).toHaveDisplayValue('Select a cluster...');
|
|
616
530
|
});
|
|
617
531
|
});
|