diff --git a/public/app/percona/inventory/components/StatusLink/StatusLink.test.tsx b/public/app/percona/inventory/components/StatusLink/StatusLink.test.tsx index 4ff244ccedbd2..c457cbaf63b0e 100644 --- a/public/app/percona/inventory/components/StatusLink/StatusLink.test.tsx +++ b/public/app/percona/inventory/components/StatusLink/StatusLink.test.tsx @@ -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'; @@ -49,6 +49,7 @@ describe('StatusLink', () => { }, { agentId: 'agent3', + agentType: AgentType.pmmAgent, isConnected: false, }, ]; @@ -59,9 +60,37 @@ describe('StatusLink', () => { ); 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( + + + + ); + 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[] = [ {