@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,72 +1,80 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { act, fireEvent, render, screen, waitFor, within } from '@testing-library/react';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
AccountService,
|
|
7
|
-
CheckboxInput,
|
|
8
|
-
ChecklistInput,
|
|
9
|
-
MapEditor,
|
|
10
|
-
ReactSelectInput,
|
|
11
|
-
Registry,
|
|
12
|
-
StageArtifactSelectorDelegate,
|
|
13
|
-
StageConfigField,
|
|
14
|
-
TextInput,
|
|
15
|
-
YamlEditor,
|
|
16
|
-
} from '@spinnaker/core';
|
|
4
|
+
import { AccountService, DeckRuntimeContext, Registry } from '@spinnaker/core';
|
|
5
|
+
import { getFormGroupByLabel } from '../../../../../core/src/utils/testUtils/rtl';
|
|
17
6
|
|
|
18
7
|
import { AmazonStageConfig } from '../AmazonStageConfig';
|
|
19
8
|
import { CloudFormationChangeSetInfo } from './CloudFormationChangeSetInfo';
|
|
20
9
|
import { DeployCloudFormationStackStageConfig } from './DeployCloudFormationStackStageConfig';
|
|
21
10
|
import { registerDeployCloudFormationStackStage } from './deployCloudFormationStackStage';
|
|
22
11
|
|
|
12
|
+
vi.mock('@spinnaker/core', async (importOriginal) => {
|
|
13
|
+
const actual = await importOriginal<any>();
|
|
14
|
+
const ReactModule = await import('react');
|
|
15
|
+
|
|
16
|
+
return {
|
|
17
|
+
...actual,
|
|
18
|
+
YamlEditor: ({ ariaLabel, onChange, value }: any) =>
|
|
19
|
+
ReactModule.createElement('textarea', {
|
|
20
|
+
'aria-label': ariaLabel,
|
|
21
|
+
onChange: (event: React.ChangeEvent<HTMLTextAreaElement>) =>
|
|
22
|
+
onChange(event.target.value, actual.yamlStringToDocuments(event.target.value)),
|
|
23
|
+
value: value ?? '',
|
|
24
|
+
}),
|
|
25
|
+
};
|
|
26
|
+
});
|
|
27
|
+
|
|
23
28
|
describe('Deploy CloudFormation stack stage', () => {
|
|
24
29
|
beforeEach(() => {
|
|
25
|
-
spyOn(AccountService, 'getAllAccountDetailsForProvider').
|
|
26
|
-
spyOn(AccountService, 'getArtifactAccounts').
|
|
27
|
-
spyOn(AccountService, 'getUniqueAttributeForAllAccounts').
|
|
30
|
+
vi.spyOn(AccountService, 'getAllAccountDetailsForProvider').mockResolvedValue([]);
|
|
31
|
+
vi.spyOn(AccountService, 'getArtifactAccounts').mockResolvedValue([]);
|
|
32
|
+
vi.spyOn(AccountService, 'getUniqueAttributeForAllAccounts').mockResolvedValue([]);
|
|
28
33
|
});
|
|
29
34
|
|
|
30
|
-
function renderEditor(
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
35
|
+
function renderEditor(stageOverrides: any = {}, application: any = {}, pipelineOverrides: any = {}) {
|
|
36
|
+
const initialStage = { type: 'deployCloudFormation', ...stageOverrides };
|
|
37
|
+
const updateStageField = vi.fn();
|
|
38
|
+
let replaceStage: React.Dispatch<React.SetStateAction<any>>;
|
|
39
|
+
function StageHarness() {
|
|
40
|
+
const [stage, setStage] = React.useState(initialStage);
|
|
41
|
+
replaceStage = setStage;
|
|
42
|
+
const update = (changes: any) => {
|
|
43
|
+
updateStageField(changes);
|
|
44
|
+
setStage((current: any) => ({ ...current, ...changes }));
|
|
45
|
+
};
|
|
46
|
+
return (
|
|
47
|
+
<DeployCloudFormationStackStageConfig
|
|
48
|
+
application={application}
|
|
49
|
+
pipeline={{ expectedArtifacts: [], ...pipelineOverrides } as any}
|
|
50
|
+
stage={stage}
|
|
51
|
+
updateStageField={update}
|
|
52
|
+
/>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
initialStage,
|
|
57
|
+
replaceStage: (stage: any) => act(() => replaceStage(stage)),
|
|
58
|
+
updateStageField,
|
|
59
|
+
...render(
|
|
60
|
+
<DeckRuntimeContext.Provider value={{ services: { executionService: {} } } as any}>
|
|
61
|
+
<StageHarness />
|
|
62
|
+
</DeckRuntimeContext.Provider>,
|
|
63
|
+
),
|
|
64
|
+
};
|
|
54
65
|
}
|
|
55
66
|
|
|
56
67
|
it('registers a dedicated stage editor', () => {
|
|
57
|
-
const registerStage = spyOn(Registry.pipeline, 'registerStage');
|
|
58
|
-
|
|
68
|
+
const registerStage = vi.spyOn(Registry.pipeline, 'registerStage').mockReturnValue(undefined);
|
|
59
69
|
registerDeployCloudFormationStackStage();
|
|
60
|
-
|
|
61
|
-
expect(registerStage.calls.mostRecent().args[0].component).not.toBe(AmazonStageConfig);
|
|
70
|
+
expect(registerStage.mock.lastCall[0].component).not.toBe(AmazonStageConfig);
|
|
62
71
|
});
|
|
63
72
|
|
|
64
|
-
it('renders all text-template settings without changing
|
|
73
|
+
it('renders all text-template settings without changing persisted values on mount', async () => {
|
|
65
74
|
const parameters = { Environment: 'production' };
|
|
66
75
|
const tags = { Team: 'payments' };
|
|
67
|
-
const templateBody = { Resources: { Queue: { Type: 'AWS::SQS::Queue' } } };
|
|
68
76
|
const capabilities = ['CAPABILITY_IAM', 'CAPABILITY_AUTO_EXPAND'];
|
|
69
|
-
const
|
|
77
|
+
const rendered = renderEditor({
|
|
70
78
|
account: 'test-account',
|
|
71
79
|
cloudProvider: 'aws',
|
|
72
80
|
credentials: 'test-account',
|
|
@@ -74,38 +82,33 @@ describe('Deploy CloudFormation stack stage', () => {
|
|
|
74
82
|
stackName: 'payment-stack',
|
|
75
83
|
roleARN: 'arn:aws:iam::123456789012:role/cloudformation',
|
|
76
84
|
source: 'text',
|
|
77
|
-
templateBody,
|
|
85
|
+
templateBody: 'Resources:\n Queue:\n Type: AWS::SQS::Queue',
|
|
78
86
|
parameters,
|
|
79
87
|
tags,
|
|
80
88
|
capabilities,
|
|
81
89
|
});
|
|
82
90
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
expect(
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
expect(
|
|
91
|
-
expect(
|
|
92
|
-
expect(
|
|
93
|
-
|
|
94
|
-
expect(
|
|
95
|
-
expect(wrapper.find(ReactSelectInput).prop('value')).toBe(capabilities);
|
|
96
|
-
expect(updateStageField).not.toHaveBeenCalled();
|
|
91
|
+
await screen.findByRole('option', { name: 'test-account' });
|
|
92
|
+
expect(within(getFormGroupByLabel('Account')).getByRole('combobox')).toHaveValue('test-account');
|
|
93
|
+
expect(screen.getByRole('checkbox', { name: 'eu-west-1' })).toBeChecked();
|
|
94
|
+
expect(within(getFormGroupByLabel('Stack name')).getByRole('textbox')).toHaveValue('payment-stack');
|
|
95
|
+
expect(within(getFormGroupByLabel('IAM role ARN')).getByRole('textbox')).toHaveValue(
|
|
96
|
+
'arn:aws:iam::123456789012:role/cloudformation',
|
|
97
|
+
);
|
|
98
|
+
expect(screen.getByRole('radio', { name: 'Text' })).toBeChecked();
|
|
99
|
+
expect(within(getFormGroupByLabel('Parameters')).getByLabelText('Key')).toHaveValue('Environment');
|
|
100
|
+
expect(within(getFormGroupByLabel('Tags')).getByLabelText('Key')).toHaveValue('Team');
|
|
101
|
+
capabilities.forEach((capability) => expect(screen.getByText(capability)).toBeInTheDocument());
|
|
102
|
+
expect(rendered.updateStageField).not.toHaveBeenCalled();
|
|
97
103
|
});
|
|
98
104
|
|
|
99
105
|
it('initializes only missing required fields for a new stage', () => {
|
|
100
|
-
const
|
|
106
|
+
const rendered = renderEditor(
|
|
101
107
|
{},
|
|
102
|
-
{
|
|
103
|
-
defaultCredentials: { aws: 'default-account' },
|
|
104
|
-
defaultRegions: { aws: 'eu-west-1' },
|
|
105
|
-
},
|
|
108
|
+
{ defaultCredentials: { aws: 'default-account' }, defaultRegions: { aws: 'eu-west-1' } },
|
|
106
109
|
);
|
|
107
110
|
|
|
108
|
-
expect(updateStageField.calls
|
|
111
|
+
expect(rendered.updateStageField.mock.calls).toEqual([
|
|
109
112
|
[
|
|
110
113
|
{
|
|
111
114
|
account: 'default-account',
|
|
@@ -122,282 +125,316 @@ describe('Deploy CloudFormation stack stage', () => {
|
|
|
122
125
|
});
|
|
123
126
|
|
|
124
127
|
it('preserves explicit persisted-stage values without repeating initialization', () => {
|
|
125
|
-
const
|
|
126
|
-
|
|
128
|
+
const rendered = renderEditor(
|
|
129
|
+
{
|
|
130
|
+
account: 'persisted-account',
|
|
131
|
+
capabilities: [],
|
|
132
|
+
cloudProvider: 'persisted-provider',
|
|
133
|
+
credentials: 'persisted-credentials',
|
|
134
|
+
parameters: {},
|
|
135
|
+
regions: [],
|
|
136
|
+
source: 'artifact',
|
|
137
|
+
tags: {},
|
|
138
|
+
},
|
|
139
|
+
{ defaultCredentials: { aws: 'default-account' }, defaultRegions: { aws: 'eu-west-1' } },
|
|
140
|
+
);
|
|
141
|
+
|
|
142
|
+
expect(rendered.updateStageField).not.toHaveBeenCalled();
|
|
143
|
+
expect(screen.getByRole('radio', { name: 'Artifact' })).toBeChecked();
|
|
144
|
+
expect(getFormGroupByLabel('Expected Artifact')).toBeInTheDocument();
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
it('updates stack identity, account, regions, and source through public controls', async () => {
|
|
148
|
+
vi.spyOn(AccountService, 'getAllAccountDetailsForProvider').mockResolvedValue([{ name: 'other-account' }] as any);
|
|
149
|
+
vi.spyOn(AccountService, 'getUniqueAttributeForAllAccounts').mockResolvedValue(['us-east-1']);
|
|
150
|
+
const rendered = renderEditor({
|
|
151
|
+
account: 'test-account',
|
|
127
152
|
capabilities: [],
|
|
128
|
-
cloudProvider: '
|
|
129
|
-
credentials: '
|
|
153
|
+
cloudProvider: 'aws',
|
|
154
|
+
credentials: 'test-account',
|
|
130
155
|
parameters: {},
|
|
131
156
|
regions: [],
|
|
132
|
-
source: '
|
|
157
|
+
source: 'text',
|
|
133
158
|
tags: {},
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
defaultRegions: { aws: 'eu-west-1' },
|
|
138
|
-
};
|
|
139
|
-
const { updateStageField, wrapper } = mountEditor(stage, application);
|
|
159
|
+
});
|
|
160
|
+
await screen.findByRole('option', { name: 'other-account' });
|
|
161
|
+
rendered.updateStageField.mockClear();
|
|
140
162
|
|
|
141
|
-
|
|
163
|
+
fireEvent.change(within(getFormGroupByLabel('Account')).getByRole('combobox'), {
|
|
164
|
+
target: { value: 'other-account' },
|
|
165
|
+
});
|
|
166
|
+
fireEvent.click(await screen.findByRole('checkbox', { name: 'us-east-1' }));
|
|
167
|
+
fireEvent.change(within(getFormGroupByLabel('Stack name')).getByRole('textbox'), {
|
|
168
|
+
target: { value: 'other-stack' },
|
|
169
|
+
});
|
|
170
|
+
fireEvent.change(within(getFormGroupByLabel('IAM role ARN')).getByRole('textbox'), {
|
|
171
|
+
target: { value: 'other-role' },
|
|
172
|
+
});
|
|
173
|
+
fireEvent.click(screen.getByRole('checkbox', { name: 'Create CloudFormation ChangeSet' }));
|
|
174
|
+
fireEvent.click(screen.getByRole('radio', { name: 'Artifact' }));
|
|
142
175
|
|
|
143
|
-
|
|
144
|
-
|
|
176
|
+
[
|
|
177
|
+
[{ credentials: 'other-account', account: 'other-account' }],
|
|
178
|
+
[{ regions: ['us-east-1'] }],
|
|
179
|
+
[{ stackName: 'other-stack' }],
|
|
180
|
+
[{ roleARN: 'other-role' }],
|
|
181
|
+
[{ isChangeSet: true }],
|
|
182
|
+
[{ source: 'artifact' }],
|
|
183
|
+
].forEach((call) => expect(rendered.updateStageField.mock.calls).toContainEqual(call));
|
|
145
184
|
});
|
|
146
185
|
|
|
147
|
-
it('
|
|
148
|
-
const
|
|
186
|
+
it('round-trips parameters and tags without coercing values', () => {
|
|
187
|
+
const rendered = renderEditor({
|
|
188
|
+
capabilities: [],
|
|
189
|
+
cloudProvider: 'aws',
|
|
190
|
+
parameters: { Environment: 'production' },
|
|
191
|
+
regions: [],
|
|
192
|
+
source: 'text',
|
|
193
|
+
tags: { Team: 'payments' },
|
|
194
|
+
});
|
|
195
|
+
rendered.updateStageField.mockClear();
|
|
149
196
|
|
|
150
|
-
|
|
197
|
+
fireEvent.input(within(getFormGroupByLabel('Parameters')).getAllByRole('textbox')[1], {
|
|
198
|
+
target: { value: '${ parameters.environment }' },
|
|
199
|
+
});
|
|
200
|
+
fireEvent.input(within(getFormGroupByLabel('Tags')).getAllByRole('textbox')[1], {
|
|
201
|
+
target: { value: 'platform' },
|
|
202
|
+
});
|
|
151
203
|
|
|
152
|
-
expect(
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
expect(wrapper.find(YamlEditor).prop('value')).toBe(templateBody);
|
|
204
|
+
expect(rendered.updateStageField.mock.calls).toEqual([
|
|
205
|
+
[{ parameters: { Environment: '${ parameters.environment }' } }],
|
|
206
|
+
[{ tags: { Team: 'platform' } }],
|
|
207
|
+
]);
|
|
157
208
|
});
|
|
158
209
|
|
|
159
|
-
it('
|
|
160
|
-
const
|
|
210
|
+
it('writes and clears the artifact execution contract when switching sources', () => {
|
|
211
|
+
const rendered = renderEditor({
|
|
212
|
+
capabilities: [],
|
|
213
|
+
cloudProvider: 'aws',
|
|
214
|
+
parameters: {},
|
|
215
|
+
regions: [],
|
|
216
|
+
source: 'artifact',
|
|
217
|
+
stackArtifactId: 'expected-artifact-id',
|
|
218
|
+
stackArtifactAccount: 'artifact-account',
|
|
219
|
+
stackArtifact: { type: 's3/object', reference: 's3://bucket/template.yml' },
|
|
220
|
+
tags: {},
|
|
221
|
+
});
|
|
222
|
+
rendered.updateStageField.mockClear();
|
|
161
223
|
|
|
162
|
-
expect(
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
224
|
+
expect(getFormGroupByLabel('Expected Artifact')).toHaveTextContent('Expected Artifact');
|
|
225
|
+
fireEvent.click(screen.getByRole('radio', { name: 'Text' }));
|
|
226
|
+
|
|
227
|
+
expect(rendered.updateStageField).toHaveBeenCalledWith({
|
|
228
|
+
source: 'text',
|
|
229
|
+
stackArtifactId: null,
|
|
230
|
+
stackArtifactAccount: null,
|
|
231
|
+
stackArtifact: null,
|
|
232
|
+
});
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
it('updates change-set name and execution through the controlled form', () => {
|
|
236
|
+
const updateStageField = vi.fn();
|
|
237
|
+
render(
|
|
238
|
+
<CloudFormationChangeSetInfo
|
|
239
|
+
stage={{ changeSetName: 'existing-change-set', executeChangeSet: true, actionOnReplacement: 'ask' } as any}
|
|
240
|
+
updateStageField={updateStageField}
|
|
241
|
+
/>,
|
|
242
|
+
);
|
|
243
|
+
|
|
244
|
+
fireEvent.change(within(getFormGroupByLabel('ChangeSet Name')).getByRole('textbox'), {
|
|
245
|
+
target: { value: 'new-change-set' },
|
|
246
|
+
});
|
|
247
|
+
fireEvent.keyDown(within(getFormGroupByLabel('If ChangeSet contains a replacement')).getByRole('combobox'), {
|
|
248
|
+
key: 'ArrowDown',
|
|
249
|
+
keyCode: 40,
|
|
250
|
+
});
|
|
251
|
+
fireEvent.mouseDown(screen.getByText('skip it'));
|
|
252
|
+
fireEvent.click(within(getFormGroupByLabel('Execute ChangeSet')).getByRole('checkbox'));
|
|
253
|
+
|
|
254
|
+
expect(updateStageField.mock.calls).toEqual([
|
|
255
|
+
[{ changeSetName: 'new-change-set' }],
|
|
256
|
+
[{ actionOnReplacement: 'skip' }],
|
|
257
|
+
[{ executeChangeSet: false }],
|
|
180
258
|
]);
|
|
181
259
|
});
|
|
182
260
|
|
|
183
|
-
it('retains valid raw YAML formatting
|
|
184
|
-
const
|
|
261
|
+
it('retains valid raw YAML formatting across parent updates', () => {
|
|
262
|
+
const parsedTemplate = [{ Resources: { Queue: { Type: 'AWS::SQS::Queue' } } }];
|
|
263
|
+
const rawTemplateBody = '# queue template\nResources:\n Queue: { Type: AWS::SQS::Queue }\n';
|
|
264
|
+
const rendered = renderEditor({
|
|
185
265
|
capabilities: [],
|
|
186
266
|
cloudProvider: 'aws',
|
|
187
267
|
parameters: {},
|
|
268
|
+
refId: '1',
|
|
188
269
|
regions: [],
|
|
189
270
|
source: 'text',
|
|
190
271
|
tags: {},
|
|
191
272
|
templateBody: [{ Resources: {} }],
|
|
192
|
-
};
|
|
193
|
-
const parsedTemplate = [{ Resources: { Queue: { Type: 'AWS::SQS::Queue' } } }];
|
|
194
|
-
const rawTemplateBody = '# queue template\nResources:\n Queue: { Type: AWS::SQS::Queue }\n';
|
|
195
|
-
const { updateStageField, wrapper } = mountEditor(stage);
|
|
196
|
-
|
|
197
|
-
wrapper.find(YamlEditor).prop('onChange')(rawTemplateBody, parsedTemplate);
|
|
198
|
-
wrapper.setProps({
|
|
199
|
-
stage: { type: 'deployCloudFormation', ...stage, templateBody: parsedTemplate },
|
|
200
273
|
});
|
|
274
|
+
const editor = screen.getByRole('textbox', { name: 'CloudFormation template YAML' });
|
|
275
|
+
|
|
276
|
+
fireEvent.change(editor, { target: { value: rawTemplateBody } });
|
|
277
|
+
expect(rendered.updateStageField).toHaveBeenCalledWith({ templateBody: parsedTemplate });
|
|
278
|
+
rendered.replaceStage({ ...rendered.initialStage, templateBody: parsedTemplate });
|
|
201
279
|
|
|
202
|
-
expect(
|
|
203
|
-
expect(wrapper.find(YamlEditor).prop('value')).toBe(rawTemplateBody);
|
|
204
|
-
wrapper.unmount();
|
|
280
|
+
expect(screen.getByRole('textbox', { name: 'CloudFormation template YAML' })).toHaveValue(rawTemplateBody);
|
|
205
281
|
});
|
|
206
282
|
|
|
207
|
-
it('retains invalid raw YAML
|
|
208
|
-
const
|
|
283
|
+
it('retains invalid raw YAML without changing the persisted template', () => {
|
|
284
|
+
const rawTemplateBody = '# incomplete edit\nResources: [';
|
|
285
|
+
const rendered = renderEditor({
|
|
209
286
|
capabilities: [],
|
|
210
287
|
cloudProvider: 'aws',
|
|
211
288
|
parameters: {},
|
|
289
|
+
refId: '1',
|
|
212
290
|
regions: [],
|
|
213
291
|
source: 'text',
|
|
214
292
|
tags: {},
|
|
215
293
|
templateBody: [{ Resources: {} }],
|
|
216
|
-
};
|
|
217
|
-
const rawTemplateBody = '# incomplete edit\nResources: [';
|
|
218
|
-
const { updateStageField, wrapper } = mountEditor(stage);
|
|
294
|
+
});
|
|
219
295
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
stage: { type: 'deployCloudFormation', ...stage },
|
|
296
|
+
fireEvent.change(screen.getByRole('textbox', { name: 'CloudFormation template YAML' }), {
|
|
297
|
+
target: { value: rawTemplateBody },
|
|
223
298
|
});
|
|
299
|
+
rendered.replaceStage({ ...rendered.initialStage });
|
|
224
300
|
|
|
225
|
-
expect(updateStageField).not.toHaveBeenCalled();
|
|
226
|
-
expect(
|
|
227
|
-
wrapper.unmount();
|
|
301
|
+
expect(rendered.updateStageField).not.toHaveBeenCalled();
|
|
302
|
+
expect(screen.getByRole('textbox', { name: 'CloudFormation template YAML' })).toHaveValue(rawTemplateBody);
|
|
228
303
|
});
|
|
229
304
|
|
|
230
|
-
it('resets raw YAML when
|
|
231
|
-
const
|
|
305
|
+
it('resets raw YAML when refId changes without updating the new stage', () => {
|
|
306
|
+
const rendered = renderEditor({
|
|
232
307
|
capabilities: [],
|
|
233
308
|
cloudProvider: 'aws',
|
|
234
309
|
parameters: {},
|
|
235
|
-
refId: '
|
|
310
|
+
refId: 'stage-a',
|
|
236
311
|
regions: [],
|
|
237
312
|
source: 'text',
|
|
238
313
|
tags: {},
|
|
239
314
|
templateBody: [{ Resources: {} }],
|
|
240
|
-
};
|
|
241
|
-
const firstRawTemplateBody = '# first stage\nResources:\n First: {}\n';
|
|
242
|
-
const secondRawTemplateBody = '# second stage\nResources:\n Second: {}\n';
|
|
243
|
-
const secondParsedTemplate = [{ Resources: { Second: {} } }];
|
|
244
|
-
const { updateStageField, wrapper } = mountEditor(firstStage);
|
|
245
|
-
|
|
246
|
-
wrapper.find(YamlEditor).prop('onChange')(firstRawTemplateBody, [{ Resources: { First: {} } }]);
|
|
247
|
-
updateStageField.calls.reset();
|
|
248
|
-
wrapper.setProps({
|
|
249
|
-
stage: {
|
|
250
|
-
type: 'deployCloudFormation',
|
|
251
|
-
...firstStage,
|
|
252
|
-
refId: '2',
|
|
253
|
-
templateBody: secondRawTemplateBody,
|
|
254
|
-
},
|
|
255
315
|
});
|
|
316
|
+
fireEvent.change(screen.getByRole('textbox', { name: 'CloudFormation template YAML' }), {
|
|
317
|
+
target: { value: '# first stage\nResources:\n First: {}\n' },
|
|
318
|
+
});
|
|
319
|
+
rendered.updateStageField.mockClear();
|
|
256
320
|
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
wrapper.find(YamlEditor).prop('onChange')(secondRawTemplateBody, secondParsedTemplate);
|
|
321
|
+
const secondRawTemplateBody = '# second stage\nResources:\n Second: {}\n';
|
|
322
|
+
rendered.replaceStage({ ...rendered.initialStage, refId: 'stage-b', templateBody: secondRawTemplateBody });
|
|
261
323
|
|
|
262
|
-
expect(
|
|
263
|
-
|
|
324
|
+
expect(screen.getByRole('textbox', { name: 'CloudFormation template YAML' })).toHaveValue(secondRawTemplateBody);
|
|
325
|
+
expect(rendered.updateStageField).not.toHaveBeenCalled();
|
|
264
326
|
});
|
|
265
327
|
|
|
266
|
-
it('
|
|
267
|
-
const
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
328
|
+
it('selects an expected artifact through the public selector', () => {
|
|
329
|
+
const expectedArtifact = {
|
|
330
|
+
displayName: 'Pipeline template',
|
|
331
|
+
id: 'replacement-id',
|
|
332
|
+
matchArtifact: { artifactAccount: 'artifact-account', type: 's3/object' },
|
|
333
|
+
};
|
|
334
|
+
const rendered = renderEditor(
|
|
335
|
+
{
|
|
336
|
+
capabilities: [],
|
|
337
|
+
cloudProvider: 'aws',
|
|
338
|
+
parameters: {},
|
|
339
|
+
regions: [],
|
|
340
|
+
source: 'artifact',
|
|
341
|
+
tags: {},
|
|
342
|
+
},
|
|
343
|
+
{},
|
|
344
|
+
{ expectedArtifacts: [expectedArtifact] },
|
|
345
|
+
);
|
|
346
|
+
rendered.updateStageField.mockClear();
|
|
271
347
|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
}
|
|
276
|
-
wrapper.find(MapEditor).at(0).prop('onChange')(parameters, false);
|
|
277
|
-
wrapper.find(MapEditor).at(1).prop('onChange')(tags, false);
|
|
278
|
-
wrapper.find(ReactSelectInput).prop('onChange')({ target: { value: capabilities } } as any);
|
|
348
|
+
const selector = within(getFormGroupByLabel('Expected Artifact')).getByRole('combobox');
|
|
349
|
+
fireEvent.keyDown(selector, { key: 'ArrowDown', keyCode: 40 });
|
|
350
|
+
fireEvent.mouseDown(screen.getByText('Pipeline template'));
|
|
279
351
|
|
|
280
|
-
expect(updateStageField
|
|
352
|
+
expect(rendered.updateStageField).toHaveBeenCalledWith({
|
|
353
|
+
stackArtifactId: 'replacement-id',
|
|
354
|
+
stackArtifactAccount: 'artifact-account',
|
|
355
|
+
stackArtifact: null,
|
|
356
|
+
});
|
|
281
357
|
});
|
|
282
358
|
|
|
283
|
-
it('
|
|
284
|
-
const
|
|
285
|
-
|
|
359
|
+
it('starts editing an inline artifact through the public selector', () => {
|
|
360
|
+
const rendered = renderEditor({
|
|
361
|
+
capabilities: [],
|
|
362
|
+
cloudProvider: 'aws',
|
|
363
|
+
parameters: {},
|
|
364
|
+
regions: [],
|
|
286
365
|
source: 'artifact',
|
|
287
|
-
|
|
288
|
-
stackArtifact,
|
|
366
|
+
tags: {},
|
|
289
367
|
});
|
|
290
|
-
|
|
368
|
+
rendered.updateStageField.mockClear();
|
|
291
369
|
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
}
|
|
296
|
-
expect(selector.prop('expectedArtifactId')).toBe('expected-artifact-id');
|
|
297
|
-
expect(selector.prop('artifact')).toBe(stackArtifact);
|
|
298
|
-
selector.prop('onExpectedArtifactSelected')({
|
|
299
|
-
id: 'replacement-id',
|
|
300
|
-
matchArtifact: { artifactAccount: 'artifact-account' },
|
|
301
|
-
} as any);
|
|
302
|
-
selector.prop('onArtifactEdited')({ type: 'http/file', reference: 'https://example.test/template.yml' } as any);
|
|
370
|
+
const selector = within(getFormGroupByLabel('Expected Artifact')).getByRole('combobox');
|
|
371
|
+
fireEvent.keyDown(selector, { key: 'ArrowDown', keyCode: 40 });
|
|
372
|
+
fireEvent.mouseDown(screen.getByText('Define a new artifact...'));
|
|
303
373
|
|
|
304
|
-
expect(updateStageField
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
stackArtifactId: null,
|
|
309
|
-
stackArtifact: { type: 'http/file', reference: 'https://example.test/template.yml' },
|
|
310
|
-
},
|
|
311
|
-
],
|
|
312
|
-
]);
|
|
374
|
+
expect(rendered.updateStageField).toHaveBeenCalledWith({
|
|
375
|
+
stackArtifactId: null,
|
|
376
|
+
stackArtifact: expect.objectContaining({ customKind: true }),
|
|
377
|
+
});
|
|
313
378
|
});
|
|
314
379
|
|
|
315
|
-
it('
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
expect(selector.exists()).toBe(true);
|
|
320
|
-
if (!selector.exists()) {
|
|
321
|
-
return;
|
|
322
|
-
}
|
|
323
|
-
selector.prop('onExpectedArtifactSelected')({
|
|
324
|
-
id: 'expected-artifact-id',
|
|
325
|
-
matchArtifact: { artifactAccount: 'artifact-account' },
|
|
326
|
-
} as any);
|
|
327
|
-
wrapper.find('input[name="source"][value="text"]').simulate('change');
|
|
328
|
-
|
|
329
|
-
expect(updateStageField.calls.allArgs()).toEqual([
|
|
330
|
-
[
|
|
331
|
-
{
|
|
332
|
-
stackArtifactId: 'expected-artifact-id',
|
|
333
|
-
stackArtifactAccount: 'artifact-account',
|
|
334
|
-
stackArtifact: null,
|
|
335
|
-
},
|
|
336
|
-
],
|
|
337
|
-
[
|
|
338
|
-
{
|
|
339
|
-
source: 'text',
|
|
340
|
-
stackArtifactId: null,
|
|
341
|
-
stackArtifactAccount: null,
|
|
342
|
-
stackArtifact: null,
|
|
343
|
-
},
|
|
344
|
-
],
|
|
380
|
+
it('forwards the exact concrete inline artifact after editing its reference', async () => {
|
|
381
|
+
vi.spyOn(AccountService, 'getArtifactAccounts').mockResolvedValue([
|
|
382
|
+
{ name: 'custom-artifact', types: ['custom/object'] },
|
|
345
383
|
]);
|
|
346
|
-
|
|
384
|
+
const rendered = renderEditor({
|
|
385
|
+
capabilities: [],
|
|
386
|
+
cloudProvider: 'aws',
|
|
387
|
+
parameters: {},
|
|
388
|
+
regions: [],
|
|
389
|
+
source: 'artifact',
|
|
390
|
+
tags: {},
|
|
391
|
+
});
|
|
392
|
+
rendered.updateStageField.mockClear();
|
|
347
393
|
|
|
348
|
-
|
|
349
|
-
|
|
394
|
+
const selector = within(getFormGroupByLabel('Expected Artifact')).getByRole('combobox');
|
|
395
|
+
fireEvent.keyDown(selector, { key: 'ArrowDown', keyCode: 40 });
|
|
396
|
+
fireEvent.mouseDown(screen.getByText('Define a new artifact...'));
|
|
350
397
|
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
}
|
|
360
|
-
);
|
|
398
|
+
const expectedArtifactGroup = getFormGroupByLabel('Expected Artifact');
|
|
399
|
+
await waitFor(() => getFormGroupByLabel('Reference', expectedArtifactGroup));
|
|
400
|
+
fireEvent.change(within(getFormGroupByLabel('Type', expectedArtifactGroup)).getByRole('textbox'), {
|
|
401
|
+
target: { value: 's3/object' },
|
|
402
|
+
});
|
|
403
|
+
const currentArtifact = rendered.updateStageField.mock.lastCall?.[0].stackArtifact;
|
|
404
|
+
rendered.updateStageField.mockClear();
|
|
405
|
+
fireEvent.change(within(getFormGroupByLabel('Reference', expectedArtifactGroup)).getByRole('textbox'), {
|
|
406
|
+
target: { value: 's3://templates/production.yml' },
|
|
407
|
+
});
|
|
408
|
+
|
|
409
|
+
const expectedUpdate = {
|
|
410
|
+
stackArtifactId: null,
|
|
411
|
+
stackArtifact: {
|
|
412
|
+
...currentArtifact,
|
|
413
|
+
artifactAccount: 'custom-artifact',
|
|
414
|
+
customKind: true,
|
|
415
|
+
reference: 's3://templates/production.yml',
|
|
416
|
+
type: 's3/object',
|
|
417
|
+
},
|
|
418
|
+
};
|
|
419
|
+
expect(rendered.updateStageField).toHaveBeenCalled();
|
|
420
|
+
rendered.updateStageField.mock.calls.forEach(([update]) => expect(update).toStrictEqual(expectedUpdate));
|
|
361
421
|
});
|
|
362
422
|
|
|
363
|
-
it('updates
|
|
364
|
-
const
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
updateStageField,
|
|
374
|
-
} as any)}
|
|
375
|
-
/>,
|
|
376
|
-
);
|
|
423
|
+
it('updates capabilities through the public selector', () => {
|
|
424
|
+
const rendered = renderEditor({
|
|
425
|
+
capabilities: [],
|
|
426
|
+
cloudProvider: 'aws',
|
|
427
|
+
parameters: {},
|
|
428
|
+
regions: [],
|
|
429
|
+
source: 'text',
|
|
430
|
+
tags: {},
|
|
431
|
+
});
|
|
432
|
+
rendered.updateStageField.mockClear();
|
|
377
433
|
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
.prop('helpKey'),
|
|
384
|
-
).toBe('aws.cloudformation.changeSet.options');
|
|
385
|
-
let contractError: Error;
|
|
386
|
-
try {
|
|
387
|
-
wrapper.find(TextInput).prop('onChange')({ target: { value: 'new-change-set' } } as any);
|
|
388
|
-
wrapper.find(CheckboxInput).prop('onChange')({ target: { checked: false } } as any);
|
|
389
|
-
wrapper.find(ReactSelectInput).prop('onChange')({ target: { value: 'skip' } } as any);
|
|
390
|
-
} catch (error) {
|
|
391
|
-
contractError = error;
|
|
392
|
-
}
|
|
393
|
-
expect(contractError).toBeUndefined();
|
|
394
|
-
if (contractError) {
|
|
395
|
-
return;
|
|
396
|
-
}
|
|
397
|
-
expect(updateStageField.calls.allArgs()).toEqual([
|
|
398
|
-
[{ changeSetName: 'new-change-set' }],
|
|
399
|
-
[{ executeChangeSet: false }],
|
|
400
|
-
[{ actionOnReplacement: 'skip' }],
|
|
401
|
-
]);
|
|
434
|
+
const selector = within(getFormGroupByLabel('Capabilities')).getByRole('combobox');
|
|
435
|
+
fireEvent.keyDown(selector, { key: 'ArrowDown', keyCode: 40 });
|
|
436
|
+
fireEvent.mouseDown(screen.getByText('CAPABILITY_NAMED_IAM'));
|
|
437
|
+
|
|
438
|
+
expect(rendered.updateStageField).toHaveBeenCalledWith({ capabilities: ['CAPABILITY_NAMED_IAM'] });
|
|
402
439
|
});
|
|
403
440
|
});
|