Skip to content

Commit 753b7ee

Browse files
smeagol91Jenkins
authored andcommitted
igloo: pin the requested graph window and the no-data state
useGraphData passes start and end through verbatim, so a window reaching past the retained data is never silently narrowed. A window that returns no data does state something, but names the wrong cause: it reuses the hidden-metrics message. Pinned as-is so the wording and its test change together. JIRA-Ref: CMK-37024 Change-Id: Ia919746d9e9e891abb3054c6afaa23308e7c991c
1 parent 9a9d0e7 commit 753b7ee

2 files changed

Lines changed: 26 additions & 0 deletions

File tree

packages/cmk-frontend-vue/tests/graphing/components/GraphPanel.test.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -657,3 +657,18 @@ test('keeps the all-hidden message when data arrived but nothing is shown', () =
657657
expect(screen.getByText('All metrics are hidden')).toBeInTheDocument()
658658
expect(screen.getByTestId('time-series-graph')).toBeInTheDocument()
659659
})
660+
661+
test('a window that returned no data reuses the all-hidden message', () => {
662+
render(GraphPanel, {
663+
props: {
664+
metrics: [],
665+
dataTimeRange: TIME_RANGE,
666+
requestedTimeRange: REQUESTED,
667+
interaction: INTERACTION_NONE
668+
}
669+
})
670+
671+
// Pins today's wording: nothing was hidden, there was nothing to show. Change both together.
672+
expect(screen.getByText('All metrics are hidden')).toBeInTheDocument()
673+
expect(screen.getByTestId('time-series-graph')).toBeInTheDocument()
674+
})

packages/cmk-frontend-vue/tests/graphing/composables/useGraphData.test.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,17 @@ describe('useGraphData — requested resolution', () => {
128128
const samplesPerColumn = (eightDays.end - eightDays.start) / step / columns
129129
expect(samplesPerColumn).toBeCloseTo(4, 1)
130130
})
131+
132+
test('a window reaching past the retained data is asked for verbatim', async () => {
133+
// Narrowing here would redraw a different period than the picker states, so only the step
134+
// is ever derived.
135+
const fourHundredDays = { start: 0, end: 400 * 86_400 }
136+
137+
fetchFor(fourHundredDays, 750)
138+
139+
const { start, end } = await requestedTimeRange()
140+
expect({ start, end }).toEqual(fourHundredDays)
141+
})
131142
})
132143

133144
/** Mounts the composable on the given fetcher and hands back the diagnostics it exposes. */

0 commit comments

Comments
 (0)