Skip to content

Commit

Permalink
Test for Health Unknown
Browse files Browse the repository at this point in the history
  • Loading branch information
philrenaud committed Jun 9, 2023
1 parent 96a9fbb commit 70ef9b4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ui/app/components/allocation-service-sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default class AllocationServiceSidebarComponent extends Component {
}

get aggregateStatus() {
if (this.args.allocation?.clientStatus != -'running') return 'Unknown';
if (this.args.allocation?.clientStatus !== 'running') return 'Unknown';
return this.checks.any((check) => check.Status === 'failure')
? 'Unhealthy'
: 'Healthy';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ module(
};

this.set('closeSidebar', () => this.set('service', null));
this.set('allocation', { id: 'myAlloc' });
this.set('allocation', { id: 'myAlloc', clientStatus: 'running' });
this.set('service', healthyService);
await render(
hbs`<AllocationServiceSidebar @service={{this.service}} @allocation={{this.allocation}} @fns={{hash closeSidebar=this.closeSidebar}} />`
Expand All @@ -91,6 +91,13 @@ module(
hbs`<AllocationServiceSidebar @service={{this.service}} @allocation={{this.allocation}} @fns={{hash closeSidebar=this.closeSidebar}} />`
);
assert.dom('h1 .aggregate-status').includesText('Unhealthy');

this.set('service', healthyService);
this.set('allocation', { id: 'myAlloc2', clientStatus: 'failed' });
await render(
hbs`<AllocationServiceSidebar @service={{this.service}} @allocation={{this.allocation}} @fns={{hash closeSidebar=this.closeSidebar}} />`
);
assert.dom('h1 .aggregate-status').includesText('Health Unknown');
});

test('it handles Consul services with reduced functionality', async function (assert) {
Expand Down

0 comments on commit 70ef9b4

Please sign in to comment.