@spinnaker/amazon 2026.3.2 → 2026.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/common/AwsModalFooter.d.ts +1 -1
- package/dist/deploymentStrategy/AdditionalFields.d.ts +1 -1
- package/dist/function/CreateLambdaFunction.d.ts +1 -1
- package/dist/function/configure/ExecutionRole.d.ts +1 -1
- package/dist/function/configure/FunctionBasicInformation.d.ts +1 -1
- package/dist/function/configure/FunctionDebugAndErrorHandling.d.ts +1 -1
- package/dist/function/configure/FunctionEnvironmentVariables.d.ts +1 -1
- package/dist/function/configure/FunctionSettings.d.ts +1 -1
- package/dist/function/configure/FunctionTags.d.ts +1 -1
- package/dist/function/configure/Network.d.ts +1 -1
- package/dist/function/details/AmazonFunctionDetails.d.ts +1 -1
- package/dist/function/details/FunctionActions.d.ts +1 -1
- package/dist/index.js +279 -1
- package/dist/index.js.map +1 -1
- package/dist/instance/details/AmazonInstanceInformation.d.ts +2 -2
- package/dist/instance/details/CostFactor.d.ts +2 -2
- package/dist/instance/details/InstanceDns.d.ts +2 -2
- package/dist/instance/details/InstanceInformation.d.ts +2 -2
- package/dist/instance/details/InstanceSecurityGroups.d.ts +2 -2
- package/dist/instance/details/InstanceStatus.d.ts +2 -2
- package/dist/instance/details/InstanceTags.d.ts +2 -2
- package/dist/loadBalancer/configure/AmazonLoadBalancerChoiceModal.d.ts +1 -1
- package/dist/loadBalancer/configure/application/ALBListeners.d.ts +1 -1
- package/dist/loadBalancer/configure/application/ConfigureOidcConfigModal.d.ts +1 -1
- package/dist/loadBalancer/configure/application/ConfigureRedirectConfigModal.d.ts +1 -1
- package/dist/loadBalancer/configure/application/CreateApplicationLoadBalancer.d.ts +1 -1
- package/dist/loadBalancer/configure/application/TargetGroups.d.ts +1 -1
- package/dist/loadBalancer/configure/classic/AdvancedSettings.d.ts +1 -1
- package/dist/loadBalancer/configure/classic/HealthCheck.d.ts +1 -1
- package/dist/loadBalancer/configure/classic/Listeners.d.ts +1 -1
- package/dist/loadBalancer/configure/common/AmazonCertificateSelectField.d.ts +1 -1
- package/dist/loadBalancer/configure/common/LoadBalancerLocation.d.ts +1 -1
- package/dist/loadBalancer/configure/common/SecurityGroups.d.ts +1 -1
- package/dist/loadBalancer/configure/network/CertificateSelectors.d.ts +2 -2
- package/dist/loadBalancer/configure/network/NLBListeners.d.ts +1 -1
- package/dist/loadBalancer/configure/network/TargetGroups.d.ts +1 -1
- package/dist/loadBalancer/details/LoadBalancerActions.d.ts +1 -1
- package/dist/pipeline/stages/AmazonStageConfig.d.ts +2 -2
- package/dist/pipeline/stages/bake/AwsBakeStageConfig.d.ts +2 -2
- package/dist/pipeline/stages/cloneServerGroup/AwsCloneServerGroupStageConfig.d.ts +2 -2
- package/dist/pipeline/stages/deleteLambda/DeleteLambdaFunctionStageForm.d.ts +2 -2
- package/dist/pipeline/stages/deleteLambda/LambdaDeleteStage.d.ts +2 -2
- package/dist/pipeline/stages/deleteLambda/constants/deleteVersion.picker.d.ts +1 -1
- package/dist/pipeline/stages/deployCloudFormation/CloudFormationChangeSetInfo.d.ts +2 -2
- package/dist/pipeline/stages/deployCloudFormation/DeployCloudFormationStackStageConfig.d.ts +2 -2
- package/dist/pipeline/stages/deployCloudFormation/deployCloudFormationExecutionDetails.d.ts +1 -1
- package/dist/pipeline/stages/deployCloudFormation/evaluateCloudFormationChangeSetExecutionApproval.d.ts +2 -2
- package/dist/pipeline/stages/deployCloudFormation/evaluateCloudFormationChangeSetExecutionDetails.d.ts +1 -1
- package/dist/pipeline/stages/deployCloudFormation/evaluateCloudFormationChangeSetExecutionLabel.d.ts +1 -1
- package/dist/pipeline/stages/deployCloudFormation/evaluateCloudFormationChangeSetExecutionMarkerIcon.d.ts +1 -1
- package/dist/pipeline/stages/deployLambda/components/AwsLambdaFunctionStageForm.d.ts +2 -2
- package/dist/pipeline/stages/deployLambda/components/BasicSettingsForm.d.ts +2 -2
- package/dist/pipeline/stages/deployLambda/components/EnvironmentForm.d.ts +2 -2
- package/dist/pipeline/stages/deployLambda/components/ExecutionRoleForm.d.ts +2 -2
- package/dist/pipeline/stages/deployLambda/components/LambdaAtEdgeForm.d.ts +2 -2
- package/dist/pipeline/stages/deployLambda/components/NetworkForm.d.ts +2 -2
- package/dist/pipeline/stages/deployLambda/components/TriggerEventsForm.d.ts +2 -2
- package/dist/pipeline/stages/deployLambda/config/LambdaDeploymentStageConfig.d.ts +2 -2
- package/dist/pipeline/stages/deployLambda/config/LambdaDeploymentStageExecutionDetails.d.ts +2 -2
- package/dist/pipeline/stages/disableAsg/AwsDisableAsgStageConfig.d.ts +2 -2
- package/dist/pipeline/stages/disableCluster/AwsDisableClusterStageConfig.d.ts +2 -2
- package/dist/pipeline/stages/enableAsg/AwsEnableAsgStageConfig.d.ts +2 -2
- package/dist/pipeline/stages/findImageFromTags/AwsFindImageFromTagsStageConfig.d.ts +2 -2
- package/dist/pipeline/stages/invokeLambda/InvokeLambdaFunctionStageForm.d.ts +2 -2
- package/dist/pipeline/stages/invokeLambda/LambdaInvokeStage.d.ts +2 -2
- package/dist/pipeline/stages/invokeLambda/components/InvokeLambdaOperation.d.ts +2 -2
- package/dist/pipeline/stages/modifyScalingProcess/ModifyScalingProcessStageConfig.d.ts +2 -2
- package/dist/pipeline/stages/modifyWarmPool/ModifyWarmPoolStageConfig.d.ts +2 -2
- package/dist/pipeline/stages/resizeAsg/AwsResizeAsgStageConfig.d.ts +2 -2
- package/dist/pipeline/stages/rollbackCluster/AwsRollbackClusterStageConfig.d.ts +2 -2
- package/dist/pipeline/stages/routeLambda/LambdaRouteStage.d.ts +2 -2
- package/dist/pipeline/stages/routeLambda/RouteLambdaFunctionStageForm.d.ts +2 -2
- package/dist/pipeline/stages/routeLambda/TriggerEventsForm.d.ts +2 -2
- package/dist/pipeline/stages/routeLambda/components/BlueGreenDeployment/BlueGreenDeploymentForm.d.ts +2 -2
- package/dist/pipeline/stages/routeLambda/components/BlueGreenDeployment/HealthCheckStrategy.d.ts +2 -2
- package/dist/pipeline/stages/routeLambda/components/BlueGreenDeployment/InvocationHealthCheck.d.ts +2 -2
- package/dist/pipeline/stages/routeLambda/components/DeploymentStrategyForm.d.ts +2 -2
- package/dist/pipeline/stages/routeLambda/components/RenderStrategy.d.ts +2 -2
- package/dist/pipeline/stages/routeLambda/components/SimpleDeploymentForm.d.ts +2 -2
- package/dist/pipeline/stages/routeLambda/components/VersionPicker.d.ts +1 -1
- package/dist/pipeline/stages/routeLambda/components/WeightedDeploymentForm.d.ts +2 -2
- package/dist/pipeline/stages/routeLambda/constants/strategy.picker.d.ts +1 -1
- package/dist/pipeline/stages/scaleDownCluster/AwsScaleDownClusterStageConfig.d.ts +2 -2
- package/dist/pipeline/stages/shrinkCluster/AwsShrinkClusterStageConfig.d.ts +2 -2
- package/dist/pipeline/stages/tagImage/awsTagImageStage.d.ts +2 -2
- package/dist/pipeline/stages/updateCodeLambda/LambdaUpdateCodeStageConfig.d.ts +2 -2
- package/dist/pipeline/stages/updateCodeLambda/LambdaUpdateCodeStageExecutionDetails.d.ts +2 -2
- package/dist/pipeline/stages/updateCodeLambda/components/UpdateCodeStageForm.d.ts +2 -2
- package/dist/securityGroup/details/IPRangeRules.d.ts +1 -1
- package/dist/serverGroup/configure/AmazonImageSelectInput.d.ts +1 -1
- package/dist/serverGroup/configure/wizard/AmazonCloneServerGroupModal.d.ts +1 -1
- package/dist/serverGroup/configure/wizard/ServerGroupTemplateSelection.d.ts +1 -1
- package/dist/serverGroup/configure/wizard/capacity/CapacitySelector.d.ts +1 -1
- package/dist/serverGroup/configure/wizard/capacity/MinMaxDesired.d.ts +1 -1
- package/dist/serverGroup/configure/wizard/instanceType/CpuCreditsToggle.d.ts +2 -2
- package/dist/serverGroup/configure/wizard/instanceType/InstanceTypeSelector.d.ts +2 -2
- package/dist/serverGroup/configure/wizard/instanceType/InstanceTypeWarning.d.ts +2 -2
- package/dist/serverGroup/configure/wizard/instanceType/advancedMode/AdvancedModeSelector.d.ts +2 -2
- package/dist/serverGroup/configure/wizard/instanceType/advancedMode/AmazonInstanceTypeInfoRenderer.d.ts +2 -2
- package/dist/serverGroup/configure/wizard/instanceType/advancedMode/InstanceProfileSelector.d.ts +2 -2
- package/dist/serverGroup/configure/wizard/instanceType/advancedMode/InstanceTypeRow.d.ts +2 -2
- package/dist/serverGroup/configure/wizard/instanceType/advancedMode/InstanceTypeSelect.d.ts +2 -2
- package/dist/serverGroup/configure/wizard/instanceType/advancedMode/InstanceTypeTable.d.ts +2 -2
- package/dist/serverGroup/configure/wizard/instanceType/advancedMode/InstanceTypeTableBody.d.ts +2 -2
- package/dist/serverGroup/configure/wizard/instanceType/advancedMode/InstanceTypeTableParts.d.ts +4 -4
- package/dist/serverGroup/configure/wizard/instanceType/advancedMode/InstancesDistribution.d.ts +2 -2
- package/dist/serverGroup/configure/wizard/instanceType/simpleMode/SimpleModeSelector.d.ts +2 -2
- package/dist/serverGroup/configure/wizard/pages/ServerGroupBasicSettings.d.ts +1 -1
- package/dist/serverGroup/configure/wizard/pages/ServerGroupCapacity.d.ts +1 -1
- package/dist/serverGroup/configure/wizard/pages/ServerGroupInstanceType.d.ts +1 -1
- package/dist/serverGroup/configure/wizard/pages/ServerGroupLoadBalancers.d.ts +1 -1
- package/dist/serverGroup/configure/wizard/pages/ServerGroupSecurityGroups.d.ts +1 -1
- package/dist/serverGroup/configure/wizard/pages/ServerGroupZones.d.ts +1 -1
- package/dist/serverGroup/configure/wizard/pages/advancedSettings/ServerGroupAdvancedSettings.d.ts +1 -1
- package/dist/serverGroup/configure/wizard/pages/advancedSettings/ServerGroupAdvancedSettingsCommon.d.ts +1 -1
- package/dist/serverGroup/configure/wizard/pages/advancedSettings/ServerGroupAdvancedSettingsInner.d.ts +1 -1
- package/dist/serverGroup/configure/wizard/securityGroups/SecurityGroupSelector.d.ts +1 -1
- package/dist/serverGroup/configure/wizard/securityGroups/ServerGroupSecurityGroupsRemoved.d.ts +1 -1
- package/dist/serverGroup/details/advancedSettings/EditAsgAdvancedSettingsModal.d.ts +2 -1
- package/dist/serverGroup/details/resize/AmazonResizeServerGroupModal.d.ts +1 -1
- package/dist/serverGroup/details/scalingPolicy/CreateScalingPolicyButton.d.ts +1 -1
- package/dist/serverGroup/details/scalingPolicy/ScalingPolicySummary.d.ts +2 -2
- package/dist/serverGroup/details/scalingPolicy/StepPolicySummary.d.ts +2 -2
- package/dist/serverGroup/details/scalingPolicy/chart/DateLineChart.d.ts +2 -2
- package/dist/serverGroup/details/scalingPolicy/chart/MetricAlarmChart.d.ts +3 -3
- package/dist/serverGroup/details/scalingPolicy/popover/AlarmSummary.d.ts +2 -2
- package/dist/serverGroup/details/scalingPolicy/popover/StepPolicyPopoverContent.d.ts +2 -2
- package/dist/serverGroup/details/scalingPolicy/targetTracking/TargetMetricFields.d.ts +2 -2
- package/dist/serverGroup/details/scalingPolicy/targetTracking/TargetTrackingAdditionalSettings.d.ts +2 -3
- package/dist/serverGroup/details/scalingPolicy/targetTracking/TargetTrackingChart.d.ts +2 -2
- package/dist/serverGroup/details/scalingPolicy/targetTracking/TargetTrackingSummary.d.ts +2 -2
- package/dist/serverGroup/details/scalingPolicy/targetTracking/UpsertTargetTrackingModal.d.ts +2 -2
- package/dist/serverGroup/details/scalingPolicy/upsert/PolicyTypeSelectionModal.d.ts +2 -2
- package/dist/serverGroup/details/scalingPolicy/upsert/ScalingPolicyAdditionalSettings.d.ts +2 -2
- package/dist/serverGroup/details/scalingPolicy/upsert/UpsertScalingPolicyModal.d.ts +2 -2
- package/dist/serverGroup/details/scalingPolicy/upsert/alarm/AlarmConfigurer.d.ts +2 -2
- package/dist/serverGroup/details/scalingPolicy/upsert/alarm/DimensionsEditor.d.ts +2 -2
- package/dist/serverGroup/details/scalingPolicy/upsert/alarm/MetricSelector.d.ts +2 -2
- package/dist/serverGroup/details/scalingPolicy/upsert/simple/SimplePolicyAction.d.ts +2 -2
- package/dist/serverGroup/details/scalingPolicy/upsert/step/StepPolicyAction.d.ts +2 -2
- package/dist/serverGroup/details/scalingProcesses/ModifyScalingProcessesModal.d.ts +1 -1
- package/dist/serverGroup/details/scheduledAction/ScheduledAction.d.ts +1 -1
- package/dist/serverGroup/details/scheduledActions/EditScheduledActionsModal.d.ts +1 -1
- package/dist/serverGroup/details/sections/InstancesDistributionDetailsSection.d.ts +2 -2
- package/dist/serverGroup/details/sections/LaunchTemplateDetailsSection.d.ts +2 -2
- package/dist/serverGroup/details/sections/MultipleInstanceTypesSubSection.d.ts +2 -2
- package/dist/serverGroup/details/securityGroups/EditSecurityGroupsModal.d.ts +1 -1
- package/dist/serverGroup/details/warmPool/ModifyWarmPoolModal.d.ts +1 -1
- package/dist/subnet/SubnetSelectField.d.ts +1 -1
- package/dist/subnet/SubnetSelectInput.d.ts +1 -1
- package/dist/vpc/VpcTag.d.ts +2 -2
- package/package.json +5 -7
- package/src/aws.module.spec.ts +20 -21
- package/src/function/details/AmazonFunctionDetails.tsx +1 -1
- package/src/function/details/FunctionActions.spec.tsx +56 -36
- package/src/instance/awsInstanceType.service.spec.js +24 -22
- package/src/instance/details/AmazonInstanceDetails.spec.tsx +7 -7
- package/src/instance/details/InstanceInformation.spec.tsx +44 -24
- package/src/loadBalancer/AmazonLoadBalancersTag.spec.tsx +1 -1
- package/src/loadBalancer/TargetGroupDetails.spec.tsx +5 -5
- package/src/loadBalancer/configure/application/TargetGroups.tsx +1 -1
- package/src/loadBalancer/configure/common/SecurityGroups.spec.tsx +4 -4
- package/src/loadBalancer/configure/network/TargetGroups.tsx +1 -1
- package/src/loadBalancer/details/amazonLoadBalancerDetails.spec.tsx +31 -53
- package/src/pipeline/stages/AmazonStageConfig.spec.tsx +37 -46
- package/src/pipeline/stages/deployCloudFormation/DeployCloudFormationStackStageConfig.tsx +1 -0
- package/src/pipeline/stages/deployCloudFormation/deployCloudFormationStackStage.spec.tsx +316 -279
- package/src/pipeline/stages/findImageFromTags/AwsFindImageFromTagsStageConfig.spec.tsx +70 -90
- package/src/pipeline/stages/modifyScalingProcess/modifyScalingProcessStage.spec.tsx +198 -130
- package/src/pipeline/stages/modifyWarmPool/modifyWarmPoolStage.spec.tsx +49 -40
- package/src/pipeline/stages/resizeAsg/AwsResizeAsgStageConfig.spec.tsx +341 -427
- package/src/pipeline/stages/resizeAsg/AwsResizeAsgStageConfig.tsx +7 -0
- package/src/pipeline/stages/tagImage/awsTagImageStage.spec.tsx +62 -107
- package/src/routerConsumers.spec.tsx +23 -23
- package/src/securityGroup/configure/AmazonSecurityGroupModal.spec.tsx +38 -47
- package/src/securityGroup/details/AmazonSecurityGroupDetails.spec.tsx +7 -6
- package/src/serverGroup/configure/AmazonImageSelectInput.spec.tsx +47 -65
- package/src/serverGroup/configure/AmazonImageSelectInput.tsx +1 -1
- package/src/serverGroup/configure/serverGroupCommandBuilder.aws.service.spec.js +18 -19
- package/src/serverGroup/configure/serverGroupCommandBuilder.spec.js +41 -26
- package/src/serverGroup/configure/wizard/instanceType/simpleMode/SimpleModeSelector.spec.tsx +52 -75
- package/src/serverGroup/configure/wizard/pages/ServerGroupBasicSettings.spec.tsx +1 -1
- package/src/serverGroup/configure/wizard/pages/advancedSettings/ServerGroupAdvancedSettingsCommon.spec.tsx +36 -33
- package/src/serverGroup/configure/wizard/pages/advancedSettings/ServerGroupAdvancedSettingsCommon.tsx +7 -1
- package/src/serverGroup/configure/wizard/securityGroups/SecurityGroupSelector.spec.tsx +2 -2
- package/src/serverGroup/details/AmazonServerGroupActions.spec.tsx +79 -67
- package/src/serverGroup/details/advancedSettings/EditAsgAdvancedSettingsModal.spec.tsx +78 -66
- package/src/serverGroup/details/advancedSettings/EditAsgAdvancedSettingsModal.tsx +23 -6
- package/src/serverGroup/details/rollback/AmazonRollbackServerGroupModal.spec.tsx +86 -94
- package/src/serverGroup/details/rollback/AmazonRollbackServerGroupModal.tsx +3 -0
- package/src/serverGroup/details/scalingPolicy/targetTracking/TargetTrackingAdditionalSettings.tsx +1 -39
- package/src/serverGroup/details/scalingPolicy/targetTracking/UpsertTargetTrackingModal.tsx +0 -1
- package/src/serverGroup/details/scalingProcesses/ModifyScalingProcessesModal.spec.tsx +5 -5
- package/src/serverGroup/details/scheduledActions/EditScheduledActionsModal.spec.tsx +8 -8
- package/src/serverGroup/details/sections/AmazonServerGroupMaintenanceActions.spec.tsx +71 -60
- package/src/serverGroup/details/sections/InstancesDistributionDetailsSection.spec.tsx +21 -39
- package/src/serverGroup/details/sections/LaunchTemplateDetailsSection.spec.tsx +56 -97
- package/src/serverGroup/details/securityGroups/EditSecurityGroupsModal.spec.tsx +48 -77
- package/src/serverGroup/details/warmPool/ModifyWarmPoolModal.spec.tsx +5 -5
- package/src/vpc/VpcReader.spec.ts +1 -1
- package/src/vpc/VpcTag.spec.tsx +11 -15
- /package/dist/{amazon.logo352d4e042476837f.svg → amazon.logoBzC5E-3F.svg} +0 -0
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { fireEvent, render, screen } from '@testing-library/react';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
|
|
4
4
|
import type { Application } from '@spinnaker/core';
|
|
5
|
+
import { CollapsibleSectionStateCache } from '@spinnaker/core';
|
|
5
6
|
import { mockLaunchTemplate, mockServerGroup } from '@spinnaker/mocks';
|
|
6
7
|
|
|
7
8
|
import type { IAmazonMixedInstancesPolicy, IAmazonServerGroupView, IScalingPolicy } from '../../../domain';
|
|
@@ -9,6 +10,10 @@ import { InstancesDistributionDetailsSection } from '../../../index';
|
|
|
9
10
|
|
|
10
11
|
describe('InstancesDistribution', () => {
|
|
11
12
|
const app = {} as Application;
|
|
13
|
+
const expectValue = (label: string, value: string) => {
|
|
14
|
+
const term = screen.getByText(label, { selector: 'dt' });
|
|
15
|
+
expect(term.nextElementSibling).toHaveTextContent(value);
|
|
16
|
+
};
|
|
12
17
|
|
|
13
18
|
const serverGroupWithMip = {
|
|
14
19
|
...mockServerGroup,
|
|
@@ -25,34 +30,25 @@ describe('InstancesDistribution', () => {
|
|
|
25
30
|
scalingPolicies: [] as IScalingPolicy[],
|
|
26
31
|
} as IAmazonServerGroupView;
|
|
27
32
|
|
|
33
|
+
beforeEach(() => vi.spyOn(CollapsibleSectionStateCache, 'isSet').mockReturnValue(false));
|
|
34
|
+
|
|
28
35
|
it('should NOT render for server group without mixed instances policy ', () => {
|
|
29
36
|
const serverGroupWithLt = {
|
|
30
37
|
...mockServerGroup,
|
|
31
38
|
launchTemplate: mockLaunchTemplate,
|
|
32
39
|
} as IAmazonServerGroupView;
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
expect(wrapper.isEmptyRender()).toEqual(true);
|
|
40
|
+
const { container } = render(<InstancesDistributionDetailsSection serverGroup={serverGroupWithLt} app={app} />);
|
|
41
|
+
expect(container).toBeEmptyDOMElement();
|
|
36
42
|
});
|
|
37
43
|
|
|
38
44
|
it('should render for server group with mixed instances policy', () => {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
['On-Demand Base Capacity', 1],
|
|
47
|
-
['On-Demand Percentage Above Base Capacity', 50],
|
|
48
|
-
['Spot Allocation Strategy', 'capacity-optimized'],
|
|
49
|
-
]);
|
|
50
|
-
let index = 0;
|
|
51
|
-
expectedLabels.forEach((value, key) => {
|
|
52
|
-
const labeledValue = actualLabeledValues.at(index++);
|
|
53
|
-
expect(labeledValue.prop('label')).toEqual(key);
|
|
54
|
-
expect(labeledValue.prop('value')).toEqual(value);
|
|
55
|
-
});
|
|
45
|
+
render(<InstancesDistributionDetailsSection serverGroup={serverGroupWithMip} app={app} />);
|
|
46
|
+
fireEvent.click(screen.getByText('Instances Distribution'));
|
|
47
|
+
expectValue('On-Demand Allocation Strategy', 'prioritized');
|
|
48
|
+
expectValue('On-Demand Base Capacity', '1');
|
|
49
|
+
expectValue('On-Demand Percentage Above Base Capacity', '50');
|
|
50
|
+
expectValue('Spot Allocation Strategy', 'capacity-optimized');
|
|
51
|
+
expectValue('Max Spot Price', '1.5');
|
|
56
52
|
});
|
|
57
53
|
|
|
58
54
|
it('should render for spotInstancePools conditionally', () => {
|
|
@@ -62,23 +58,9 @@ describe('InstancesDistribution', () => {
|
|
|
62
58
|
newServerGroup.mixedInstancesPolicy.instancesDistribution.spotAllocationStrategy = 'lowest-price';
|
|
63
59
|
newServerGroup.mixedInstancesPolicy.instancesDistribution.spotInstancePools = 5;
|
|
64
60
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
expect(actualLabeledValues.length).toEqual(6);
|
|
70
|
-
const expectedLabels = new Map<string, any>([
|
|
71
|
-
['On-Demand Allocation Strategy', 'prioritized'],
|
|
72
|
-
['On-Demand Base Capacity', 1],
|
|
73
|
-
['On-Demand Percentage Above Base Capacity', 50],
|
|
74
|
-
['Spot Allocation Strategy', 'lowest-price'],
|
|
75
|
-
['Spot Instance Pools', 5],
|
|
76
|
-
]);
|
|
77
|
-
let index = 0;
|
|
78
|
-
expectedLabels.forEach((value, key) => {
|
|
79
|
-
const labeledValue = actualLabeledValues.at(index++);
|
|
80
|
-
expect(labeledValue.prop('label')).toEqual(key);
|
|
81
|
-
expect(labeledValue.prop('value')).toEqual(value);
|
|
82
|
-
});
|
|
61
|
+
render(<InstancesDistributionDetailsSection serverGroup={newServerGroup} app={app} />);
|
|
62
|
+
fireEvent.click(screen.getByText('Instances Distribution'));
|
|
63
|
+
expectValue('Spot Allocation Strategy', 'lowest-price');
|
|
64
|
+
expectValue('Spot Instance Pools', '5');
|
|
83
65
|
});
|
|
84
66
|
});
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { fireEvent, render, screen } from '@testing-library/react';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
|
|
4
4
|
import type { Application } from '@spinnaker/core';
|
|
5
|
+
import { CollapsibleSectionStateCache } from '@spinnaker/core';
|
|
5
6
|
import {
|
|
6
7
|
createCustomMockLaunchTemplate,
|
|
7
8
|
mockLaunchTemplate,
|
|
@@ -15,6 +16,11 @@ import type { IAmazonMixedInstancesPolicy, IAmazonServerGroupView, IScalingPolic
|
|
|
15
16
|
|
|
16
17
|
describe('Launch template details', () => {
|
|
17
18
|
const app = {} as Application;
|
|
19
|
+
const expectValue = (label: string, value: string) => {
|
|
20
|
+
const term = screen.getByText(label, { selector: 'dt' });
|
|
21
|
+
expect(term.nextElementSibling).toHaveTextContent(value);
|
|
22
|
+
};
|
|
23
|
+
const expand = () => fireEvent.click(screen.getByText('Launch Template'));
|
|
18
24
|
|
|
19
25
|
const baseServerGroupWithLt = {
|
|
20
26
|
...mockServerGroup,
|
|
@@ -22,6 +28,7 @@ describe('Launch template details', () => {
|
|
|
22
28
|
...mockLaunchTemplateData,
|
|
23
29
|
kernelId: 'kernal-abc',
|
|
24
30
|
ramDiskId: 'ramDisk-123',
|
|
31
|
+
userData: btoa('test user data'),
|
|
25
32
|
instanceMarketOptions: {
|
|
26
33
|
spotOptions: {
|
|
27
34
|
maxPrice: '0.50',
|
|
@@ -56,7 +63,7 @@ describe('Launch template details', () => {
|
|
|
56
63
|
createdBy: 'testuser@test.com',
|
|
57
64
|
createdTime: 1588787656527,
|
|
58
65
|
defaultVersion: true,
|
|
59
|
-
launchTemplateData: mockLaunchTemplateData,
|
|
66
|
+
launchTemplateData: { ...mockLaunchTemplateData, userData: btoa('test user data') },
|
|
60
67
|
launchTemplateId: '123456',
|
|
61
68
|
launchTemplateName: 'testLaunchTemplatev001',
|
|
62
69
|
versionDescription: 'Test purposes',
|
|
@@ -76,26 +83,26 @@ describe('Launch template details', () => {
|
|
|
76
83
|
} as IAmazonMixedInstancesPolicy,
|
|
77
84
|
} as IAmazonServerGroupView;
|
|
78
85
|
|
|
86
|
+
beforeEach(() => vi.spyOn(CollapsibleSectionStateCache, 'isSet').mockReturnValue(false));
|
|
87
|
+
|
|
79
88
|
it('should not render if no launch template', () => {
|
|
80
89
|
const testServerGroup = {
|
|
81
90
|
...mockServerGroup,
|
|
82
91
|
scalingPolicies: [] as IScalingPolicy[],
|
|
83
92
|
} as IAmazonServerGroupView;
|
|
84
93
|
|
|
85
|
-
const
|
|
86
|
-
expect(
|
|
94
|
+
const { container } = render(<LaunchTemplateDetailsSection serverGroup={testServerGroup} app={app} />);
|
|
95
|
+
expect(container).toBeEmptyDOMElement();
|
|
87
96
|
});
|
|
88
97
|
|
|
89
98
|
it('should render base info', () => {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
expect(labeledValues.at(5).prop('value')).toEqual('testapplicationInstanceProfile');
|
|
98
|
-
expect(labeledValues.at(6).prop('value')).toEqual('disabled');
|
|
99
|
+
render(<LaunchTemplateDetailsSection serverGroup={baseServerGroupWithLt} app={app} />);
|
|
100
|
+
expand();
|
|
101
|
+
expectValue('Name', 'test123');
|
|
102
|
+
expectValue('Image ID', 'ami-0123456789');
|
|
103
|
+
expectValue('Instance Type', 'm5.large');
|
|
104
|
+
expectValue('IAM Profile', 'testapplicationInstanceProfile');
|
|
105
|
+
expectValue('Instance Monitoring', 'disabled');
|
|
99
106
|
});
|
|
100
107
|
|
|
101
108
|
it('should render launch template details for server group with launchTemplate', () => {
|
|
@@ -114,7 +121,7 @@ describe('Launch template details', () => {
|
|
|
114
121
|
keyName: 'test',
|
|
115
122
|
kernelId: 'kernal-abc',
|
|
116
123
|
ramDiskId: 'ramDisk-123',
|
|
117
|
-
userData: '
|
|
124
|
+
userData: btoa('test user data'),
|
|
118
125
|
}),
|
|
119
126
|
image: {
|
|
120
127
|
description: 'ancestor_name=testBaseImage',
|
|
@@ -122,10 +129,6 @@ describe('Launch template details', () => {
|
|
|
122
129
|
},
|
|
123
130
|
} as IAmazonServerGroupView;
|
|
124
131
|
|
|
125
|
-
const wrapper = shallow(<LaunchTemplateDetailsSection serverGroup={testServerGroup} app={app} />);
|
|
126
|
-
const actualLabeledValues = wrapper.find('LabeledValue');
|
|
127
|
-
|
|
128
|
-
expect(actualLabeledValues.length).toEqual(13);
|
|
129
132
|
const expectedLabels = new Map([
|
|
130
133
|
['Name', 'ltWithCredits'],
|
|
131
134
|
['Image ID', 'ami-0123456789'],
|
|
@@ -141,77 +144,51 @@ describe('Launch template details', () => {
|
|
|
141
144
|
['Ramdisk ID', 'ramDisk-123'],
|
|
142
145
|
['User Data', ''],
|
|
143
146
|
]);
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
value != '' && expect(labeledValue.prop('value')).toEqual(value);
|
|
149
|
-
});
|
|
147
|
+
render(<LaunchTemplateDetailsSection serverGroup={testServerGroup} app={app} />);
|
|
148
|
+
expand();
|
|
149
|
+
expectedLabels.forEach((value, key) => value && expectValue(key, value));
|
|
150
|
+
expect(screen.getByText('User Data', { selector: 'dt' })).toBeInTheDocument();
|
|
150
151
|
});
|
|
151
152
|
|
|
152
153
|
it('should conditionally render launch template details for server group with mixedInstancesPolicy', () => {
|
|
153
154
|
const testServerGroup = baseServerGroupWithMipOverrides;
|
|
154
155
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
expect(
|
|
165
|
-
expect(
|
|
166
|
-
expect(
|
|
167
|
-
expect(
|
|
168
|
-
|
|
169
|
-
const multipleInstanceTypes = shallow(
|
|
170
|
-
<MultipleInstanceTypesSubSection
|
|
171
|
-
instanceTypeOverrides={testServerGroup.mixedInstancesPolicy.launchTemplateOverridesForInstanceType}
|
|
172
|
-
/>,
|
|
173
|
-
);
|
|
174
|
-
expect(multipleInstanceTypes.isEmptyRender()).toEqual(false);
|
|
175
|
-
const multipleInstanceTypesTableRows = multipleInstanceTypes.find('td');
|
|
176
|
-
|
|
177
|
-
expect(multipleInstanceTypesTableRows.length).toEqual(4);
|
|
178
|
-
expect(multipleInstanceTypesTableRows.at(0).text()).toEqual('some.type.medium');
|
|
179
|
-
expect(multipleInstanceTypesTableRows.at(1).text()).toEqual('2');
|
|
180
|
-
expect(multipleInstanceTypesTableRows.at(2).text()).toEqual('some.type.large');
|
|
181
|
-
expect(multipleInstanceTypesTableRows.at(3).text()).toEqual('4');
|
|
156
|
+
render(<LaunchTemplateDetailsSection serverGroup={testServerGroup} app={app} />);
|
|
157
|
+
expand();
|
|
158
|
+
expectValue('Name', 'testLaunchTemplatev001');
|
|
159
|
+
expectValue('Image ID', 'ami-0123456789');
|
|
160
|
+
expectValue('Image Name', 'location');
|
|
161
|
+
expectValue('Base Image Name', 'testBaseImage');
|
|
162
|
+
expectValue('IAM Profile', 'testapplicationInstanceProfile');
|
|
163
|
+
expectValue('Instance Monitoring', 'disabled');
|
|
164
|
+
expectValue('Max Spot Price', '1.5');
|
|
165
|
+
expect(screen.getByRole('cell', { name: 'some.type.medium' })).toBeInTheDocument();
|
|
166
|
+
expect(screen.getByRole('cell', { name: '2' })).toBeInTheDocument();
|
|
167
|
+
expect(screen.getByRole('cell', { name: 'some.type.large' })).toBeInTheDocument();
|
|
168
|
+
expect(screen.getByRole('cell', { name: '4' })).toBeInTheDocument();
|
|
182
169
|
});
|
|
183
170
|
|
|
184
171
|
it('should conditionally render image information', () => {
|
|
185
|
-
const
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
expect(
|
|
189
|
-
expect(labeledValues.at(3).prop('label')).toEqual('Base Image Name');
|
|
172
|
+
const { rerender } = render(<LaunchTemplateDetailsSection serverGroup={baseServerGroupWithLt} app={app} />);
|
|
173
|
+
expand();
|
|
174
|
+
expect(screen.getByText('Image Name', { selector: 'dt' })).toBeInTheDocument();
|
|
175
|
+
expect(screen.getByText('Base Image Name', { selector: 'dt' })).toBeInTheDocument();
|
|
190
176
|
|
|
191
177
|
const newServerGroup = {
|
|
192
178
|
...baseServerGroupWithLt,
|
|
193
179
|
};
|
|
194
180
|
delete newServerGroup.image;
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
});
|
|
198
|
-
|
|
199
|
-
const imageName = wrapper.findWhere((lv) => lv.prop('label') === 'Image Name');
|
|
200
|
-
const baseImage = wrapper.findWhere((lv) => lv.prop('label') === 'Base Image Name');
|
|
201
|
-
|
|
202
|
-
expect(imageName.length).toEqual(0);
|
|
203
|
-
expect(baseImage.length).toEqual(0);
|
|
181
|
+
rerender(<LaunchTemplateDetailsSection serverGroup={newServerGroup} app={app} />);
|
|
182
|
+
expect(screen.queryByText('Image Name', { selector: 'dt' })).not.toBeInTheDocument();
|
|
183
|
+
expect(screen.queryByText('Base Image Name', { selector: 'dt' })).not.toBeInTheDocument();
|
|
204
184
|
});
|
|
205
185
|
|
|
206
186
|
it('should conditionally render additional info', () => {
|
|
207
|
-
const
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
expect(labeledValues.at(9).prop('label')).toEqual('Kernel ID');
|
|
213
|
-
expect(labeledValues.at(10).prop('label')).toEqual('Ramdisk ID');
|
|
214
|
-
expect(labeledValues.at(11).prop('label')).toEqual('User Data');
|
|
187
|
+
const { rerender } = render(<LaunchTemplateDetailsSection serverGroup={baseServerGroupWithLt} app={app} />);
|
|
188
|
+
expand();
|
|
189
|
+
['Max Spot Price', 'Key Name', 'Kernel ID', 'Ramdisk ID', 'User Data'].forEach((label) =>
|
|
190
|
+
expect(screen.getByText(label, { selector: 'dt' })).toBeInTheDocument(),
|
|
191
|
+
);
|
|
215
192
|
|
|
216
193
|
const newServerGroup = {
|
|
217
194
|
...baseServerGroupWithLt,
|
|
@@ -220,32 +197,14 @@ describe('Launch template details', () => {
|
|
|
220
197
|
delete newServerGroup.launchTemplate.launchTemplateData.userData;
|
|
221
198
|
delete newServerGroup.launchTemplate.launchTemplateData.keyName;
|
|
222
199
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
const spotPrice = wrapper.findWhere((lv) => lv.prop('label') === 'Max Spot Price');
|
|
228
|
-
const keyName = wrapper.findWhere((lv) => lv.prop('label') === 'Key Name');
|
|
229
|
-
const kernelId = wrapper.findWhere((lv) => lv.prop('label') === 'Kernel ID');
|
|
230
|
-
const ramdiskId = wrapper.findWhere((lv) => lv.prop('label') === 'Ramdisk ID');
|
|
231
|
-
const userData = wrapper.findWhere((lv) => lv.prop('label') === 'User Data');
|
|
232
|
-
|
|
233
|
-
expect(spotPrice.length).toEqual(0);
|
|
234
|
-
expect(keyName.length).toEqual(0);
|
|
235
|
-
expect(ramdiskId.length).toEqual(0);
|
|
236
|
-
expect(kernelId.length).toEqual(0);
|
|
237
|
-
expect(userData.length).toEqual(0);
|
|
200
|
+
rerender(<LaunchTemplateDetailsSection serverGroup={newServerGroup} app={app} />);
|
|
201
|
+
['Max Spot Price', 'Key Name', 'Kernel ID', 'Ramdisk ID', 'User Data'].forEach((label) =>
|
|
202
|
+
expect(screen.queryByText(label, { selector: 'dt' })).not.toBeInTheDocument(),
|
|
203
|
+
);
|
|
238
204
|
});
|
|
239
205
|
|
|
240
206
|
it('should not render multiple instance types subsection when overrides are not specified', () => {
|
|
241
|
-
const
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
const multipleInstanceTypes = shallow(
|
|
245
|
-
<MultipleInstanceTypesSubSection
|
|
246
|
-
instanceTypeOverrides={testServerGroup.mixedInstancesPolicy.launchTemplateOverridesForInstanceType}
|
|
247
|
-
/>,
|
|
248
|
-
);
|
|
249
|
-
expect(multipleInstanceTypes.isEmptyRender()).toEqual(true);
|
|
207
|
+
const { container } = render(<MultipleInstanceTypesSubSection instanceTypeOverrides={null} />);
|
|
208
|
+
expect(container).toBeEmptyDOMElement();
|
|
250
209
|
});
|
|
251
210
|
});
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { act, fireEvent, screen, waitFor } from '@testing-library/react';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import Select from 'react-select';
|
|
4
3
|
import { of } from 'rxjs';
|
|
5
4
|
|
|
6
5
|
import { AccountService, DeckRuntimeContext } from '@spinnaker/core';
|
|
7
|
-
|
|
8
|
-
import { AwsModalFooter } from '../../../common/AwsModalFooter';
|
|
6
|
+
import { renderWithRouter } from '../../../../../core/src/utils/testUtils/rtl';
|
|
9
7
|
|
|
10
8
|
import {
|
|
11
9
|
EditSecurityGroupsModal,
|
|
@@ -16,11 +14,10 @@ import {
|
|
|
16
14
|
describe('EditSecurityGroupsModal', () => {
|
|
17
15
|
let originalAccounts: typeof AccountService.accounts$;
|
|
18
16
|
let runtimeServices: any;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
);
|
|
22
|
-
const
|
|
23
|
-
enzymeMount(<EditSecurityGroupsModal {...props} />, { wrappingComponent: RuntimeWrapper });
|
|
17
|
+
|
|
18
|
+
const serverGroup = { name: 'deck-main-v001', account: 'test', region: 'us-east-1', vpcId: 'vpc-1' } as any;
|
|
19
|
+
const application = { name: 'deck', serverGroups: { refresh: vi.fn() } } as any;
|
|
20
|
+
const modalProps = { application, serverGroup, closeModal: vi.fn(), dismissModal: vi.fn() };
|
|
24
21
|
|
|
25
22
|
beforeEach(() => {
|
|
26
23
|
originalAccounts = AccountService.accounts$;
|
|
@@ -32,24 +29,12 @@ describe('EditSecurityGroupsModal', () => {
|
|
|
32
29
|
AccountService.accounts$ = originalAccounts;
|
|
33
30
|
});
|
|
34
31
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const application = { name: 'deck', serverGroups: { refresh: jasmine.createSpy('refresh') } } as any;
|
|
43
|
-
const modalProps = {
|
|
44
|
-
application,
|
|
45
|
-
serverGroup,
|
|
46
|
-
closeModal: jasmine.createSpy('closeModal'),
|
|
47
|
-
dismissModal: jasmine.createSpy('dismissModal'),
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
async function flush(): Promise<void> {
|
|
51
|
-
await Promise.resolve();
|
|
52
|
-
await Promise.resolve();
|
|
32
|
+
function renderModal(props: any) {
|
|
33
|
+
return renderWithRouter(
|
|
34
|
+
<DeckRuntimeContext.Provider value={{ services: runtimeServices } as any}>
|
|
35
|
+
<EditSecurityGroupsModal {...props} />
|
|
36
|
+
</DeckRuntimeContext.Provider>,
|
|
37
|
+
);
|
|
53
38
|
}
|
|
54
39
|
|
|
55
40
|
it('filters by account, region, and VPC while preserving unresolved attached groups', () => {
|
|
@@ -89,70 +74,56 @@ describe('EditSecurityGroupsModal', () => {
|
|
|
89
74
|
const allGroups = {
|
|
90
75
|
test: { aws: { 'us-east-1': [{ id: 'sg-available', name: 'available', vpcId: 'vpc-1' }] } },
|
|
91
76
|
};
|
|
92
|
-
const getAllSecurityGroups =
|
|
93
|
-
.
|
|
94
|
-
.
|
|
77
|
+
const getAllSecurityGroups = vi
|
|
78
|
+
.fn()
|
|
79
|
+
.mockRejectedValueOnce(new Error('inventory unavailable'))
|
|
80
|
+
.mockResolvedValueOnce(allGroups);
|
|
95
81
|
runtimeServices.securityGroupReader = { getAllSecurityGroups };
|
|
96
|
-
|
|
97
|
-
await flush();
|
|
98
|
-
wrapper.update();
|
|
82
|
+
renderModal({ ...modalProps, securityGroups: selected });
|
|
99
83
|
|
|
100
|
-
expect(
|
|
101
|
-
expect(
|
|
102
|
-
expect(
|
|
103
|
-
expect(wrapper.state('securityGroups')).toEqual(selected);
|
|
84
|
+
expect(await screen.findByRole('alert')).toHaveTextContent('Unable to load');
|
|
85
|
+
expect(screen.getByText('attached')).toBeInTheDocument();
|
|
86
|
+
expect(screen.getByRole('button', { name: 'Submit' })).toBeDisabled();
|
|
104
87
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
await flush();
|
|
108
|
-
wrapper.update();
|
|
88
|
+
fireEvent.click(screen.getByRole('button', { name: 'Retry' }));
|
|
89
|
+
await waitFor(() => expect(screen.queryByRole('alert')).not.toBeInTheDocument());
|
|
109
90
|
|
|
110
91
|
expect(getAllSecurityGroups).toHaveBeenCalledTimes(2);
|
|
111
|
-
expect(
|
|
112
|
-
expect(
|
|
113
|
-
|
|
114
|
-
expect(
|
|
115
|
-
'sg-attached',
|
|
116
|
-
'sg-available',
|
|
117
|
-
]);
|
|
92
|
+
expect(screen.getByText('attached')).toBeInTheDocument();
|
|
93
|
+
expect(screen.getByRole('button', { name: 'Submit' })).toBeEnabled();
|
|
94
|
+
fireEvent.keyDown(screen.getByRole('combobox'), { key: 'ArrowDown', keyCode: 40 });
|
|
95
|
+
expect(screen.getByText('available (sg-available)')).toBeInTheDocument();
|
|
118
96
|
});
|
|
119
97
|
|
|
120
98
|
it('does not update state when security-group loading completes after unmount', async () => {
|
|
121
99
|
let finishLoading: (groups: any) => void;
|
|
122
|
-
|
|
123
|
-
new Promise((resolve) =>
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
);
|
|
127
|
-
|
|
128
|
-
const wrapper = shallowModal(modalProps);
|
|
129
|
-
const modal = wrapper.instance() as EditSecurityGroupsModal;
|
|
130
|
-
const setState = spyOn(modal, 'setState').and.callThrough();
|
|
100
|
+
runtimeServices.securityGroupReader = {
|
|
101
|
+
getAllSecurityGroups: vi.fn().mockReturnValue(new Promise((resolve) => (finishLoading = resolve))),
|
|
102
|
+
};
|
|
103
|
+
const consoleError = vi.spyOn(console, 'error').mockReturnValue(undefined);
|
|
104
|
+
const rendered = renderModal(modalProps);
|
|
105
|
+
rendered.unmount();
|
|
131
106
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
107
|
+
await act(async () => {
|
|
108
|
+
finishLoading!({});
|
|
109
|
+
await Promise.resolve();
|
|
110
|
+
});
|
|
135
111
|
|
|
136
|
-
expect(
|
|
112
|
+
expect(consoleError.mock.calls.join('\n')).not.toContain('unmounted component');
|
|
137
113
|
});
|
|
138
114
|
|
|
139
|
-
it('submits selected groups through the writer with mixed-instance launch-template state', () => {
|
|
140
|
-
const
|
|
115
|
+
it('submits selected groups through the writer with mixed-instance launch-template state', async () => {
|
|
116
|
+
const updateSecurityGroups = vi.fn().mockResolvedValue({} as any);
|
|
141
117
|
const selected = [{ id: 'sg-attached', name: 'attached' }] as any;
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
modal.submit();
|
|
153
|
-
|
|
154
|
-
expect(update).toHaveBeenCalledWith(
|
|
155
|
-
jasmine.objectContaining({ name: 'deck-main-v001' }),
|
|
118
|
+
runtimeServices.securityGroupReader = { getAllSecurityGroups: vi.fn().mockResolvedValue({}) };
|
|
119
|
+
runtimeServices.serverGroupWriter = { updateSecurityGroups };
|
|
120
|
+
renderModal({ ...modalProps, securityGroups: selected, serverGroup: { ...serverGroup, mixedInstancesPolicy: {} } });
|
|
121
|
+
await waitFor(() => expect(screen.getByRole('button', { name: 'Submit' })).toBeEnabled());
|
|
122
|
+
|
|
123
|
+
fireEvent.click(screen.getByRole('button', { name: 'Submit' }));
|
|
124
|
+
|
|
125
|
+
expect(updateSecurityGroups).toHaveBeenCalledWith(
|
|
126
|
+
expect.objectContaining({ name: 'deck-main-v001' }),
|
|
156
127
|
selected,
|
|
157
128
|
application,
|
|
158
129
|
true,
|
|
@@ -45,13 +45,13 @@ describe('ModifyWarmPoolModal', () => {
|
|
|
45
45
|
});
|
|
46
46
|
|
|
47
47
|
it('submits the built job through the task monitor', () => {
|
|
48
|
-
const execute = spyOn(TaskExecutor, 'executeTask').
|
|
49
|
-
const application = { name: 'deck', serverGroups: { refresh:
|
|
48
|
+
const execute = vi.spyOn(TaskExecutor, 'executeTask').mockReturnValue(Promise.resolve({} as any));
|
|
49
|
+
const application = { name: 'deck', serverGroups: { refresh: vi.fn() } } as any;
|
|
50
50
|
const modal = new ModifyWarmPoolModal({
|
|
51
51
|
application,
|
|
52
52
|
serverGroup: { ...serverGroup, asg: {} },
|
|
53
|
-
closeModal:
|
|
54
|
-
dismissModal:
|
|
53
|
+
closeModal: vi.fn(),
|
|
54
|
+
dismissModal: vi.fn(),
|
|
55
55
|
} as any) as any;
|
|
56
56
|
modal.state.enabled = true;
|
|
57
57
|
modal.state.minSize = 3;
|
|
@@ -63,7 +63,7 @@ describe('ModifyWarmPoolModal', () => {
|
|
|
63
63
|
expect(execute).toHaveBeenCalledWith({
|
|
64
64
|
application,
|
|
65
65
|
description: 'Update Warm Pool for deck-main-v001',
|
|
66
|
-
job: [
|
|
66
|
+
job: [expect.objectContaining({ action: 'upsert', minSize: 3, poolState: 'Stopped' })],
|
|
67
67
|
});
|
|
68
68
|
});
|
|
69
69
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// eslint-disable-next-line @spinnaker/import-from-npm-not-relative
|
|
2
|
-
import { mockHttpClient } from '../../../core/src/api/mock/
|
|
2
|
+
import { mockHttpClient } from '../../../core/src/api/mock/mockHttpSupport';
|
|
3
3
|
import { VpcReader } from '../vpc/VpcReader';
|
|
4
4
|
|
|
5
5
|
describe('VpcReader', function () {
|
package/src/vpc/VpcTag.spec.tsx
CHANGED
|
@@ -1,37 +1,33 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
|
|
4
4
|
import { VpcTag } from './VpcTag';
|
|
5
5
|
import { VpcReader } from '../vpc/VpcReader';
|
|
6
6
|
|
|
7
|
-
const tick = () => new Promise((resolve) => setTimeout(resolve));
|
|
8
|
-
|
|
9
7
|
describe('VpcTag', function () {
|
|
10
8
|
describe('vpc tag rendering - no VPC provided', function () {
|
|
11
9
|
it('displays default message when no vpcId supplied', function () {
|
|
12
|
-
|
|
13
|
-
expect(
|
|
10
|
+
render(<VpcTag vpcId={undefined} />);
|
|
11
|
+
expect(screen.getByText('None (EC2 Classic)')).toBeInTheDocument();
|
|
14
12
|
});
|
|
15
13
|
|
|
16
14
|
it('displays default message when null vpcId supplied', function () {
|
|
17
|
-
|
|
18
|
-
expect(
|
|
15
|
+
render(<VpcTag vpcId={null} />);
|
|
16
|
+
expect(screen.getByText('None (EC2 Classic)')).toBeInTheDocument();
|
|
19
17
|
});
|
|
20
18
|
});
|
|
21
19
|
|
|
22
20
|
describe('vpc tag rendering - VPC provided', function () {
|
|
23
21
|
it('displays vpc name when found', async function () {
|
|
24
|
-
spyOn(VpcReader, 'getVpcName').
|
|
25
|
-
|
|
26
|
-
await
|
|
27
|
-
expect(component.text()).toBe('Main VPC (vpc-1)');
|
|
22
|
+
vi.spyOn(VpcReader, 'getVpcName').mockReturnValue(Promise.resolve('Main VPC'));
|
|
23
|
+
render(<VpcTag vpcId="vpc-1" />);
|
|
24
|
+
expect(await screen.findByText('Main VPC (vpc-1)')).toBeInTheDocument();
|
|
28
25
|
});
|
|
29
26
|
|
|
30
27
|
it('displays vpc id when not found', async function () {
|
|
31
|
-
spyOn(VpcReader, 'getVpcName').
|
|
32
|
-
|
|
33
|
-
await
|
|
34
|
-
expect(component.text()).toBe('(vpc-2)');
|
|
28
|
+
vi.spyOn(VpcReader, 'getVpcName').mockReturnValue(Promise.resolve(null));
|
|
29
|
+
render(<VpcTag vpcId="vpc-2" />);
|
|
30
|
+
expect(await screen.findByText('(vpc-2)')).toBeInTheDocument();
|
|
35
31
|
});
|
|
36
32
|
});
|
|
37
33
|
});
|
|
File without changes
|