@spinnaker/amazon 2026.3.1 → 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,11 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import { hashLocationPlugin, servicesPlugin, UIRouterContext, UIRouterReact, UIViewContext } from '@uirouter/react';
|
|
2
3
|
import React from 'react';
|
|
3
4
|
|
|
5
|
+
import { AccountService } from '@spinnaker/core';
|
|
4
6
|
import { mockInstance } from '@spinnaker/mocks';
|
|
5
7
|
|
|
6
8
|
import { InstanceInformation } from './InstanceInformation';
|
|
7
9
|
|
|
8
10
|
describe('InstanceInformation', () => {
|
|
11
|
+
let router: UIRouterReact;
|
|
9
12
|
const testInstance = {
|
|
10
13
|
...mockInstance,
|
|
11
14
|
instanceType: 'm5.large',
|
|
@@ -14,8 +17,36 @@ describe('InstanceInformation', () => {
|
|
|
14
17
|
serverGroup: 'test_sg',
|
|
15
18
|
};
|
|
16
19
|
|
|
20
|
+
const expectValue = (label: string, value: string) => {
|
|
21
|
+
const term = screen.getByText(label, { selector: 'dt' });
|
|
22
|
+
expect(term.nextElementSibling).toHaveTextContent(value);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const renderInformation = (component: React.ReactElement) =>
|
|
26
|
+
render(
|
|
27
|
+
<UIRouterContext.Provider value={router}>
|
|
28
|
+
<UIViewContext.Provider
|
|
29
|
+
value={{ fqn: 'application.instance', context: router.stateRegistry.get('application.instance') as any }}
|
|
30
|
+
>
|
|
31
|
+
{component}
|
|
32
|
+
</UIViewContext.Provider>
|
|
33
|
+
</UIRouterContext.Provider>,
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
beforeEach(() => {
|
|
37
|
+
vi.spyOn(AccountService, 'challengeDestructiveActions').mockResolvedValue(false);
|
|
38
|
+
router = new UIRouterReact();
|
|
39
|
+
router.plugin(servicesPlugin);
|
|
40
|
+
router.plugin(hashLocationPlugin);
|
|
41
|
+
['application', 'application.instance', 'application.serverGroup'].forEach((name) =>
|
|
42
|
+
router.stateRegistry.register({ name, url: `/${name.split('.').pop()}` }),
|
|
43
|
+
);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
afterEach(() => router.dispose());
|
|
47
|
+
|
|
17
48
|
it('should render correct state when all attributes exist', () => {
|
|
18
|
-
|
|
49
|
+
renderInformation(
|
|
19
50
|
<InstanceInformation
|
|
20
51
|
account={testInstance.account}
|
|
21
52
|
availabilityZone={testInstance.availabilityZone}
|
|
@@ -29,22 +60,15 @@ describe('InstanceInformation', () => {
|
|
|
29
60
|
/>,
|
|
30
61
|
);
|
|
31
62
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
expect(
|
|
37
|
-
expect(wrapper.childAt(2).prop('label')).toEqual('Type');
|
|
38
|
-
expect(wrapper.childAt(3).prop('label')).toEqual('Capacity Type');
|
|
39
|
-
expect(wrapper.childAt(4).prop('label')).toEqual('Server Group');
|
|
40
|
-
|
|
41
|
-
expect(wrapper.childAt(0).prop('value')).toEqual('1970-01-14 22:37:37 PST');
|
|
42
|
-
expect(wrapper.childAt(2).prop('value')).toEqual(testInstance.instanceType);
|
|
43
|
-
expect(wrapper.childAt(3).prop('value')).toEqual(testInstance.capacityType);
|
|
63
|
+
expectValue('Launched', '1970-01-14 22:37:37 PST');
|
|
64
|
+
expectValue('In', testInstance.availabilityZone);
|
|
65
|
+
expectValue('Type', testInstance.instanceType);
|
|
66
|
+
expectValue('Capacity Type', testInstance.capacityType);
|
|
67
|
+
expect(screen.getByRole('link', { name: testInstance.serverGroup })).toBeInTheDocument();
|
|
44
68
|
});
|
|
45
69
|
|
|
46
70
|
it('should render correct state when attributes are missing', () => {
|
|
47
|
-
|
|
71
|
+
renderInformation(
|
|
48
72
|
<InstanceInformation
|
|
49
73
|
account={testInstance.account}
|
|
50
74
|
availabilityZone={undefined}
|
|
@@ -58,14 +82,10 @@ describe('InstanceInformation', () => {
|
|
|
58
82
|
/>,
|
|
59
83
|
);
|
|
60
84
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
expect(
|
|
65
|
-
expect(
|
|
66
|
-
expect(wrapper.childAt(2).prop('label')).toEqual('Type');
|
|
67
|
-
|
|
68
|
-
expect(wrapper.childAt(0).prop('value')).toEqual('Unknown');
|
|
69
|
-
expect(wrapper.childAt(2).prop('value')).toEqual('Unknown');
|
|
85
|
+
expectValue('Launched', 'Unknown');
|
|
86
|
+
expectValue('In', 'Unknown');
|
|
87
|
+
expectValue('Type', 'Unknown');
|
|
88
|
+
expect(screen.queryByText('Capacity Type', { selector: 'dt' })).not.toBeInTheDocument();
|
|
89
|
+
expect(screen.queryByText('Server Group', { selector: 'dt' })).not.toBeInTheDocument();
|
|
70
90
|
});
|
|
71
91
|
});
|
|
@@ -4,7 +4,7 @@ describe('AmazonLoadBalancersTag', () => {
|
|
|
4
4
|
it('opens load balancer and target group details through the injected state service', () => {
|
|
5
5
|
const stateService = {
|
|
6
6
|
current: { name: 'home.applications.application.insight.clusters' },
|
|
7
|
-
go:
|
|
7
|
+
go: vi.fn(),
|
|
8
8
|
};
|
|
9
9
|
const component = new AmazonLoadBalancersTagComponent({
|
|
10
10
|
application: {},
|
|
@@ -4,7 +4,7 @@ describe('TargetGroupDetails', () => {
|
|
|
4
4
|
let stateService: any;
|
|
5
5
|
|
|
6
6
|
beforeEach(() => {
|
|
7
|
-
stateService = { params: {}, go:
|
|
7
|
+
stateService = { params: {}, go: vi.fn() };
|
|
8
8
|
});
|
|
9
9
|
|
|
10
10
|
function buildComponent(loadBalancers: any[]): TargetGroupDetails {
|
|
@@ -64,7 +64,7 @@ describe('TargetGroupDetails', () => {
|
|
|
64
64
|
targetGroups: [{ name: 'test-target-group' }],
|
|
65
65
|
},
|
|
66
66
|
]);
|
|
67
|
-
spyOn(component, 'setState');
|
|
67
|
+
vi.spyOn(component, 'setState').mockReturnValue(undefined);
|
|
68
68
|
|
|
69
69
|
component.componentWillUnmount();
|
|
70
70
|
(component as any).extractTargetGroup();
|
|
@@ -84,8 +84,8 @@ describe('TargetGroupDetails', () => {
|
|
|
84
84
|
const app = {
|
|
85
85
|
getDataSource: () => ({
|
|
86
86
|
data: [],
|
|
87
|
-
ready:
|
|
88
|
-
onRefresh:
|
|
87
|
+
ready: vi.fn().mockReturnValue(rejectedReadiness),
|
|
88
|
+
onRefresh: vi.fn(),
|
|
89
89
|
}),
|
|
90
90
|
} as any;
|
|
91
91
|
const component = new TargetGroupDetails({
|
|
@@ -104,7 +104,7 @@ describe('TargetGroupDetails', () => {
|
|
|
104
104
|
region: 'us-west-2',
|
|
105
105
|
},
|
|
106
106
|
});
|
|
107
|
-
spyOn(component, 'setState');
|
|
107
|
+
vi.spyOn(component, 'setState').mockReturnValue(undefined);
|
|
108
108
|
|
|
109
109
|
component.componentDidMount();
|
|
110
110
|
|
|
@@ -35,7 +35,7 @@ export class TargetGroups
|
|
|
35
35
|
implements IWizardPageComponent<IAmazonApplicationLoadBalancerUpsertCommand> {
|
|
36
36
|
public protocols = ['HTTP', 'HTTPS'];
|
|
37
37
|
public targetTypes = ['instance', 'ip', 'lambda'];
|
|
38
|
-
private destroy$ = new Subject();
|
|
38
|
+
private destroy$ = new Subject<void>();
|
|
39
39
|
|
|
40
40
|
constructor(props: ITargetGroupsProps) {
|
|
41
41
|
super(props);
|
|
@@ -4,7 +4,7 @@ import { SecurityGroups } from './SecurityGroups';
|
|
|
4
4
|
|
|
5
5
|
describe('SecurityGroups', () => {
|
|
6
6
|
it('renders when the security group cache has not been registered', () => {
|
|
7
|
-
spyOn(InfrastructureCaches, 'get').
|
|
7
|
+
vi.spyOn(InfrastructureCaches, 'get').mockReturnValue(undefined);
|
|
8
8
|
|
|
9
9
|
expect(() => new SecurityGroups(buildProps() as any)).not.toThrow();
|
|
10
10
|
});
|
|
@@ -19,9 +19,9 @@ function buildProps() {
|
|
|
19
19
|
securityGroups: [],
|
|
20
20
|
vpcId: 'vpc-1',
|
|
21
21
|
},
|
|
22
|
-
setFieldValue:
|
|
23
|
-
validateForm:
|
|
22
|
+
setFieldValue: vi.fn(),
|
|
23
|
+
validateForm: vi.fn(),
|
|
24
24
|
},
|
|
25
|
-
onLoadingChanged:
|
|
25
|
+
onLoadingChanged: vi.fn(),
|
|
26
26
|
};
|
|
27
27
|
}
|
|
@@ -37,7 +37,7 @@ export class TargetGroups
|
|
|
37
37
|
public protocols = ['TCP', 'UDP'];
|
|
38
38
|
public healthProtocols = ['TCP', 'HTTP', 'HTTPS'];
|
|
39
39
|
public targetTypes = ['instance', 'ip'];
|
|
40
|
-
private destroy$ = new Subject();
|
|
40
|
+
private destroy$ = new Subject<void>();
|
|
41
41
|
|
|
42
42
|
constructor(props: ITargetGroupsProps) {
|
|
43
43
|
super(props);
|
|
@@ -1,32 +1,25 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { act, waitFor } from '@testing-library/react';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { act } from 'react-dom/test-utils';
|
|
4
3
|
import { BehaviorSubject } from 'rxjs';
|
|
5
4
|
|
|
6
5
|
import { DeckRuntimeContext } from '@spinnaker/core';
|
|
6
|
+
import { renderHookHarness } from '../../../../core/src/utils/testUtils/hookHarness';
|
|
7
7
|
|
|
8
8
|
import { useAmazonLoadBalancerDetails } from './amazonLoadBalancerDetails';
|
|
9
9
|
import { RequestBuilder } from '../../../../core/src/api/ApiService';
|
|
10
10
|
|
|
11
11
|
describe('useAmazonLoadBalancerDetails', () => {
|
|
12
|
-
const flush = () => new Promise((resolve) => setTimeout(resolve, 0));
|
|
13
12
|
const defaultHttpClient = RequestBuilder.defaultHttpClient;
|
|
14
|
-
let wrapper: ReactWrapper | undefined;
|
|
15
13
|
let runtimeServices: any;
|
|
16
14
|
const RuntimeWrapper = ({ children }: React.PropsWithChildren<{}>) => (
|
|
17
15
|
<DeckRuntimeContext.Provider value={{ services: runtimeServices } as any}>{children}</DeckRuntimeContext.Provider>
|
|
18
16
|
);
|
|
19
|
-
const mount = (component: React.ReactElement) => enzymeMount(component, { wrappingComponent: RuntimeWrapper });
|
|
20
17
|
|
|
21
18
|
beforeEach(() => {
|
|
22
19
|
runtimeServices = {};
|
|
23
20
|
});
|
|
24
21
|
|
|
25
22
|
afterEach(() => {
|
|
26
|
-
if (wrapper) {
|
|
27
|
-
wrapper.unmount();
|
|
28
|
-
wrapper = undefined;
|
|
29
|
-
}
|
|
30
23
|
RequestBuilder.defaultHttpClient = defaultHttpClient;
|
|
31
24
|
});
|
|
32
25
|
|
|
@@ -46,36 +39,25 @@ describe('useAmazonLoadBalancerDetails', () => {
|
|
|
46
39
|
data: [loadBalancer],
|
|
47
40
|
});
|
|
48
41
|
const app = {
|
|
49
|
-
getDataSource:
|
|
42
|
+
getDataSource: vi.fn().mockReturnValue({
|
|
50
43
|
status$,
|
|
51
|
-
refresh:
|
|
44
|
+
refresh: vi.fn(),
|
|
52
45
|
}),
|
|
53
46
|
} as any;
|
|
54
|
-
const get =
|
|
47
|
+
const get = vi.fn().mockReturnValue(new Promise(() => undefined));
|
|
55
48
|
RequestBuilder.defaultHttpClient = { get } as any;
|
|
56
49
|
runtimeServices.securityGroupReader = {
|
|
57
|
-
getApplicationSecurityGroup:
|
|
50
|
+
getApplicationSecurityGroup: vi.fn(),
|
|
58
51
|
};
|
|
59
52
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
await act(async () => {
|
|
70
|
-
wrapper = mount(<TestComponent />);
|
|
71
|
-
await flush();
|
|
72
|
-
});
|
|
73
|
-
wrapper.update();
|
|
74
|
-
|
|
75
|
-
await act(async () => {
|
|
76
|
-
await flush();
|
|
77
|
-
});
|
|
78
|
-
wrapper.update();
|
|
53
|
+
const props = {
|
|
54
|
+
app,
|
|
55
|
+
loadBalancerParams: { accountId: 'test', name: 'frontend', provider: 'aws', region: 'us-east-1' },
|
|
56
|
+
autoClose: () => undefined,
|
|
57
|
+
} as any;
|
|
58
|
+
const hook = renderHookHarness(useAmazonLoadBalancerDetails, props, { wrapper: RuntimeWrapper });
|
|
59
|
+
await waitFor(() => expect(get).toHaveBeenCalledTimes(1));
|
|
60
|
+
hook.rerenderHook({ ...props, autoClose: () => undefined });
|
|
79
61
|
|
|
80
62
|
expect(get).toHaveBeenCalledTimes(1);
|
|
81
63
|
});
|
|
@@ -96,46 +78,42 @@ describe('useAmazonLoadBalancerDetails', () => {
|
|
|
96
78
|
data: [loadBalancer],
|
|
97
79
|
});
|
|
98
80
|
const app = {
|
|
99
|
-
getDataSource:
|
|
81
|
+
getDataSource: vi.fn().mockReturnValue({
|
|
100
82
|
status$,
|
|
101
|
-
refresh:
|
|
83
|
+
refresh: vi.fn(),
|
|
102
84
|
}),
|
|
103
85
|
} as any;
|
|
104
86
|
let resolveDetails: (details: any[]) => void = () => undefined;
|
|
105
87
|
const detailsRequest = new Promise<any[]>((resolve) => {
|
|
106
88
|
resolveDetails = resolve;
|
|
107
89
|
});
|
|
108
|
-
const get =
|
|
109
|
-
const consoleError = spyOn(console, 'error');
|
|
90
|
+
const get = vi.fn().mockReturnValue(detailsRequest);
|
|
91
|
+
const consoleError = vi.spyOn(console, 'error').mockReturnValue(undefined);
|
|
110
92
|
RequestBuilder.defaultHttpClient = { get } as any;
|
|
111
93
|
runtimeServices.securityGroupReader = {
|
|
112
|
-
getApplicationSecurityGroup:
|
|
94
|
+
getApplicationSecurityGroup: vi.fn(),
|
|
113
95
|
};
|
|
114
96
|
|
|
115
|
-
|
|
116
|
-
useAmazonLoadBalancerDetails
|
|
97
|
+
const hook = renderHookHarness(
|
|
98
|
+
useAmazonLoadBalancerDetails,
|
|
99
|
+
{
|
|
117
100
|
app,
|
|
118
101
|
loadBalancerParams: { accountId: 'test', name: 'frontend', provider: 'aws', region: 'us-east-1' },
|
|
119
102
|
autoClose: () => undefined,
|
|
120
|
-
} as any
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
wrapper = mount(<TestComponent />);
|
|
126
|
-
await flush();
|
|
127
|
-
});
|
|
128
|
-
wrapper.unmount();
|
|
129
|
-
wrapper = undefined;
|
|
103
|
+
} as any,
|
|
104
|
+
{ wrapper: RuntimeWrapper },
|
|
105
|
+
);
|
|
106
|
+
await waitFor(() => expect(get).toHaveBeenCalledTimes(1));
|
|
107
|
+
hook.unmount();
|
|
130
108
|
|
|
131
109
|
await act(async () => {
|
|
132
110
|
resolveDetails([]);
|
|
133
|
-
await
|
|
111
|
+
await detailsRequest;
|
|
134
112
|
});
|
|
135
113
|
|
|
136
|
-
const unmountedStateUpdateWarning = consoleError.calls
|
|
137
|
-
.
|
|
138
|
-
|
|
114
|
+
const unmountedStateUpdateWarning = consoleError.mock.calls.some(([message]) =>
|
|
115
|
+
String(message).includes('unmounted component'),
|
|
116
|
+
);
|
|
139
117
|
expect(unmountedStateUpdateWarning).toBe(false);
|
|
140
118
|
});
|
|
141
119
|
});
|
|
@@ -1,29 +1,27 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { act, render, screen, waitFor, within } from '@testing-library/react';
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import type { Mock } from 'vitest';
|
|
4
|
+
|
|
3
5
|
import { AccountService } from '@spinnaker/core';
|
|
4
6
|
|
|
5
7
|
import { AmazonStageConfig, getAmazonStageFields } from './AmazonStageConfig';
|
|
8
|
+
import { getFormGroupByLabel } from '../../../../core/src/utils/testUtils/rtl';
|
|
6
9
|
|
|
7
10
|
describe('AmazonStageConfig', () => {
|
|
8
11
|
beforeEach(() => {
|
|
9
|
-
spyOn(AccountService, 'listAccounts').
|
|
10
|
-
spyOn(AccountService, 'getUniqueAttributeForAllAccounts').
|
|
11
|
-
spyOn(AccountService, 'getAllAccountDetailsForProvider').
|
|
12
|
+
vi.spyOn(AccountService, 'listAccounts').mockResolvedValue([{ name: 'test', type: 'aws' }] as any);
|
|
13
|
+
vi.spyOn(AccountService, 'getUniqueAttributeForAllAccounts').mockResolvedValue(['us-east-1'] as any);
|
|
14
|
+
vi.spyOn(AccountService, 'getAllAccountDetailsForProvider').mockResolvedValue([] as any);
|
|
12
15
|
});
|
|
13
16
|
|
|
14
|
-
function renderStage(
|
|
15
|
-
const application = {
|
|
16
|
-
|
|
17
|
-
defaultRegions: {},
|
|
18
|
-
getDataSource: () => ({ data: [] }),
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
return mount(
|
|
17
|
+
function renderStage(stageOverrides: any = {}) {
|
|
18
|
+
const application = { defaultCredentials: {}, defaultRegions: {}, getDataSource: () => ({ data: [] }) };
|
|
19
|
+
return render(
|
|
22
20
|
<AmazonStageConfig
|
|
23
21
|
application={application as any}
|
|
24
22
|
pipeline={{} as any}
|
|
25
|
-
stage={{ type: 'destroyServerGroup', cloudProviderType: 'aws', ...
|
|
26
|
-
updateStageField={
|
|
23
|
+
stage={{ type: 'destroyServerGroup', cloudProviderType: 'aws', ...stageOverrides }}
|
|
24
|
+
updateStageField={vi.fn() as any}
|
|
27
25
|
/>,
|
|
28
26
|
);
|
|
29
27
|
}
|
|
@@ -50,53 +48,46 @@ describe('AmazonStageConfig', () => {
|
|
|
50
48
|
'upsertImageTags',
|
|
51
49
|
];
|
|
52
50
|
const fallbackFields = getAmazonStageFields({ type: 'unknown' });
|
|
53
|
-
const genericStageTypes = [...simpleStageTypes, ...dedicatedStageTypes].filter(
|
|
54
|
-
(type) => getAmazonStageFields({ type }) !== fallbackFields,
|
|
55
|
-
);
|
|
56
51
|
|
|
57
|
-
expect(
|
|
52
|
+
expect(
|
|
53
|
+
[...simpleStageTypes, ...dedicatedStageTypes].filter((type) => getAmazonStageFields({ type }) !== fallbackFields),
|
|
54
|
+
).toEqual(simpleStageTypes);
|
|
58
55
|
});
|
|
59
56
|
|
|
60
|
-
it('renders account as a selector for target server group stages', () => {
|
|
61
|
-
|
|
57
|
+
it('renders account as a selector for target server group stages', async () => {
|
|
58
|
+
renderStage({ credentials: 'test' });
|
|
62
59
|
|
|
63
|
-
expect(
|
|
64
|
-
expect(
|
|
60
|
+
await waitFor(() => expect(within(getFormGroupByLabel('Account')).getByRole('combobox')).toHaveValue('test'));
|
|
61
|
+
expect(within(getFormGroupByLabel('Account')).queryByRole('textbox')).not.toBeInTheDocument();
|
|
65
62
|
});
|
|
66
63
|
|
|
67
|
-
it('keeps server group target as a selector', () => {
|
|
68
|
-
|
|
64
|
+
it('keeps server group target as a selector', async () => {
|
|
65
|
+
renderStage({ target: 'current_asg' });
|
|
69
66
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
.exists(),
|
|
75
|
-
).toBe(true);
|
|
67
|
+
await waitFor(() =>
|
|
68
|
+
expect(within(getFormGroupByLabel('Server Group')).getByRole('combobox')).toHaveValue('current_asg'),
|
|
69
|
+
);
|
|
70
|
+
expect(screen.getByRole('option', { name: /current/i })).toHaveAttribute('value', 'current_asg');
|
|
76
71
|
});
|
|
77
72
|
|
|
78
73
|
it('does not update account and region state after unmount', async () => {
|
|
79
74
|
let resolveAccounts: (accounts: any[]) => void;
|
|
80
75
|
let resolveRegions: (regions: string[]) => void;
|
|
81
|
-
(AccountService.listAccounts as
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}) as any,
|
|
85
|
-
);
|
|
86
|
-
(AccountService.getUniqueAttributeForAllAccounts as jasmine.Spy).and.returnValue(
|
|
87
|
-
new Promise((resolve) => {
|
|
88
|
-
resolveRegions = resolve;
|
|
89
|
-
}) as any,
|
|
76
|
+
(AccountService.listAccounts as Mock).mockReturnValue(new Promise((resolve) => (resolveAccounts = resolve)) as any);
|
|
77
|
+
(AccountService.getUniqueAttributeForAllAccounts as Mock).mockReturnValue(
|
|
78
|
+
new Promise((resolve) => (resolveRegions = resolve)) as any,
|
|
90
79
|
);
|
|
91
|
-
spyOn(console, 'error');
|
|
80
|
+
const consoleError = vi.spyOn(console, 'error').mockReturnValue(undefined);
|
|
81
|
+
const rendered = renderStage();
|
|
82
|
+
rendered.unmount();
|
|
92
83
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
84
|
+
await act(async () => {
|
|
85
|
+
resolveAccounts!([{ name: 'test', type: 'aws' }]);
|
|
86
|
+
resolveRegions!(['us-east-1']);
|
|
87
|
+
await Promise.resolve();
|
|
88
|
+
});
|
|
98
89
|
|
|
99
|
-
expect(
|
|
90
|
+
expect(consoleError.mock.calls.join('\n')).not.toContain(
|
|
100
91
|
"Can't perform a React state update on an unmounted component",
|
|
101
92
|
);
|
|
102
93
|
});
|
|
@@ -202,6 +202,7 @@ export function DeployCloudFormationStackStageConfig({
|
|
|
202
202
|
|
|
203
203
|
{source === 'text' && (
|
|
204
204
|
<YamlEditor
|
|
205
|
+
ariaLabel="CloudFormation template YAML"
|
|
205
206
|
onChange={(raw, templateBody) => {
|
|
206
207
|
setTemplateEditorState({ refId: stage.refId, rawTemplateBody: raw });
|
|
207
208
|
if (templateBody !== null) {
|