Skip to content

Commit

Permalink
[Uptime] Unskip "Observer location" test block (#87571)
Browse files Browse the repository at this point in the history
* Unskip "Observer location" test block.

* Commit temp "describe.only" to make flaky test runner go faster.

* Add optional chain for some potentially-null props.

* Make overview filters type partial.

* Repair broken types.

* Remove \`only\` call from test.
  • Loading branch information
justinkambic committed Jan 15, 2021
1 parent 8a71415 commit 5db59e0
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import * as t from 'io-ts';

export const OverviewFiltersType = t.type({
export const OverviewFiltersType = t.partial({
locations: t.array(t.string),
ports: t.array(t.number),
schemes: t.array(t.string),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export const AlertMonitorStatus: React.FC<Props> = ({
enabled={enabled}
hasFilters={!!overviewFilters?.filters}
isOldAlert={isOldAlert}
locations={locations}
locations={locations || []}
numTimes={numTimes}
setAlertParams={setAlertParams}
shouldUpdateUrl={shouldUpdateUrl}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ const Container = styled(EuiFilterGroup)`
margin-bottom: 10px;
`;

function isDisabled<T>(array?: T[]) {
return array ? array.length === 0 : true;
}

export const FilterGroupComponent: React.FC<PresentationalComponentProps> = ({
overviewFilters,
loading,
Expand Down Expand Up @@ -51,7 +55,7 @@ export const FilterGroupComponent: React.FC<PresentationalComponentProps> = ({
onFilterFieldChange,
fieldName: 'observer.geo.name',
id: 'location',
items: locations,
items: locations || [],
selectedItems: selectedLocations,
title: filterLabels.LOCATION,
},
Expand All @@ -63,8 +67,8 @@ export const FilterGroupComponent: React.FC<PresentationalComponentProps> = ({
onFilterFieldChange,
fieldName: 'url.port',
id: 'port',
disabled: ports.length === 0,
items: ports.map((p: number) => p.toString()),
disabled: isDisabled(ports),
items: ports?.map((p: number) => p.toString()) ?? [],
selectedItems: selectedPorts,
title: filterLabels.PORT,
},
Expand All @@ -73,8 +77,8 @@ export const FilterGroupComponent: React.FC<PresentationalComponentProps> = ({
onFilterFieldChange,
fieldName: 'monitor.type',
id: 'scheme',
disabled: schemes.length === 0,
items: schemes,
disabled: isDisabled(schemes),
items: schemes ?? [],
selectedItems: selectedSchemes,
title: filterLabels.SCHEME,
},
Expand All @@ -83,8 +87,8 @@ export const FilterGroupComponent: React.FC<PresentationalComponentProps> = ({
onFilterFieldChange,
fieldName: 'tags',
id: 'tags',
disabled: tags.length === 0,
items: tags,
disabled: isDisabled(tags),
items: tags ?? [],
selectedItems: selectedTags,
title: filterLabels.TAGS,
},
Expand Down
3 changes: 1 addition & 2 deletions x-pack/test/functional/apps/uptime/locations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
await makeChecksWithStatus(es, LessAvailMonitor, 5, 2, 10000, {}, 'down');
};

// FLAKY: https://github.com/elastic/kibana/issues/85208
describe.skip('Observer location', () => {
describe('Observer location', () => {
const start = '~ 15 minutes ago';
const end = 'now';

Expand Down

0 comments on commit 5db59e0

Please sign in to comment.