From e8baf3fa990948247d663b9c176c800eaf8080d9 Mon Sep 17 00:00:00 2001 From: solovevayaroslavna Date: Tue, 18 Apr 2023 14:40:09 +0400 Subject: [PATCH] PMM-11795-postgresql-operator: configuration, NetworkAndSecurity, Operator, KubernetesInventory tests fix --- .../Configurations/Configurations.test.tsx | 6 ++- .../NetworkAndSecurity.test.tsx | 37 +++++++++++++++++-- .../NetworkAndSecurity/NetworkAndSecurity.tsx | 2 +- .../Kubernetes/KubernetesInventory.test.tsx | 2 + .../OperatorStatusRow/OperatorStatusRow.tsx | 2 +- 5 files changed, 42 insertions(+), 7 deletions(-) diff --git a/public/app/percona/dbaas/components/DBCluster/EditDBClusterPage/DBClusterAdvancedOptions/Configurations/Configurations.test.tsx b/public/app/percona/dbaas/components/DBCluster/EditDBClusterPage/DBClusterAdvancedOptions/Configurations/Configurations.test.tsx index 8e661ecde153e..50685fdc5655f 100644 --- a/public/app/percona/dbaas/components/DBCluster/EditDBClusterPage/DBClusterAdvancedOptions/Configurations/Configurations.test.tsx +++ b/public/app/percona/dbaas/components/DBCluster/EditDBClusterPage/DBClusterAdvancedOptions/Configurations/Configurations.test.tsx @@ -21,11 +21,13 @@ describe('DBClusterAdvancedOptions Configurations::', () => { ) ); expect(screen.getByTestId('configurations').querySelector('legend')).toHaveTextContent( - Messages.fieldSets.commonConfiguration + Messages.fieldSets.configuration(Databases.haproxy) ); expect(screen.getByTestId('storageClass-field-label')).toHaveTextContent(Messages.labels.storageClass); expect(screen.getByTestId('storageClass-field-container').querySelector('input')).toBeTruthy(); - expect(screen.getByTestId('configuration-field-label')).toHaveTextContent(Messages.labels.commonConfiguration); + expect(screen.getByTestId('configuration-field-label')).toHaveTextContent( + Messages.labels.configuration(Databases.haproxy) + ); expect(screen.getByTestId('configuration-textarea-input')).toBeInTheDocument(); }); diff --git a/public/app/percona/dbaas/components/DBCluster/EditDBClusterPage/NetworkAndSecurity/NetworkAndSecurity.test.tsx b/public/app/percona/dbaas/components/DBCluster/EditDBClusterPage/NetworkAndSecurity/NetworkAndSecurity.test.tsx index 1aefc1d021b89..085b65f588af3 100644 --- a/public/app/percona/dbaas/components/DBCluster/EditDBClusterPage/NetworkAndSecurity/NetworkAndSecurity.test.tsx +++ b/public/app/percona/dbaas/components/DBCluster/EditDBClusterPage/NetworkAndSecurity/NetworkAndSecurity.test.tsx @@ -3,6 +3,9 @@ import arrayMutators from 'final-form-arrays'; import React from 'react'; import { Form } from 'react-final-form'; +import { BasicOptionsFields } from 'app/percona/dbaas/components/DBCluster/EditDBClusterPage/DBClusterBasicOptions/DBClusterBasicOptions.types'; +import { Databases } from 'app/percona/shared/core'; + import NetworkAndSecurity from './NetworkAndSecurity'; import { Messages } from './NetworkAndSecurity.messages'; import { NetworkAndSecurityFields } from './NetworkAndSecurity.types'; @@ -11,7 +14,10 @@ describe('DBClusterAdvancedOptions NetworkAndSecurity::', () => { it('render items correctly for create and edit mode', () => { render(
} @@ -38,7 +44,10 @@ describe('DBClusterAdvancedOptions NetworkAndSecurity::', () => { it('the delete button should not delete the first field', () => { render( } @@ -58,7 +67,10 @@ describe('DBClusterAdvancedOptions NetworkAndSecurity::', () => { it('the delete button should delete field from the form if it is not the first one ', () => { render( } @@ -74,4 +86,23 @@ describe('DBClusterAdvancedOptions NetworkAndSecurity::', () => { fireEvent.click(deleteBtn); expect(screen.queryByTestId('sourceRanges[1].sourceRange-text-input')).not.toBeInTheDocument(); }); + it('source range field should be hidden whe database is postgreSQL ', () => { + render( + } + /> + ); + expect(screen.getByTestId('toggle-network-and-security')).toBeInTheDocument(); + const checkbox = screen.getByTestId('toggle-network-and-security'); + + fireEvent.click(checkbox); + + expect(screen.queryByTestId('source-ranges')).not.toBeInTheDocument(); + }); }); diff --git a/public/app/percona/dbaas/components/DBCluster/EditDBClusterPage/NetworkAndSecurity/NetworkAndSecurity.tsx b/public/app/percona/dbaas/components/DBCluster/EditDBClusterPage/NetworkAndSecurity/NetworkAndSecurity.tsx index f2967f99f1abf..9c0ed39da07c8 100644 --- a/public/app/percona/dbaas/components/DBCluster/EditDBClusterPage/NetworkAndSecurity/NetworkAndSecurity.tsx +++ b/public/app/percona/dbaas/components/DBCluster/EditDBClusterPage/NetworkAndSecurity/NetworkAndSecurity.tsx @@ -51,7 +51,7 @@ export const NetworkAndSecurity: FC = ({ form }) => { {databaseType.value !== Databases.postgresql && ( {({ fields }) => ( -
+