Skip to content

Instantly share code, notes, and snippets.

@lucasponce
Created June 15, 2018 09:28
Show Gist options
  • Save lucasponce/f933a3f88d5af5146995f1f84d58024f to your computer and use it in GitHub Desktop.
Save lucasponce/f933a3f88d5af5146995f1f84d58024f to your computer and use it in GitHub Desktop.
<<<<<<< HEAD
=======
it('renders envoy degraded', () => {
const health: Health = {
envoy: { healthy: 1, total: 10 },
deploymentStatuses: [{ name: 'A', available: 1, replicas: 1 }, { name: 'B', available: 2, replicas: 2 }],
requests: { requestCount: 0, requestErrorCount: 0 }
};
// SMALL
let wrapper = shallow(<HealthIndicator id="svc" health={health} mode={DisplayMode.SMALL} rateInterval={600} />);
expect(wrapper).toMatchSnapshot();
let html = wrapper.html();
expect(html).toContain('pficon-warning');
// LARGE
wrapper = shallow(<HealthIndicator id="svc" health={health} mode={DisplayMode.LARGE} rateInterval={600} />);
expect(wrapper).toMatchSnapshot();
html = wrapper.html();
expect(html).toContain('pficon-warning');
expect(html).toContain('Envoy health degraded');
});
it('renders both degraded', () => {
const health: Health = {
envoy: { healthy: 1, total: 10 },
deploymentStatuses: [{ name: 'A', available: 1, replicas: 10 }, { name: 'B', available: 2, replicas: 10 }],
requests: { requestCount: 0, requestErrorCount: 0 }
};
// SMALL
let wrapper = shallow(<HealthIndicator id="svc" health={health} mode={DisplayMode.SMALL} rateInterval={600} />);
expect(wrapper).toMatchSnapshot();
let html = wrapper.html();
expect(html).toContain('pficon-warning');
// LARGE
wrapper = shallow(<HealthIndicator id="svc" health={health} mode={DisplayMode.LARGE} rateInterval={600} />);
expect(wrapper).toMatchSnapshot();
html = wrapper.html();
expect(html).toContain('pficon-warning');
expect(html).toContain('Pod deployment degraded');
expect(html).toContain('Envoy health degraded');
});
it('renders deployments failure', () => {
const health: Health = {
envoy: { healthy: 1, total: 10 },
deploymentStatuses: [{ name: 'A', available: 0, replicas: 10 }, { name: 'B', available: 2, replicas: 2 }],
requests: { requestCount: 0, requestErrorCount: 0 }
};
// SMALL
let wrapper = shallow(<HealthIndicator id="svc" health={health} mode={DisplayMode.SMALL} rateInterval={600} />);
expect(wrapper).toMatchSnapshot();
let html = wrapper.html();
expect(html).toContain('pficon-error');
// LARGE
wrapper = shallow(<HealthIndicator id="svc" health={health} mode={DisplayMode.LARGE} rateInterval={600} />);
expect(wrapper).toMatchSnapshot();
html = wrapper.html();
expect(html).toContain('pficon-error');
expect(html).toContain('Pod deployment failure');
expect(html).toContain('Envoy health degraded');
});
>>>>>>> master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment