Skip to content

Commit

Permalink
PMM-13348 Update status handling for disconnected agents
Browse files Browse the repository at this point in the history
  • Loading branch information
matejkubinec committed Sep 13, 2024
1 parent 830fe56 commit 56ee525
Showing 1 changed file with 30 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Router } from 'react-router-dom';
import { locationService } from '@grafana/runtime';
import { DbAgent } from 'app/percona/shared/services/services/Services.types';

import { ServiceAgentStatus } from '../../Inventory.types';
import { AgentType, ServiceAgentStatus } from '../../Inventory.types';
import { getAgentsMonitoringStatus } from '../../Tabs/Services.utils';

import { StatusLink } from './StatusLink';
Expand Down Expand Up @@ -49,6 +49,7 @@ describe('StatusLink', () => {
},
{
agentId: 'agent3',
agentType: AgentType.pmmAgent,
isConnected: false,
},
];
Expand All @@ -59,9 +60,37 @@ describe('StatusLink', () => {
</Router>
);
expect(screen.queryByText('OK')).not.toBeInTheDocument();
expect(screen.queryByText('N/A')).not.toBeInTheDocument();
expect(screen.getByText('Failed')).toBeInTheDocument();
});

it('should show "N/A" if some agent is not connected and is an external exporter', () => {
const agents: DbAgent[] = [
{
agentId: 'agent1',
status: ServiceAgentStatus.RUNNING,
},
{
agentId: 'agent2',
status: ServiceAgentStatus.STARTING,
},
{
agentId: 'agent3',
agentType: AgentType.externalExporter,
isConnected: false,
},
];
const agentsStatus = getAgentsMonitoringStatus(agents);
render(
<Router history={locationService.getHistory()}>
<StatusLink agentsStatus={agentsStatus} type="services" strippedId="service_id_1" />
</Router>
);
expect(screen.queryByText('OK')).not.toBeInTheDocument();
expect(screen.queryByText('Failed')).not.toBeInTheDocument();
expect(screen.getByText('N/A')).toBeInTheDocument();
});

it('should show "Failed" if some agent is not starting or running', () => {
const agents: DbAgent[] = [
{
Expand Down

0 comments on commit 56ee525

Please sign in to comment.