Skip to content

Commit

Permalink
upcoming: [DI-21138] - Dbass node type filter change
Browse files Browse the repository at this point in the history
  • Loading branch information
ankita-akamai committed Oct 16, 2024
1 parent c86c66c commit 4b8cc61
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export const DBAAS_CONFIG: Readonly<CloudPulseServiceTypeFilterMap> = {
},
{
configuration: {
filterKey: 'role',
filterKey: 'node_type',
filterType: 'string',
isFilterable: true, // isFilterable -- this determines whether you need to pass it metrics api
isMetricsFilter: false, // if it is false, it will go as a part of filter params, else global filter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ it('test checkMandatoryFiltersSelected method for role', () => {

result = checkMandatoryFiltersSelected({
dashboardObj: { ...mockDashboard, service_type: 'dbaas' },
filterValue: { region: 'us-east', role: 'primary' },
filterValue: { node_type: 'primary', region: 'us-east' },
resource: 1,
timeDuration: { unit: 'min', value: 30 },
});
Expand All @@ -83,12 +83,12 @@ it('test constructDimensionFilters method', () => {
mockDashboard.service_type = 'dbaas';
const result = constructDimensionFilters({
dashboardObj: mockDashboard,
filterValue: { role: 'primary' },
filterValue: { node_type: 'primary' },
resource: 1,
});

expect(result.length).toEqual(1);
expect(result[0].filterKey).toEqual('role');
expect(result[0].filterKey).toEqual('node_type');
expect(result[0].filterValue).toEqual('primary');
});

Expand All @@ -99,13 +99,13 @@ it('test checkIfFilterNeededInMetricsCall method', () => {
result = checkIfFilterNeededInMetricsCall('resource_id', 'linode');
expect(result).toEqual(false); // not needed as dimension filter

result = checkIfFilterNeededInMetricsCall('role', 'dbaas');
result = checkIfFilterNeededInMetricsCall('node_type', 'dbaas');
expect(result).toEqual(true);

result = checkIfFilterNeededInMetricsCall('engine', 'dbaas');
expect(result).toEqual(false);

result = checkIfFilterNeededInMetricsCall('role', 'xyz'); // xyz service type
result = checkIfFilterNeededInMetricsCall('node_type', 'xyz'); // xyz service type
expect(result).toEqual(false);
});

Expand Down

0 comments on commit 4b8cc61

Please sign in to comment.