@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,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { fireEvent, screen, waitFor } from '@testing-library/react';
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
2
3
|
import React from 'react';
|
|
3
4
|
|
|
4
5
|
import {
|
|
5
|
-
|
|
6
|
+
AccountService,
|
|
7
|
+
DeckRuntimeContext,
|
|
6
8
|
ReactModal,
|
|
7
9
|
ServerGroupWriter,
|
|
8
|
-
SpinFormik,
|
|
9
10
|
TaskExecutor,
|
|
10
|
-
|
|
11
|
-
TaskReason,
|
|
12
|
-
UserVerification,
|
|
11
|
+
TaskReader,
|
|
13
12
|
} from '@spinnaker/core';
|
|
13
|
+
import { renderWithRouter } from '../../../../../core/src/utils/testUtils/rtl';
|
|
14
14
|
|
|
15
15
|
import type { IAmazonServerGroup } from '../../../domain';
|
|
16
16
|
import {
|
|
@@ -35,40 +35,23 @@ describe('AmazonRollbackServerGroupModal', () => {
|
|
|
35
35
|
type: 'aws',
|
|
36
36
|
} as IAmazonServerGroup;
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
serverGroups: { refresh: jasmine.createSpy('refresh') },
|
|
51
|
-
} as any;
|
|
52
|
-
}
|
|
38
|
+
const previousServerGroup = (name = 'fnord-main-v003') => ({ ...serverGroup, isDisabled: true, name });
|
|
39
|
+
const application = (attributes: any = {}) =>
|
|
40
|
+
({ attributes, getDataSource: vi.fn(), name: 'fnord', serverGroups: { refresh: vi.fn() } } as any);
|
|
41
|
+
const props = (app = application(), overrides: any = {}) => ({
|
|
42
|
+
allServerGroups: [previousServerGroup()],
|
|
43
|
+
application: app,
|
|
44
|
+
closeModal: vi.fn(),
|
|
45
|
+
dismissModal: vi.fn(),
|
|
46
|
+
previousServerGroup: previousServerGroup(),
|
|
47
|
+
serverGroup,
|
|
48
|
+
...overrides,
|
|
49
|
+
});
|
|
53
50
|
|
|
54
|
-
|
|
55
|
-
return {
|
|
56
|
-
allServerGroups: [previousServerGroup()],
|
|
57
|
-
application: app,
|
|
58
|
-
closeModal: jasmine.createSpy('closeModal'),
|
|
59
|
-
dismissModal: jasmine.createSpy('dismissModal'),
|
|
60
|
-
previousServerGroup: previousServerGroup(),
|
|
61
|
-
serverGroup,
|
|
62
|
-
...overrides,
|
|
63
|
-
};
|
|
64
|
-
}
|
|
51
|
+
beforeEach(() => vi.spyOn(AccountService, 'challengeDestructiveActions').mockResolvedValue(true));
|
|
65
52
|
|
|
66
53
|
it('uses capacity-sensitive healthy percentage defaults', () => {
|
|
67
|
-
expect(getDefaultAmazonHealthyRollbackPercentage
|
|
68
|
-
expect(getDefaultAmazonHealthyRollbackPercentage(9)).toBe(100);
|
|
69
|
-
expect(getDefaultAmazonHealthyRollbackPercentage(10)).toBe(90);
|
|
70
|
-
expect(getDefaultAmazonHealthyRollbackPercentage(19)).toBe(90);
|
|
71
|
-
expect(getDefaultAmazonHealthyRollbackPercentage(20)).toBe(95);
|
|
54
|
+
expect([0, 9, 10, 19, 20].map(getDefaultAmazonHealthyRollbackPercentage)).toEqual([100, 100, 90, 90, 95]);
|
|
72
55
|
});
|
|
73
56
|
|
|
74
57
|
it('normalizes previous-image metadata and selects that mode only without deployed candidates', () => {
|
|
@@ -96,6 +79,7 @@ describe('AmazonRollbackServerGroupModal', () => {
|
|
|
96
79
|
});
|
|
97
80
|
expect(getAmazonRollbackType(withPreviousImage, [])).toBe('PREVIOUS_IMAGE');
|
|
98
81
|
expect(getAmazonRollbackType(withPreviousImage, [previousServerGroup()])).toBe('EXPLICIT');
|
|
82
|
+
expect(getAmazonRollbackType(serverGroup, [])).toBe('EXPLICIT');
|
|
99
83
|
expect(
|
|
100
84
|
getAmazonPreviousImageServerGroup({
|
|
101
85
|
...withPreviousImage,
|
|
@@ -110,7 +94,7 @@ describe('AmazonRollbackServerGroupModal', () => {
|
|
|
110
94
|
},
|
|
111
95
|
},
|
|
112
96
|
},
|
|
113
|
-
}),
|
|
97
|
+
} as any),
|
|
114
98
|
).toEqual({ imageId: undefined, imageName: 'fnord-20260712', name: 'fnord-main-v003' });
|
|
115
99
|
});
|
|
116
100
|
|
|
@@ -120,7 +104,6 @@ describe('AmazonRollbackServerGroupModal', () => {
|
|
|
120
104
|
restoreServerGroupName: 'fnord-main-v003',
|
|
121
105
|
targetHealthyRollbackPercentage: 95,
|
|
122
106
|
};
|
|
123
|
-
|
|
124
107
|
expect(validateAmazonRollbackValues(valid, 'EXPLICIT', ['fnord-main-v003'])).toEqual({});
|
|
125
108
|
expect(validateAmazonRollbackValues({ ...valid, restoreServerGroupName: undefined }, 'EXPLICIT')).toEqual({
|
|
126
109
|
restoreServerGroupName: 'Select a server group to restore',
|
|
@@ -172,11 +155,11 @@ describe('AmazonRollbackServerGroupModal', () => {
|
|
|
172
155
|
delayBeforeDisableSeconds: 0,
|
|
173
156
|
targetHealthyRollbackPercentage: 90,
|
|
174
157
|
});
|
|
175
|
-
spyOn(TaskExecutor, 'executeTask').
|
|
158
|
+
vi.spyOn(TaskExecutor, 'executeTask').mockResolvedValue({} as any);
|
|
176
159
|
|
|
177
160
|
new ServerGroupWriter(null).rollbackServerGroup(serverGroup, app, command);
|
|
178
161
|
|
|
179
|
-
expect(TaskExecutor.executeTask).
|
|
162
|
+
expect(TaskExecutor.executeTask).toHaveBeenCalledExactlyOnceWith({
|
|
180
163
|
application: app,
|
|
181
164
|
description: 'Rollback Server Group: fnord-main-v004',
|
|
182
165
|
job: [
|
|
@@ -201,53 +184,34 @@ describe('AmazonRollbackServerGroupModal', () => {
|
|
|
201
184
|
});
|
|
202
185
|
});
|
|
203
186
|
|
|
204
|
-
it('renders
|
|
187
|
+
it('renders the controlled rollback form and submits exact values after verification', async () => {
|
|
205
188
|
const app = application({ platformHealthOnly: true, platformHealthOnlyShowOverride: true });
|
|
206
|
-
const
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
<
|
|
210
|
-
{(
|
|
211
|
-
|
|
212
|
-
isValid: true,
|
|
213
|
-
setFieldValue: jasmine.createSpy('setFieldValue'),
|
|
214
|
-
values: formik.prop('initialValues'),
|
|
215
|
-
})}
|
|
216
|
-
</div>,
|
|
189
|
+
const rollbackServerGroup = vi.fn().mockResolvedValue({ id: 'task-id' });
|
|
190
|
+
vi.spyOn(TaskReader, 'waitUntilTaskCompletes').mockResolvedValue({} as any);
|
|
191
|
+
renderWithRouter(
|
|
192
|
+
<DeckRuntimeContext.Provider value={{ services: { serverGroupWriter: { rollbackServerGroup } } } as any}>
|
|
193
|
+
<AmazonRollbackServerGroupModal {...props(app)} />
|
|
194
|
+
</DeckRuntimeContext.Provider>,
|
|
217
195
|
);
|
|
218
196
|
|
|
219
|
-
expect(
|
|
220
|
-
expect(
|
|
221
|
-
expect(
|
|
222
|
-
expect(
|
|
223
|
-
expect(
|
|
224
|
-
expect(content.find(UserVerification).prop('account')).toBe('test-account');
|
|
225
|
-
expect(content.find(PlatformHealthOverride).props()).toEqual(
|
|
226
|
-
jasmine.objectContaining({ interestingHealthProviderNames: ['Amazon'], platformHealthType: 'Amazon' }),
|
|
227
|
-
);
|
|
228
|
-
});
|
|
197
|
+
expect(screen.getByRole('combobox', { name: 'Server group to restore' })).toHaveValue('fnord-main-v003');
|
|
198
|
+
expect(screen.getByRole('spinbutton', { name: 'Delay before disabling' })).toHaveValue(0);
|
|
199
|
+
expect(screen.getByRole('spinbutton', { name: 'Target healthy rollback percentage' })).toHaveValue(90);
|
|
200
|
+
expect(screen.getByText(/Type the name of the account/)).toHaveTextContent('test-account');
|
|
201
|
+
expect(screen.getByRole('button', { name: 'Submit' })).toBeDisabled();
|
|
229
202
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
restoreServerGroupName: 'fnord-main-v003',
|
|
241
|
-
targetHealthyRollbackPercentage: 95,
|
|
242
|
-
};
|
|
243
|
-
|
|
244
|
-
(component as any).submit(values);
|
|
245
|
-
expect(writer.rollbackServerGroup).not.toHaveBeenCalled();
|
|
246
|
-
|
|
247
|
-
component.state.verified = true;
|
|
248
|
-
(component as any).submit(values);
|
|
203
|
+
fireEvent.change(screen.getByRole('spinbutton', { name: 'Delay before disabling' }), {
|
|
204
|
+
target: { value: '30' },
|
|
205
|
+
});
|
|
206
|
+
fireEvent.change(screen.getByRole('spinbutton', { name: 'Target healthy rollback percentage' }), {
|
|
207
|
+
target: { value: '95' },
|
|
208
|
+
});
|
|
209
|
+
await userEvent.type(screen.getByRole('textbox', { name: 'Reason' }), 'rollback requested');
|
|
210
|
+
await userEvent.type(screen.getByRole('textbox', { name: 'Confirm account test-account' }), 'test-account');
|
|
211
|
+
await waitFor(() => expect(screen.getByRole('button', { name: 'Submit' })).toBeEnabled());
|
|
212
|
+
fireEvent.click(screen.getByRole('button', { name: 'Submit' }));
|
|
249
213
|
|
|
250
|
-
expect(
|
|
214
|
+
expect(rollbackServerGroup).toHaveBeenCalledWith(serverGroup, app, {
|
|
251
215
|
interestingHealthProviderNames: ['Amazon'],
|
|
252
216
|
platformHealthOnlyShowOverride: true,
|
|
253
217
|
reason: 'rollback requested',
|
|
@@ -259,27 +223,55 @@ describe('AmazonRollbackServerGroupModal', () => {
|
|
|
259
223
|
},
|
|
260
224
|
rollbackType: 'EXPLICIT',
|
|
261
225
|
});
|
|
226
|
+
await waitFor(() => expect(app.serverGroups.refresh).toHaveBeenCalledExactlyOnceWith());
|
|
262
227
|
});
|
|
263
228
|
|
|
264
|
-
it('
|
|
265
|
-
const
|
|
266
|
-
|
|
267
|
-
|
|
229
|
+
it('dismisses through the public cancel action', async () => {
|
|
230
|
+
const modalProps = props();
|
|
231
|
+
renderWithRouter(
|
|
232
|
+
<DeckRuntimeContext.Provider value={{ services: {} } as any}>
|
|
233
|
+
<AmazonRollbackServerGroupModal {...modalProps} />
|
|
234
|
+
</DeckRuntimeContext.Provider>,
|
|
235
|
+
);
|
|
268
236
|
|
|
269
|
-
|
|
270
|
-
component.state.taskMonitor.closeModal();
|
|
237
|
+
await userEvent.click(screen.getByRole('button', { name: 'Cancel' }));
|
|
271
238
|
|
|
272
|
-
expect(
|
|
273
|
-
expect(modalProps.dismissModal).toHaveBeenCalled();
|
|
239
|
+
expect(modalProps.dismissModal).toHaveBeenCalledExactlyOnceWith();
|
|
274
240
|
});
|
|
275
241
|
|
|
276
|
-
it('
|
|
277
|
-
const
|
|
242
|
+
it('dismisses a submitted task through TaskMonitor close', async () => {
|
|
243
|
+
const modalProps = props();
|
|
244
|
+
const rollbackServerGroup = vi.fn().mockReturnValue(new Promise(() => undefined));
|
|
245
|
+
const cancelPolling = vi.spyOn(TaskReader, 'cancelPolling');
|
|
246
|
+
renderWithRouter(
|
|
247
|
+
<DeckRuntimeContext.Provider value={{ services: { serverGroupWriter: { rollbackServerGroup } } } as any}>
|
|
248
|
+
<AmazonRollbackServerGroupModal {...modalProps} />
|
|
249
|
+
</DeckRuntimeContext.Provider>,
|
|
250
|
+
);
|
|
251
|
+
|
|
252
|
+
await userEvent.type(screen.getByRole('textbox', { name: 'Confirm account test-account' }), 'test-account');
|
|
253
|
+
await waitFor(() => expect(screen.getByRole('button', { name: 'Submit' })).toBeEnabled());
|
|
254
|
+
await userEvent.click(screen.getByRole('button', { name: 'Submit' }));
|
|
255
|
+
expect(rollbackServerGroup).toHaveBeenCalledOnce();
|
|
256
|
+
cancelPolling.mockClear();
|
|
257
|
+
await userEvent.click(await screen.findByRole('button', { name: 'Close' }));
|
|
258
|
+
|
|
259
|
+
expect(cancelPolling).toHaveBeenCalledExactlyOnceWith(null);
|
|
260
|
+
expect(modalProps.dismissModal).toHaveBeenCalledExactlyOnceWith();
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
it('exposes a show primitive for actions integration', () => {
|
|
264
|
+
const show = vi.spyOn(ReactModal, 'show').mockResolvedValue({} as any);
|
|
278
265
|
const modalProps = props();
|
|
279
266
|
const runtimeServices = {} as any;
|
|
280
267
|
|
|
281
268
|
AmazonRollbackServerGroupModal.show(modalProps, runtimeServices);
|
|
282
269
|
|
|
283
|
-
expect(show).
|
|
270
|
+
expect(show).toHaveBeenCalledExactlyOnceWith(
|
|
271
|
+
AmazonRollbackServerGroupModal,
|
|
272
|
+
modalProps,
|
|
273
|
+
undefined,
|
|
274
|
+
runtimeServices,
|
|
275
|
+
);
|
|
284
276
|
});
|
|
285
277
|
});
|
|
@@ -264,6 +264,7 @@ export class AmazonRollbackServerGroupModal extends React.Component<
|
|
|
264
264
|
));
|
|
265
265
|
return (
|
|
266
266
|
<select
|
|
267
|
+
aria-label="Server group to restore"
|
|
267
268
|
className="form-control input-sm"
|
|
268
269
|
name="restoreServerGroupName"
|
|
269
270
|
onChange={(event) => setFieldValue('restoreServerGroupName', event.target.value || undefined)}
|
|
@@ -375,6 +376,7 @@ export class AmazonRollbackServerGroupModal extends React.Component<
|
|
|
375
376
|
<div className="col-sm-11 col-sm-offset-1">
|
|
376
377
|
Wait{' '}
|
|
377
378
|
<input
|
|
379
|
+
aria-label="Delay before disabling"
|
|
378
380
|
className="form-control input-sm inline-number"
|
|
379
381
|
min={0}
|
|
380
382
|
name="delayBeforeDisableSeconds"
|
|
@@ -397,6 +399,7 @@ export class AmazonRollbackServerGroupModal extends React.Component<
|
|
|
397
399
|
<div className="col-sm-11 col-sm-offset-1">
|
|
398
400
|
Consider rollback successful when{' '}
|
|
399
401
|
<input
|
|
402
|
+
aria-label="Target healthy rollback percentage"
|
|
400
403
|
className="form-control input-sm inline-number"
|
|
401
404
|
max={100}
|
|
402
405
|
min={0}
|
package/src/serverGroup/details/scalingPolicy/targetTracking/TargetTrackingAdditionalSettings.tsx
CHANGED
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
import { set } from 'lodash';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { CheckboxInput,
|
|
3
|
+
import { CheckboxInput, NumberInput } from '@spinnaker/core';
|
|
4
4
|
import type { IUpsertScalingPolicyCommand } from '../ScalingPolicyWriter';
|
|
5
5
|
|
|
6
6
|
import './TargetTrackingAdditionalSettings.less';
|
|
7
7
|
|
|
8
8
|
export interface ITargetTrackingAdditionalSettingsProps {
|
|
9
9
|
command: IUpsertScalingPolicyCommand;
|
|
10
|
-
cooldowns?: boolean;
|
|
11
10
|
policyName?: string;
|
|
12
11
|
updateCommand: (command: IUpsertScalingPolicyCommand) => void;
|
|
13
12
|
}
|
|
14
13
|
|
|
15
14
|
export const TargetTrackingAdditionalSettings = ({
|
|
16
15
|
command,
|
|
17
|
-
cooldowns,
|
|
18
16
|
policyName,
|
|
19
17
|
updateCommand,
|
|
20
18
|
}: ITargetTrackingAdditionalSettingsProps) => {
|
|
@@ -81,42 +79,6 @@ export const TargetTrackingAdditionalSettings = ({
|
|
|
81
79
|
)}
|
|
82
80
|
</div>
|
|
83
81
|
</div>
|
|
84
|
-
{cooldowns && !scaleInDisabled && (
|
|
85
|
-
<div className="row">
|
|
86
|
-
<div className="col-md-3 sm-label-right">
|
|
87
|
-
<span className="sp-margin-xs-right">Scale In Cooldown</span>
|
|
88
|
-
<HelpField id="titus.autoscaling.scaleIn.cooldown" />
|
|
89
|
-
</div>
|
|
90
|
-
<div className="col-md-9 horizontal middle">
|
|
91
|
-
<NumberInput
|
|
92
|
-
value={command.targetTrackingConfiguration.scaleInCooldown}
|
|
93
|
-
onChange={(e) =>
|
|
94
|
-
setCommandField('targetTrackingConfiguration.scaleInCooldown', Number.parseInt(e.target.value))
|
|
95
|
-
}
|
|
96
|
-
inputClassName="sp-margin-xs-xaxis number-input-sm"
|
|
97
|
-
/>
|
|
98
|
-
<span className="input-label"> seconds </span>
|
|
99
|
-
</div>
|
|
100
|
-
</div>
|
|
101
|
-
)}
|
|
102
|
-
{cooldowns && (
|
|
103
|
-
<div className="row">
|
|
104
|
-
<div className="col-md-3 sm-label-right">
|
|
105
|
-
<span className="sp-margin-xs-right">Scale Out Cooldown</span>
|
|
106
|
-
<HelpField id="titus.autoscaling.scaleOut.cooldown" />
|
|
107
|
-
</div>
|
|
108
|
-
<div className="col-md-9 horizontal middle">
|
|
109
|
-
<NumberInput
|
|
110
|
-
value={command.targetTrackingConfiguration.scaleOutCooldown}
|
|
111
|
-
onChange={(e) =>
|
|
112
|
-
setCommandField('targetTrackingConfiguration.scaleOutCooldown', Number.parseInt(e.target.value))
|
|
113
|
-
}
|
|
114
|
-
inputClassName="sp-margin-xs-xaxis number-input-sm"
|
|
115
|
-
/>
|
|
116
|
-
<span className="input-label"> seconds </span>
|
|
117
|
-
</div>
|
|
118
|
-
</div>
|
|
119
|
-
)}
|
|
120
82
|
</div>
|
|
121
83
|
);
|
|
122
84
|
};
|
|
@@ -48,16 +48,16 @@ describe('ModifyScalingProcessesModal', () => {
|
|
|
48
48
|
});
|
|
49
49
|
|
|
50
50
|
it('submits the changed-state diff through the task monitor', () => {
|
|
51
|
-
const execute = spyOn(TaskExecutor, 'executeTask').
|
|
52
|
-
const application = { name: 'deck', serverGroups: { refresh:
|
|
51
|
+
const execute = vi.spyOn(TaskExecutor, 'executeTask').mockReturnValue(Promise.resolve({} as any));
|
|
52
|
+
const application = { name: 'deck', serverGroups: { refresh: vi.fn() } } as any;
|
|
53
53
|
const modal = new ModifyScalingProcessesModal({
|
|
54
54
|
application,
|
|
55
55
|
serverGroup: {
|
|
56
56
|
...serverGroup,
|
|
57
57
|
asg: { suspendedProcesses: [] },
|
|
58
58
|
},
|
|
59
|
-
closeModal:
|
|
60
|
-
dismissModal:
|
|
59
|
+
closeModal: vi.fn(),
|
|
60
|
+
dismissModal: vi.fn(),
|
|
61
61
|
} as any) as any;
|
|
62
62
|
modal.state.processes[0].enabled = false;
|
|
63
63
|
modal.state.reason = 'maintenance';
|
|
@@ -68,7 +68,7 @@ describe('ModifyScalingProcessesModal', () => {
|
|
|
68
68
|
expect(execute).toHaveBeenCalledWith({
|
|
69
69
|
application,
|
|
70
70
|
description: 'Update Auto Scaling Processes for deck-main-v001',
|
|
71
|
-
job: [
|
|
71
|
+
job: [expect.objectContaining({ action: 'suspend', processes: ['Launch'], reason: 'maintenance' })],
|
|
72
72
|
});
|
|
73
73
|
});
|
|
74
74
|
});
|
|
@@ -54,7 +54,7 @@ describe('EditScheduledActionsModal', () => {
|
|
|
54
54
|
});
|
|
55
55
|
|
|
56
56
|
it('projects cached scheduled actions onto editable fields at initialization', () => {
|
|
57
|
-
const application = { name: 'deck', serverGroups: { refresh:
|
|
57
|
+
const application = { name: 'deck', serverGroups: { refresh: vi.fn() } } as any;
|
|
58
58
|
const modal = new EditScheduledActionsModal({
|
|
59
59
|
application,
|
|
60
60
|
serverGroup: {
|
|
@@ -72,8 +72,8 @@ describe('EditScheduledActionsModal', () => {
|
|
|
72
72
|
},
|
|
73
73
|
],
|
|
74
74
|
},
|
|
75
|
-
closeModal:
|
|
76
|
-
dismissModal:
|
|
75
|
+
closeModal: vi.fn(),
|
|
76
|
+
dismissModal: vi.fn(),
|
|
77
77
|
} as any) as any;
|
|
78
78
|
|
|
79
79
|
expect(modal.state.scheduledActions).toEqual([
|
|
@@ -82,13 +82,13 @@ describe('EditScheduledActionsModal', () => {
|
|
|
82
82
|
});
|
|
83
83
|
|
|
84
84
|
it('adds, edits, removes, and submits capacity rows', () => {
|
|
85
|
-
const execute = spyOn(TaskExecutor, 'executeTask').
|
|
86
|
-
const application = { name: 'deck', serverGroups: { refresh:
|
|
85
|
+
const execute = vi.spyOn(TaskExecutor, 'executeTask').mockReturnValue(Promise.resolve({} as any));
|
|
86
|
+
const application = { name: 'deck', serverGroups: { refresh: vi.fn() } } as any;
|
|
87
87
|
const modal = new EditScheduledActionsModal({
|
|
88
88
|
application,
|
|
89
89
|
serverGroup: { ...serverGroup, scheduledActions: [{ recurrence: 'old', minSize: 1 }] },
|
|
90
|
-
closeModal:
|
|
91
|
-
dismissModal:
|
|
90
|
+
closeModal: vi.fn(),
|
|
91
|
+
dismissModal: vi.fn(),
|
|
92
92
|
} as any) as any;
|
|
93
93
|
modal.setState = (update: any) => {
|
|
94
94
|
const next = typeof update === 'function' ? update(modal.state) : update;
|
|
@@ -106,7 +106,7 @@ describe('EditScheduledActionsModal', () => {
|
|
|
106
106
|
application,
|
|
107
107
|
description: 'Update Scheduled Actions for deck-main-v001',
|
|
108
108
|
job: [
|
|
109
|
-
|
|
109
|
+
expect.objectContaining({
|
|
110
110
|
scheduledActions: [{ recurrence: '0 12 * * *', minSize: undefined, maxSize: undefined, desiredCapacity: 3 }],
|
|
111
111
|
}),
|
|
112
112
|
],
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { fireEvent, render, screen } from '@testing-library/react';
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import { hashLocationPlugin, servicesPlugin, UIRouterContext, UIRouterReact, UIViewContext } from '@uirouter/react';
|
|
2
4
|
import React from 'react';
|
|
3
5
|
|
|
4
6
|
import type { Application, ISecurityGroup } from '@spinnaker/core';
|
|
5
|
-
import { FirewallLabels } from '@spinnaker/core';
|
|
7
|
+
import { CollapsibleSectionStateCache, DeckRuntimeContext, FirewallLabels } from '@spinnaker/core';
|
|
6
8
|
|
|
7
9
|
import type { IAmazonServerGroupView } from '../../../domain';
|
|
8
10
|
import { AWSProviderSettings } from '../../../aws.settings';
|
|
@@ -16,6 +18,7 @@ import { ScheduledActionsDetailsSection } from './ScheduledActionsDetailsSection
|
|
|
16
18
|
import { SecurityGroupsDetailsSection } from './SecurityGroupsDetailsSection';
|
|
17
19
|
|
|
18
20
|
describe('Amazon server group maintenance action integration', () => {
|
|
21
|
+
let router: UIRouterReact;
|
|
19
22
|
const originalAdHocInfraWritesEnabled = AWSProviderSettings.adHocInfraWritesEnabled;
|
|
20
23
|
const runtimeServices = {} as any;
|
|
21
24
|
const editSecurityGroupsLabel = `Edit ${FirewallLabels.get('Firewalls')}`;
|
|
@@ -29,7 +32,7 @@ describe('Amazon server group maintenance action integration', () => {
|
|
|
29
32
|
const application = ({
|
|
30
33
|
name: 'test-app',
|
|
31
34
|
securityGroups: { data: [resolvedSecurityGroup] },
|
|
32
|
-
serverGroups: { refresh:
|
|
35
|
+
serverGroups: { refresh: vi.fn() },
|
|
33
36
|
} as any) as Application;
|
|
34
37
|
const serverGroup = {
|
|
35
38
|
account: 'test-account',
|
|
@@ -50,60 +53,77 @@ describe('Amazon server group maintenance action integration', () => {
|
|
|
50
53
|
vpcId: 'vpc-123',
|
|
51
54
|
} as IAmazonServerGroupView;
|
|
52
55
|
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
const renderSection = (section: React.ReactElement) =>
|
|
57
|
+
render(
|
|
58
|
+
<UIRouterContext.Provider value={router}>
|
|
59
|
+
<UIViewContext.Provider
|
|
60
|
+
value={{
|
|
61
|
+
fqn: 'application.serverGroup',
|
|
62
|
+
context: router.stateRegistry.get('application.serverGroup') as any,
|
|
63
|
+
}}
|
|
64
|
+
>
|
|
65
|
+
<DeckRuntimeContext.Provider value={{ services: runtimeServices } as any}>
|
|
66
|
+
{section}
|
|
67
|
+
</DeckRuntimeContext.Provider>
|
|
68
|
+
</UIViewContext.Provider>
|
|
69
|
+
</UIRouterContext.Provider>,
|
|
70
|
+
);
|
|
71
|
+
const expand = (heading: string) => fireEvent.click(screen.getByText(heading));
|
|
60
72
|
|
|
61
73
|
beforeEach(() => {
|
|
74
|
+
vi.spyOn(CollapsibleSectionStateCache, 'isSet').mockReturnValue(false);
|
|
62
75
|
AWSProviderSettings.adHocInfraWritesEnabled = true;
|
|
76
|
+
router = new UIRouterReact();
|
|
77
|
+
router.plugin(servicesPlugin);
|
|
78
|
+
router.plugin(hashLocationPlugin);
|
|
79
|
+
['application', 'application.serverGroup', 'application.firewallDetails'].forEach((name) =>
|
|
80
|
+
router.stateRegistry.register({ name, url: `/${name.split('.').pop()}` }),
|
|
81
|
+
);
|
|
63
82
|
});
|
|
64
83
|
|
|
65
84
|
afterEach(() => {
|
|
85
|
+
router.dispose();
|
|
66
86
|
AWSProviderSettings.adHocInfraWritesEnabled = originalAdHocInfraWritesEnabled;
|
|
67
87
|
});
|
|
68
88
|
|
|
69
|
-
it('opens Advanced Settings with the exact application and enriched server group', () => {
|
|
70
|
-
const show = spyOn(EditAsgAdvancedSettingsModal, 'show');
|
|
71
|
-
|
|
72
|
-
shallow(<AdvancedSettingsDetailsSection app={application} serverGroup={serverGroup} />),
|
|
73
|
-
);
|
|
89
|
+
it('opens Advanced Settings with the exact application and enriched server group', async () => {
|
|
90
|
+
const show = vi.spyOn(EditAsgAdvancedSettingsModal, 'show').mockReturnValue(undefined);
|
|
91
|
+
renderSection(<AdvancedSettingsDetailsSection app={application} serverGroup={serverGroup} />);
|
|
74
92
|
|
|
75
|
-
|
|
93
|
+
expand('Advanced Settings');
|
|
94
|
+
await userEvent.click(screen.getByText('Edit Advanced Settings'));
|
|
76
95
|
|
|
77
|
-
expect(show).
|
|
96
|
+
expect(show).toHaveBeenCalledExactlyOnceWith({ application, serverGroup }, runtimeServices);
|
|
78
97
|
});
|
|
79
98
|
|
|
80
|
-
it('opens Scaling Processes with the exact application and enriched server group', () => {
|
|
81
|
-
const show = spyOn(ModifyScalingProcessesModal, 'show');
|
|
82
|
-
|
|
99
|
+
it('opens Scaling Processes with the exact application and enriched server group', async () => {
|
|
100
|
+
const show = vi.spyOn(ModifyScalingProcessesModal, 'show').mockReturnValue(undefined);
|
|
101
|
+
renderSection(<ScalingProcessesDetailsSection app={application} serverGroup={serverGroup} />);
|
|
83
102
|
|
|
84
|
-
|
|
103
|
+
expand('Scaling Processes');
|
|
104
|
+
await userEvent.click(screen.getByText('Edit Scaling Processes'));
|
|
85
105
|
|
|
86
|
-
expect(show).
|
|
106
|
+
expect(show).toHaveBeenCalledExactlyOnceWith({ application, serverGroup });
|
|
87
107
|
});
|
|
88
108
|
|
|
89
|
-
it('opens Scheduled Actions with the exact application and enriched server group', () => {
|
|
90
|
-
const show = spyOn(EditScheduledActionsModal, 'show');
|
|
91
|
-
|
|
109
|
+
it('opens Scheduled Actions with the exact application and enriched server group', async () => {
|
|
110
|
+
const show = vi.spyOn(EditScheduledActionsModal, 'show').mockReturnValue(undefined);
|
|
111
|
+
renderSection(<ScheduledActionsDetailsSection app={application} serverGroup={serverGroup} />);
|
|
92
112
|
|
|
93
|
-
|
|
113
|
+
expand('Scheduled Actions');
|
|
114
|
+
await userEvent.click(screen.getByText('Edit Scheduled Actions'));
|
|
94
115
|
|
|
95
|
-
expect(show).
|
|
116
|
+
expect(show).toHaveBeenCalledExactlyOnceWith({ application, serverGroup });
|
|
96
117
|
});
|
|
97
118
|
|
|
98
|
-
it('opens Security Groups with resolved groups and exact application and enriched server group', () => {
|
|
99
|
-
const show = spyOn(EditSecurityGroupsModal, 'show');
|
|
100
|
-
|
|
101
|
-
shallow(<SecurityGroupsDetailsSection app={application} serverGroup={serverGroup} />),
|
|
102
|
-
);
|
|
119
|
+
it('opens Security Groups with resolved groups and exact application and enriched server group', async () => {
|
|
120
|
+
const show = vi.spyOn(EditSecurityGroupsModal, 'show').mockReturnValue(undefined);
|
|
121
|
+
renderSection(<SecurityGroupsDetailsSection app={application} serverGroup={serverGroup} />);
|
|
103
122
|
|
|
104
|
-
|
|
123
|
+
expand(FirewallLabels.get('Firewalls'));
|
|
124
|
+
await userEvent.click(screen.getByText(editSecurityGroupsLabel));
|
|
105
125
|
|
|
106
|
-
expect(show).
|
|
126
|
+
expect(show).toHaveBeenCalledExactlyOnceWith(
|
|
107
127
|
{ application, securityGroups: [resolvedSecurityGroup], serverGroup },
|
|
108
128
|
runtimeServices,
|
|
109
129
|
);
|
|
@@ -112,37 +132,28 @@ describe('Amazon server group maintenance action integration', () => {
|
|
|
112
132
|
it('hides all maintenance links when ad-hoc infrastructure writes are disabled', () => {
|
|
113
133
|
AWSProviderSettings.adHocInfraWritesEnabled = false;
|
|
114
134
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
).
|
|
127
|
-
expect(
|
|
128
|
-
|
|
129
|
-
shallow(<ScheduledActionsDetailsSection app={application} serverGroup={serverGroup} />),
|
|
130
|
-
'Edit Scheduled Actions',
|
|
131
|
-
).length,
|
|
132
|
-
).toBe(0);
|
|
133
|
-
expect(
|
|
134
|
-
editLink(
|
|
135
|
-
shallow(<SecurityGroupsDetailsSection app={application} serverGroup={serverGroup} />),
|
|
136
|
-
editSecurityGroupsLabel,
|
|
137
|
-
).length,
|
|
138
|
-
).toBe(0);
|
|
135
|
+
renderSection(
|
|
136
|
+
<>
|
|
137
|
+
<AdvancedSettingsDetailsSection app={application} serverGroup={serverGroup} />
|
|
138
|
+
<ScalingProcessesDetailsSection app={application} serverGroup={serverGroup} />
|
|
139
|
+
<ScheduledActionsDetailsSection app={application} serverGroup={serverGroup} />
|
|
140
|
+
<SecurityGroupsDetailsSection app={application} serverGroup={serverGroup} />
|
|
141
|
+
</>,
|
|
142
|
+
);
|
|
143
|
+
|
|
144
|
+
['Advanced Settings', 'Scaling Processes', 'Scheduled Actions', FirewallLabels.get('Firewalls')].forEach(expand);
|
|
145
|
+
expect(screen.queryByText('Edit Advanced Settings')).not.toBeInTheDocument();
|
|
146
|
+
expect(screen.queryByText('Edit Scaling Processes')).not.toBeInTheDocument();
|
|
147
|
+
expect(screen.queryByText('Edit Scheduled Actions')).not.toBeInTheDocument();
|
|
148
|
+
expect(screen.queryByText(editSecurityGroupsLabel)).not.toBeInTheDocument();
|
|
139
149
|
});
|
|
140
150
|
|
|
141
151
|
it('hides Security Groups editing when the server group has no VPC', () => {
|
|
142
|
-
|
|
152
|
+
renderSection(
|
|
143
153
|
<SecurityGroupsDetailsSection app={application} serverGroup={{ ...serverGroup, vpcId: undefined }} />,
|
|
144
154
|
);
|
|
145
155
|
|
|
146
|
-
|
|
156
|
+
expand(FirewallLabels.get('Firewalls'));
|
|
157
|
+
expect(screen.queryByText(editSecurityGroupsLabel)).not.toBeInTheDocument();
|
|
147
158
|
});
|
|
148
159
|
});
|