@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
|
@@ -97,6 +97,7 @@ export function validateAwsResizeAsgStage(stage: IResizeAsgStage): string {
|
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
interface IControlledIntegerInputProps {
|
|
100
|
+
ariaLabel: string;
|
|
100
101
|
dataCapacityField?: string;
|
|
101
102
|
maximum?: number;
|
|
102
103
|
name: string;
|
|
@@ -106,6 +107,7 @@ interface IControlledIntegerInputProps {
|
|
|
106
107
|
}
|
|
107
108
|
|
|
108
109
|
function ControlledIntegerInput({
|
|
110
|
+
ariaLabel,
|
|
109
111
|
dataCapacityField,
|
|
110
112
|
maximum,
|
|
111
113
|
name,
|
|
@@ -128,6 +130,7 @@ function ControlledIntegerInput({
|
|
|
128
130
|
|
|
129
131
|
return (
|
|
130
132
|
<input
|
|
133
|
+
aria-label={ariaLabel}
|
|
131
134
|
aria-invalid={!valid}
|
|
132
135
|
className="form-control input-sm"
|
|
133
136
|
data-capacity-field={dataCapacityField}
|
|
@@ -263,6 +266,7 @@ export function AwsResizeAsgStageConfig(props: IStageConfigProps) {
|
|
|
263
266
|
{stage.resizeType === 'pct' && (
|
|
264
267
|
<StageConfigField label="Resize Percentage">
|
|
265
268
|
<ControlledIntegerInput
|
|
269
|
+
ariaLabel="Resize percentage"
|
|
266
270
|
name="scalePct"
|
|
267
271
|
onValidChange={(scalePct) => updateStageField({ scalePct })}
|
|
268
272
|
resetKey={stage.refId}
|
|
@@ -273,6 +277,7 @@ export function AwsResizeAsgStageConfig(props: IStageConfigProps) {
|
|
|
273
277
|
{stage.resizeType === 'incr' && (
|
|
274
278
|
<StageConfigField label="Resize Count">
|
|
275
279
|
<ControlledIntegerInput
|
|
280
|
+
ariaLabel="Resize count"
|
|
276
281
|
name="scaleNum"
|
|
277
282
|
onValidChange={(scaleNum) => updateStageField({ scaleNum })}
|
|
278
283
|
resetKey={stage.refId}
|
|
@@ -283,6 +288,7 @@ export function AwsResizeAsgStageConfig(props: IStageConfigProps) {
|
|
|
283
288
|
{(stage.action === 'scale_up' || stage.action === 'scale_to_cluster') && (
|
|
284
289
|
<StageConfigField label="Target Healthy Percentage">
|
|
285
290
|
<ControlledIntegerInput
|
|
291
|
+
ariaLabel="Target healthy percentage"
|
|
286
292
|
maximum={100}
|
|
287
293
|
name="targetHealthyDeployPercentage"
|
|
288
294
|
onValidChange={(targetHealthyDeployPercentage) => updateStageField({ targetHealthyDeployPercentage })}
|
|
@@ -307,6 +313,7 @@ export function AwsResizeAsgStageConfig(props: IStageConfigProps) {
|
|
|
307
313
|
{(['min', 'max', 'desired'] as const).map((field) => (
|
|
308
314
|
<div className="col-md-3" key={field}>
|
|
309
315
|
<ControlledIntegerInput
|
|
316
|
+
ariaLabel={`${field === 'min' ? 'Minimum' : field === 'max' ? 'Maximum' : 'Desired'} capacity`}
|
|
310
317
|
dataCapacityField={field}
|
|
311
318
|
name={`capacity.${field}`}
|
|
312
319
|
onValidChange={(value) =>
|
|
@@ -1,21 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { fireEvent, render, screen, within } from '@testing-library/react';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
|
|
4
|
-
import { AccountService
|
|
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
|
import { awsTagImageStage } from './awsTagImageStage';
|
|
8
9
|
|
|
9
10
|
describe('AwsTagImageStageConfig', () => {
|
|
10
|
-
const application = {
|
|
11
|
-
defaultCredentials: {},
|
|
12
|
-
defaultRegions: {},
|
|
13
|
-
getDataSource: () => ({ data: [] }),
|
|
14
|
-
} as any;
|
|
15
|
-
|
|
16
11
|
beforeEach(() => {
|
|
17
|
-
spyOn(AccountService, 'listAccounts').
|
|
18
|
-
spyOn(AccountService, 'getUniqueAttributeForAllAccounts').
|
|
12
|
+
vi.spyOn(AccountService, 'listAccounts').mockResolvedValue([] as any);
|
|
13
|
+
vi.spyOn(AccountService, 'getUniqueAttributeForAllAccounts').mockResolvedValue([] as any);
|
|
19
14
|
});
|
|
20
15
|
|
|
21
16
|
function renderStage(stageOverrides: Record<string, any> = {}) {
|
|
@@ -33,7 +28,7 @@ describe('AwsTagImageStageConfig', () => {
|
|
|
33
28
|
requisiteStageRefIds: [],
|
|
34
29
|
type: 'bake',
|
|
35
30
|
};
|
|
36
|
-
const
|
|
31
|
+
const initialStage = {
|
|
37
32
|
cloudProvider: 'aws',
|
|
38
33
|
consideredStages: ['bake-ref', 'stale-ref'],
|
|
39
34
|
name: 'Tag image',
|
|
@@ -43,125 +38,85 @@ describe('AwsTagImageStageConfig', () => {
|
|
|
43
38
|
type: 'upsertImageTags',
|
|
44
39
|
...stageOverrides,
|
|
45
40
|
};
|
|
46
|
-
const pipeline = { stages: [bake, findImage, wait, unrelatedBake,
|
|
47
|
-
const updateStageField =
|
|
41
|
+
const pipeline = { stages: [bake, findImage, wait, unrelatedBake, initialStage] } as any;
|
|
42
|
+
const updateStageField = vi.fn();
|
|
48
43
|
const StageComponent = awsTagImageStage.component as React.ComponentType<any>;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
/>,
|
|
59
|
-
);
|
|
60
|
-
|
|
61
|
-
return { stage, updateStageField, wrapper };
|
|
44
|
+
function StageHarness() {
|
|
45
|
+
const [stage, setStage] = React.useState(initialStage);
|
|
46
|
+
const update = (changes: any) => {
|
|
47
|
+
updateStageField(changes);
|
|
48
|
+
setStage((current: any) => ({ ...current, ...changes }));
|
|
49
|
+
};
|
|
50
|
+
return <StageComponent application={{} as any} pipeline={pipeline} stage={stage} updateStageField={update} />;
|
|
51
|
+
}
|
|
52
|
+
return { initialStage, updateStageField, ...render(<StageHarness />) };
|
|
62
53
|
}
|
|
63
54
|
|
|
64
55
|
it('registers a dedicated editor instead of the generic Amazon stage editor', () => {
|
|
65
56
|
expect(awsTagImageStage.component).not.toBe(AmazonStageConfig);
|
|
66
57
|
});
|
|
67
58
|
|
|
68
|
-
it('persists missing defaults
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
expect(updateStageField.calls.allArgs()).toEqual([[{ cloudProvider: 'aws', tags: {} }]]);
|
|
72
|
-
|
|
73
|
-
wrapper.setProps({ stage: { ...stage, cloudProvider: 'aws', tags: {} } });
|
|
74
|
-
|
|
75
|
-
expect(updateStageField).toHaveBeenCalledTimes(1);
|
|
59
|
+
it('persists only missing defaults without causing an update loop', () => {
|
|
60
|
+
const rendered = renderStage({ cloudProvider: undefined, tags: undefined });
|
|
61
|
+
expect(rendered.updateStageField.mock.calls).toEqual([[{ cloudProvider: 'aws', tags: {} }]]);
|
|
76
62
|
});
|
|
77
63
|
|
|
78
|
-
it('preserves
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
it('preserves explicit tags while initializing a missing cloud provider', () => {
|
|
64
|
+
it('preserves explicit values while initializing the other missing field', () => {
|
|
65
|
+
expect(renderStage({ cloudProvider: 'aws-custom', tags: undefined }).updateStageField.mock.calls).toEqual([
|
|
66
|
+
[{ tags: {} }],
|
|
67
|
+
]);
|
|
85
68
|
const tags = { Owner: '', unknown: 'persisted' };
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
expect(
|
|
89
|
-
|
|
69
|
+
const rendered = renderStage({ cloudProvider: undefined, tags });
|
|
70
|
+
expect(rendered.updateStageField.mock.calls).toEqual([[{ cloudProvider: 'aws' }]]);
|
|
71
|
+
expect(
|
|
72
|
+
within(getFormGroupByLabel('Tags', rendered.container))
|
|
73
|
+
.getAllByLabelText('Key')
|
|
74
|
+
.map((input) => input.getAttribute('value')),
|
|
75
|
+
).toEqual(['Owner', 'unknown']);
|
|
90
76
|
});
|
|
91
77
|
|
|
92
|
-
it('round-trips
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
expect(mapEditor.exists()).toBe(true);
|
|
97
|
-
if (!mapEditor.exists()) {
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
expect(mapEditor.prop('allowEmpty')).toBe(true);
|
|
102
|
-
expect(mapEditor.prop('model')).toEqual(stage.tags);
|
|
78
|
+
it('round-trips edited and removed tags as structured objects', () => {
|
|
79
|
+
const rendered = renderStage();
|
|
80
|
+
rendered.updateStageField.mockClear();
|
|
81
|
+
const tags = getFormGroupByLabel('Tags');
|
|
103
82
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
const removed = { Owner: '', 'legacy:key': 'updated' };
|
|
107
|
-
mapEditor.prop('onChange')(added, false);
|
|
108
|
-
mapEditor.prop('onChange')(edited, false);
|
|
109
|
-
mapEditor.prop('onChange')(removed, false);
|
|
83
|
+
fireEvent.change(within(tags).getAllByLabelText('Value')[1], { target: { value: 'updated' } });
|
|
84
|
+
fireEvent.click(within(tags).getAllByRole('button', { name: 'Remove field' })[0]);
|
|
110
85
|
|
|
111
|
-
expect(updateStageField.calls
|
|
86
|
+
expect(rendered.updateStageField.mock.calls).toEqual([
|
|
87
|
+
[{ tags: { Owner: '', 'legacy:key': 'updated' } }],
|
|
88
|
+
[{ tags: { 'legacy:key': 'updated' } }],
|
|
89
|
+
]);
|
|
112
90
|
});
|
|
113
91
|
|
|
114
|
-
it('
|
|
115
|
-
const {
|
|
116
|
-
|
|
117
|
-
.find('input[type="checkbox"]')
|
|
118
|
-
.map((input) => input.prop('value'))
|
|
119
|
-
.sort();
|
|
92
|
+
it('reports a newly added tag field through the controlled stage contract', () => {
|
|
93
|
+
const rendered = renderStage({ tags: {} });
|
|
94
|
+
rendered.updateStageField.mockClear();
|
|
120
95
|
|
|
121
|
-
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
it('shows a selected stale stage ref as unavailable', () => {
|
|
125
|
-
const { wrapper } = renderStage();
|
|
126
|
-
const staleStage = wrapper.find('input[type="checkbox"][value="stale-ref"]');
|
|
127
|
-
|
|
128
|
-
expect(staleStage.exists()).toBe(true);
|
|
129
|
-
if (!staleStage.exists()) {
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
96
|
+
fireEvent.click(within(getFormGroupByLabel('Tags')).getByRole('button', { name: 'Add Field' }));
|
|
132
97
|
|
|
133
|
-
expect(
|
|
134
|
-
expect(
|
|
135
|
-
expect(staleStage.closest('label').text()).toContain('stale-ref (unavailable)');
|
|
98
|
+
expect(rendered.updateStageField).toHaveBeenCalledWith({ tags: { '': '' } });
|
|
99
|
+
expect(within(getFormGroupByLabel('Tags')).getByLabelText('Key')).toHaveValue('');
|
|
136
100
|
});
|
|
137
101
|
|
|
138
|
-
it('
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
expect(
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
findImage.simulate('change', { target: { checked: true } });
|
|
102
|
+
it('offers only upstream image-producing stages and marks stale selections unavailable', () => {
|
|
103
|
+
renderStage();
|
|
104
|
+
expect(screen.getByRole('checkbox', { name: 'Bake image' })).toBeChecked();
|
|
105
|
+
expect(screen.getByRole('checkbox', { name: 'Find image' })).not.toBeChecked();
|
|
106
|
+
expect(screen.queryByRole('checkbox', { name: 'Unrelated bake' })).not.toBeInTheDocument();
|
|
107
|
+
expect(screen.getByRole('checkbox', { name: 'stale-ref (unavailable)' })).toBeDisabled();
|
|
108
|
+
});
|
|
148
109
|
|
|
149
|
-
|
|
110
|
+
it('preserves stale refs when selecting and deselecting available stages', () => {
|
|
111
|
+
const selected = renderStage();
|
|
112
|
+
selected.updateStageField.mockClear();
|
|
113
|
+
fireEvent.click(screen.getByRole('checkbox', { name: 'Find image' }));
|
|
114
|
+
expect(selected.updateStageField).toHaveBeenCalledWith({
|
|
150
115
|
consideredStages: ['bake-ref', 'stale-ref', 'find-image-ref'],
|
|
151
116
|
});
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
it('preserves a stale stage ref when deselecting an available stage', () => {
|
|
155
|
-
const { updateStageField, wrapper } = renderStage();
|
|
156
|
-
const bake = wrapper.find('input[type="checkbox"][value="bake-ref"]');
|
|
157
|
-
|
|
158
|
-
expect(bake.exists()).toBe(true);
|
|
159
|
-
if (!bake.exists()) {
|
|
160
|
-
return;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
bake.simulate('change', { target: { checked: false } });
|
|
164
117
|
|
|
165
|
-
|
|
118
|
+
selected.updateStageField.mockClear();
|
|
119
|
+
fireEvent.click(screen.getByRole('checkbox', { name: 'Bake image' }));
|
|
120
|
+
expect(selected.updateStageField).toHaveBeenCalledWith({ consideredStages: ['stale-ref', 'find-image-ref'] });
|
|
166
121
|
});
|
|
167
122
|
});
|
|
@@ -8,8 +8,8 @@ import { AmazonCloneServerGroupModalComponent } from './serverGroup/configure/wi
|
|
|
8
8
|
describe('Amazon routed modal consumers', () => {
|
|
9
9
|
function stateService(includedState: string) {
|
|
10
10
|
return {
|
|
11
|
-
go:
|
|
12
|
-
includes:
|
|
11
|
+
go: vi.fn(),
|
|
12
|
+
includes: vi.fn().mockImplementation((state: string) => state === includedState),
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
15
|
|
|
@@ -21,9 +21,9 @@ describe('Amazon routed modal consumers', () => {
|
|
|
21
21
|
it(`navigates from the ${type} load balancer modal through its injected state service`, () => {
|
|
22
22
|
const state = stateService('**.loadBalancerDetails');
|
|
23
23
|
const modal = Object.create(Component.prototype) as any;
|
|
24
|
-
modal.props = { dismissModal:
|
|
24
|
+
modal.props = { dismissModal: vi.fn(), stateService: state };
|
|
25
25
|
modal.state = {};
|
|
26
|
-
modal.setState =
|
|
26
|
+
modal.setState = vi.fn();
|
|
27
27
|
|
|
28
28
|
modal.onApplicationRefresh({
|
|
29
29
|
credentials: 'test-account',
|
|
@@ -49,27 +49,27 @@ describe('Amazon routed modal consumers', () => {
|
|
|
49
49
|
['Lambda function', CreateLambdaFunctionComponent, 'functions'],
|
|
50
50
|
].forEach(([type, Component, dataSourceName]: [string, any, string]) => {
|
|
51
51
|
it(`owns the ${type} refresh subscription across replacement and unmount`, () => {
|
|
52
|
-
const firstUnsubscribe =
|
|
53
|
-
const secondUnsubscribe =
|
|
52
|
+
const firstUnsubscribe = vi.fn();
|
|
53
|
+
const secondUnsubscribe = vi.fn();
|
|
54
54
|
const callbacks: Array<() => void> = [];
|
|
55
|
-
const onNextRefresh =
|
|
55
|
+
const onNextRefresh = vi.fn().mockImplementation((callback: () => void) => {
|
|
56
56
|
callbacks.push(callback);
|
|
57
57
|
return callbacks.length === 1 ? firstUnsubscribe : secondUnsubscribe;
|
|
58
58
|
});
|
|
59
|
-
const refresh =
|
|
59
|
+
const refresh = vi.fn();
|
|
60
60
|
const state = stateService('');
|
|
61
61
|
const modal = Object.create(Component.prototype) as any;
|
|
62
62
|
modal.props = {
|
|
63
63
|
app: { [dataSourceName]: { onNextRefresh, refresh } },
|
|
64
|
-
dismissModal:
|
|
64
|
+
dismissModal: vi.fn(),
|
|
65
65
|
stateService: state,
|
|
66
66
|
};
|
|
67
67
|
modal.state = {};
|
|
68
|
-
modal.setState =
|
|
68
|
+
modal.setState = vi.fn();
|
|
69
69
|
|
|
70
70
|
modal.onTaskComplete({});
|
|
71
71
|
|
|
72
|
-
expect(onNextRefresh.
|
|
72
|
+
expect(onNextRefresh.mock.invocationCallOrder[0]).toBeLessThan(refresh.mock.invocationCallOrder[0]);
|
|
73
73
|
|
|
74
74
|
modal.onTaskComplete({});
|
|
75
75
|
|
|
@@ -87,9 +87,9 @@ describe('Amazon routed modal consumers', () => {
|
|
|
87
87
|
it('navigates from the function modal through its injected state service', () => {
|
|
88
88
|
const state = stateService('');
|
|
89
89
|
const modal = Object.create(CreateLambdaFunctionComponent.prototype) as any;
|
|
90
|
-
modal.props = { dismissModal:
|
|
90
|
+
modal.props = { dismissModal: vi.fn(), stateService: state };
|
|
91
91
|
modal.state = {};
|
|
92
|
-
modal.setState =
|
|
92
|
+
modal.setState = vi.fn();
|
|
93
93
|
|
|
94
94
|
modal.onApplicationRefresh({ credentials: 'test-account', name: 'fnord', region: 'eu-west-1', vpcId: 'vpc-1' });
|
|
95
95
|
|
|
@@ -104,12 +104,12 @@ describe('Amazon routed modal consumers', () => {
|
|
|
104
104
|
|
|
105
105
|
it('navigates from the security group modal through its injected state service', () => {
|
|
106
106
|
const state = stateService('**.firewallDetails');
|
|
107
|
-
const refresh =
|
|
108
|
-
const closeModal =
|
|
107
|
+
const refresh = vi.fn();
|
|
108
|
+
const closeModal = vi.fn();
|
|
109
109
|
const modal = new AmazonSecurityGroupModalComponent({
|
|
110
110
|
app: { securityGroups: { refresh } },
|
|
111
111
|
closeModal,
|
|
112
|
-
dismissModal:
|
|
112
|
+
dismissModal: vi.fn(),
|
|
113
113
|
mode: 'clone',
|
|
114
114
|
stateService: state,
|
|
115
115
|
} as any) as any;
|
|
@@ -144,7 +144,7 @@ describe('Amazon routed modal consumers', () => {
|
|
|
144
144
|
region: 'eu-west-1',
|
|
145
145
|
viewState: { requiresTemplateSelection: true },
|
|
146
146
|
},
|
|
147
|
-
dismissModal:
|
|
147
|
+
dismissModal: vi.fn(),
|
|
148
148
|
stateService: state,
|
|
149
149
|
} as any) as any;
|
|
150
150
|
modal.state = {
|
|
@@ -173,25 +173,25 @@ describe('Amazon routed modal consumers', () => {
|
|
|
173
173
|
});
|
|
174
174
|
|
|
175
175
|
it('owns the clone server group refresh subscription across replacement and unmount', () => {
|
|
176
|
-
const firstUnsubscribe =
|
|
177
|
-
const secondUnsubscribe =
|
|
176
|
+
const firstUnsubscribe = vi.fn();
|
|
177
|
+
const secondUnsubscribe = vi.fn();
|
|
178
178
|
const callbacks: Array<() => void> = [];
|
|
179
|
-
const onNextRefresh =
|
|
179
|
+
const onNextRefresh = vi.fn().mockImplementation((callback: () => void) => {
|
|
180
180
|
callbacks.push(callback);
|
|
181
181
|
return callbacks.length === 1 ? firstUnsubscribe : secondUnsubscribe;
|
|
182
182
|
});
|
|
183
|
-
const refresh =
|
|
183
|
+
const refresh = vi.fn();
|
|
184
184
|
const state = stateService('**.clusters');
|
|
185
185
|
const modal = new AmazonCloneServerGroupModalComponent({
|
|
186
186
|
application: { name: 'fnord', serverGroups: { onNextRefresh, refresh } },
|
|
187
187
|
command: { credentials: 'test-account', region: 'eu-west-1', viewState: { requiresTemplateSelection: true } },
|
|
188
|
-
dismissModal:
|
|
188
|
+
dismissModal: vi.fn(),
|
|
189
189
|
stateService: state,
|
|
190
190
|
} as any) as any;
|
|
191
191
|
|
|
192
192
|
modal.onTaskComplete();
|
|
193
193
|
|
|
194
|
-
expect(onNextRefresh.
|
|
194
|
+
expect(onNextRefresh.mock.invocationCallOrder[0]).toBeLessThan(refresh.mock.invocationCallOrder[0]);
|
|
195
195
|
|
|
196
196
|
modal.onTaskComplete();
|
|
197
197
|
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { Mock } from 'vitest';
|
|
2
|
+
import { fireEvent, screen, within } from '@testing-library/react';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
|
|
5
|
+
import { SecurityGroupWriter } from '@spinnaker/core';
|
|
6
|
+
import { renderWithRouter } from '../../../../core/src/utils/testUtils/rtl';
|
|
7
|
+
|
|
5
8
|
import {
|
|
6
9
|
AmazonSecurityGroupModalComponent as AmazonSecurityGroupModal,
|
|
7
10
|
initializeAmazonSecurityGroupForModal,
|
|
@@ -34,24 +37,21 @@ describe('AmazonSecurityGroupModal', () => {
|
|
|
34
37
|
};
|
|
35
38
|
}
|
|
36
39
|
|
|
37
|
-
function
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
modal.state = { ...modal.state, ...nextState };
|
|
53
|
-
};
|
|
54
|
-
return modal;
|
|
40
|
+
function renderModal(securityGroup: any, mode: 'edit' | 'clone' = 'edit') {
|
|
41
|
+
return renderWithRouter(
|
|
42
|
+
<AmazonSecurityGroupModal
|
|
43
|
+
{...({
|
|
44
|
+
app: { name: 'fnord' },
|
|
45
|
+
closeModal: vi.fn(),
|
|
46
|
+
dismissModal: vi.fn(),
|
|
47
|
+
mode,
|
|
48
|
+
router: {} as any,
|
|
49
|
+
securityGroup,
|
|
50
|
+
stateParams: {},
|
|
51
|
+
stateService: { go: vi.fn(), includes: vi.fn() },
|
|
52
|
+
} as any)}
|
|
53
|
+
/>,
|
|
54
|
+
);
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
it('preserves inferred source security group identity when initializing edit rules', () => {
|
|
@@ -93,26 +93,23 @@ describe('AmazonSecurityGroupModal', () => {
|
|
|
93
93
|
});
|
|
94
94
|
|
|
95
95
|
it('renders existing identity immutably, allows protocol and port edits, and submits the retained identity', () => {
|
|
96
|
-
spyOn(SecurityGroupWriter, 'upsertSecurityGroup').
|
|
96
|
+
vi.spyOn(SecurityGroupWriter, 'upsertSecurityGroup').mockResolvedValue({} as any);
|
|
97
97
|
const securityGroup = initializeAmazonSecurityGroupForModal(
|
|
98
98
|
{ mode: 'edit', securityGroup: inferredSecurityGroup() } as any,
|
|
99
99
|
'fnord',
|
|
100
100
|
);
|
|
101
|
-
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
expect(
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
const submittedRule = (SecurityGroupWriter.upsertSecurityGroup as jasmine.Spy).calls.mostRecent().args[0]
|
|
115
|
-
.securityGroupIngress[0];
|
|
101
|
+
renderModal(securityGroup);
|
|
102
|
+
const rules = screen.getByText('Firewall Ingress').parentElement as HTMLElement;
|
|
103
|
+
|
|
104
|
+
expect(within(rules).getByText('sg-123456')).toBeInTheDocument();
|
|
105
|
+
expect(within(rules).queryByDisplayValue('sg-123456')).not.toBeInTheDocument();
|
|
106
|
+
fireEvent.change(within(rules).getByDisplayValue('tcp'), { target: { value: 'udp' } });
|
|
107
|
+
const ports = within(rules).getAllByRole('spinbutton');
|
|
108
|
+
fireEvent.change(ports[0], { target: { value: '8443' } });
|
|
109
|
+
fireEvent.change(ports[1], { target: { value: '9443' } });
|
|
110
|
+
fireEvent.click(screen.getByRole('button', { name: 'Update' }));
|
|
111
|
+
|
|
112
|
+
const submittedRule = (SecurityGroupWriter.upsertSecurityGroup as Mock).mock.lastCall[0].securityGroupIngress[0];
|
|
116
113
|
expect(submittedRule).toEqual({
|
|
117
114
|
account: 'source-account',
|
|
118
115
|
accountId: 'source-account-id',
|
|
@@ -128,7 +125,7 @@ describe('AmazonSecurityGroupModal', () => {
|
|
|
128
125
|
});
|
|
129
126
|
|
|
130
127
|
it('submits cloned rules by their editable name without stale source identity', () => {
|
|
131
|
-
spyOn(SecurityGroupWriter, 'upsertSecurityGroup').
|
|
128
|
+
vi.spyOn(SecurityGroupWriter, 'upsertSecurityGroup').mockResolvedValue({} as any);
|
|
132
129
|
const source = inferredSecurityGroup();
|
|
133
130
|
source.inboundRules[0].securityGroup.inferredName = false;
|
|
134
131
|
source.inboundRules[0].securityGroup.name = 'resolved-source-group';
|
|
@@ -136,17 +133,12 @@ describe('AmazonSecurityGroupModal', () => {
|
|
|
136
133
|
{ mode: 'clone', securityGroup: source } as any,
|
|
137
134
|
'fnord',
|
|
138
135
|
);
|
|
139
|
-
|
|
140
|
-
const wrapper = shallow(<div>{modal.renderSecurityGroupRules()}</div>);
|
|
141
|
-
const nameInput = wrapper.find('input').at(0);
|
|
136
|
+
renderModal(securityGroup, 'clone');
|
|
142
137
|
|
|
143
|
-
|
|
138
|
+
fireEvent.change(screen.getByDisplayValue('resolved-source-group'), { target: { value: 'cloned-source-group' } });
|
|
139
|
+
fireEvent.click(screen.getByRole('button', { name: 'Clone' }));
|
|
144
140
|
|
|
145
|
-
|
|
146
|
-
modal.submit();
|
|
147
|
-
|
|
148
|
-
const submittedRule = (SecurityGroupWriter.upsertSecurityGroup as jasmine.Spy).calls.mostRecent().args[0]
|
|
149
|
-
.securityGroupIngress[0];
|
|
141
|
+
const submittedRule = (SecurityGroupWriter.upsertSecurityGroup as Mock).mock.lastCall[0].securityGroupIngress[0];
|
|
150
142
|
expect(submittedRule).toEqual({
|
|
151
143
|
endPort: 443,
|
|
152
144
|
name: 'cloned-source-group',
|
|
@@ -158,7 +150,6 @@ describe('AmazonSecurityGroupModal', () => {
|
|
|
158
150
|
it('requires an inferred source group to be replaced by name when cloning', () => {
|
|
159
151
|
const source = inferredSecurityGroup();
|
|
160
152
|
source.inboundRules[0].securityGroup.name = 'sg-123456';
|
|
161
|
-
|
|
162
153
|
const securityGroup = initializeAmazonSecurityGroupForModal(
|
|
163
154
|
{ mode: 'clone', securityGroup: source } as any,
|
|
164
155
|
'fnord',
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Mock } from 'vitest';
|
|
1
2
|
import { AmazonSecurityGroupDetailsComponent as AmazonSecurityGroupDetails } from './AmazonSecurityGroupDetails';
|
|
2
3
|
import { VpcReader } from '../../vpc/VpcReader';
|
|
3
4
|
|
|
@@ -5,7 +6,7 @@ const tick = () => new Promise((resolve) => setTimeout(resolve));
|
|
|
5
6
|
|
|
6
7
|
describe('AmazonSecurityGroupDetails', () => {
|
|
7
8
|
it('replaces missing details through the injected state service', () => {
|
|
8
|
-
const stateService = { go:
|
|
9
|
+
const stateService = { go: vi.fn() };
|
|
9
10
|
const component = new AmazonSecurityGroupDetails({
|
|
10
11
|
app: { isStandalone: false },
|
|
11
12
|
resolvedSecurityGroup: { accountId: 'test-account', name: 'missing', region: 'us-west-2' },
|
|
@@ -28,14 +29,14 @@ describe('AmazonSecurityGroupDetails', () => {
|
|
|
28
29
|
vpcId: 'vpc-1',
|
|
29
30
|
};
|
|
30
31
|
const securityGroupReader = {
|
|
31
|
-
getApplicationSecurityGroup:
|
|
32
|
-
getSecurityGroupDetails:
|
|
32
|
+
getApplicationSecurityGroup: vi.fn().mockReturnValue(details),
|
|
33
|
+
getSecurityGroupDetails: vi.fn().mockReturnValue(Promise.resolve(details)),
|
|
33
34
|
};
|
|
34
35
|
let resolveVpcName: (vpcName: string) => void;
|
|
35
36
|
const vpcName = new Promise<string>((resolve) => {
|
|
36
37
|
resolveVpcName = resolve;
|
|
37
38
|
});
|
|
38
|
-
spyOn(VpcReader, 'getVpcName').
|
|
39
|
+
vi.spyOn(VpcReader, 'getVpcName').mockReturnValue(vpcName);
|
|
39
40
|
const component = new AmazonSecurityGroupDetails({
|
|
40
41
|
app: { isStandalone: false } as any,
|
|
41
42
|
resolvedSecurityGroup: {
|
|
@@ -46,12 +47,12 @@ describe('AmazonSecurityGroupDetails', () => {
|
|
|
46
47
|
},
|
|
47
48
|
securityGroupReader: securityGroupReader as any,
|
|
48
49
|
});
|
|
49
|
-
spyOn(component, 'setState');
|
|
50
|
+
vi.spyOn(component, 'setState').mockReturnValue(undefined);
|
|
50
51
|
|
|
51
52
|
(component as any).loadSecurityGroup();
|
|
52
53
|
await tick();
|
|
53
54
|
expect(VpcReader.getVpcName).toHaveBeenCalledWith('vpc-1');
|
|
54
|
-
(component.setState as
|
|
55
|
+
(component.setState as Mock).mockClear();
|
|
55
56
|
|
|
56
57
|
component.componentWillUnmount();
|
|
57
58
|
resolveVpcName('Main VPC');
|