Skip to content

[FLINK-40600][runtime-web] Add missing web dashboard specs and tighten thin ones - #29135

Merged
MartijnVisser merged 1 commit into
apache:masterfrom
spuru9:FLINK-40600
Sep 11, 2026
Merged

[FLINK-40600][runtime-web] Add missing web dashboard specs and tighten thin ones#29135
MartijnVisser merged 1 commit into
apache:masterfrom
spuru9:FLINK-40600

Conversation

@spuru9

@spuru9 spuru9 commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

What is the purpose of the change

FLINK-40117 added Vitest specs for most of the web dashboard views, but pages/application/overview and pages/application/exceptions still had none. Some of the added specs also only checked that the mocked data was loaded, not what the component derived from it: the timeline spec didn't assert the computed vertex and subtask ranges, the job overview spec never fed a plan into ngOnInit, the cluster overview spec didn't assert the derived statistics, and TaskManagerService only had tests for loadManagers and loadManager. The HumanizeDatePipe test for format 'B' relied on Angular throwing for missing locale data, which an Angular upgrade could change.

This adds the two missing specs and tightens the existing ones so they fail when the derived values change.

Brief change log

  • Added application-overview.component.spec.ts and application-exceptions.component.spec.ts.
  • Tightened job-timeline.component.spec.ts to assert the computed vertex ranges (including the duration-derived end-time branch and filtering of not-yet-started vertices) and the per-subtask timeline ranges, instead of just checking counts/names.
  • Tightened job-overview.component.spec.ts with a new spec that feeds an actual plan into ngOnInit and asserts the derived pendingNodes/pendingLinks and the resulting dagreComponent.flush call.
  • Tightened overview.component.spec.ts (cluster overview) to assert the exact derived cluster-statistics object instead of just checking for static label text.
  • Expanded task-manager.service.spec.ts from covering only loadManagers/loadManager to covering all public methods.
  • Replaced the humanize-date.pipe.spec.ts test that relied on Angular throwing for format 'B' with one driven by an unregistered locale, which is a stable part of Angular's i18n contract rather than a version-dependent implementation detail.

Verifying this change

This change added tests and can be verified as follows:

  • npx ng test --watch=false in flink-runtime-web/web-dashboard: 35 spec files / 158 tests pass (up from the prior baseline of 33 files / 139 tests).
  • npm run lint and npx prettier --check are clean on all changed/added files.

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): no
  • The public API, i.e., is any changed class annotated with @Public(Evolving): no
  • The serializers: no
  • The runtime per-record code paths (performance sensitive): no
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: no
  • The S3 file system connector: no

Documentation

  • Does this pull request introduce a new feature? no
  • If yes, how is the feature documented? not applicable

Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

Generated-by: Claude Code (claude-sonnet-5)

@flinkbot

flinkbot commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run azure re-run the last Azure build

@spuru9
spuru9 marked this pull request as draft September 8, 2026 18:44
@spuru9
spuru9 force-pushed the FLINK-40600 branch 4 times, most recently from 8229b6b to 1129e92 Compare September 8, 2026 19:08
@spuru9
spuru9 marked this pull request as ready for review September 8, 2026 19:10

@MartijnVisser MartijnVisser left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suite is green on this branch: 35 files / 158 tests, lint and prettier clean, and the base is 33 / 139, so the numbers in the description hold.

I then mutated the production code these specs cover, and ten mutants survive. They're all in the spots the ticket asked to pin down, so I think it makes sense to close them here rather than in another follow-up. Comments inline. With all of them applied the ten die and the suite stays green at 159 tests.

Nothing blocking. This goes in before FLINK-40601's PR #29138.

Comment on lines +79 to +87
it('splits the application jobs into running and completed lists', () => {
fixture.detectChanges();

const text = element.textContent ?? '';
expect(text).toContain('Running Job List');
expect(text).toContain('Completed Job List');
expect(text).toContain('Streaming ETL');
expect(text).toContain('Batch Report');
});

@MartijnVisser MartijnVisser Sep 11, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These assertions only check that both names appear somewhere in the component. I swapped [completed] between the two flink-job-list children and the spec stayed green, so the split it's named for isn't actually checked. Can you assert per list instead, via element.querySelectorAll('flink-job-list')?

Comment on lines +52 to +67
exceptionName: 'java.lang.RuntimeException',
stacktrace: 'java.lang.RuntimeException: boom\n\tat com.example.Foo.bar(Foo.java:42)',
timestamp: 1_781_000_000_000,
jobId: 'job-1'
}
]
}
};
loadExceptions.mockReturnValue(of(mockExceptions));

fixture.detectChanges();

expect(loadExceptions).toHaveBeenCalledWith('app-1');
expect(fixture.componentInstance.rootException).toContain('Related Job: job-1');
expect(fixture.componentInstance.rootException).toContain('java.lang.RuntimeException: boom');
expect(fixture.componentInstance.isLoading).toBe(false);

@MartijnVisser MartijnVisser Sep 11, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test is named for the timestamp and the most recent entry, but neither is pinned. I switched the mask to shortTime, and read entries[entries.length - 1] instead of entries[0], and both kept the spec green. Could you add an older second entry and assert the shape of the first line, something like expect(rootException.split('\n')[0]).toMatch(/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/)? The shape rather than a value, because formatDate is called here without a time zone.

Comment on lines +117 to +120
'applications-running': 1,
'applications-finished': 1,
'applications-cancelled': 0,
'applications-failed': 0,

@MartijnVisser MartijnVisser Sep 11, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

applications-running and applications-finished are both 1 here, and the other two both 0, so the four filters in overview.component.ts are interchangeable. I swapped RUNNING with FINISHED, and CANCELED with FAILED, and the spec stayed green both times. Can you add a second running application and a cancelled one to mockApplications, and expect 2 / 1 / 1 / 0 here?

Comment on lines +166 to +167
expect(fakeDagre.flush).toHaveBeenCalledWith(mockPlan.nodes, mockPlan.links, true);
});

@MartijnVisser MartijnVisser Sep 11, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fakeDagre.showPendingOperators is false in both tests, so refreshGraph never takes the branch that uses the pendingNodes/pendingLinks you assert above. I dropped them from that flush call and the spec stayed green. Could you add a case with it set to true?


const result = await firstValueFrom(service.loadLogList('tm-1'));

expect(httpClient.get).toHaveBeenCalledWith(expect.stringContaining('/taskmanagers/tm-1/logs'));

@MartijnVisser MartijnVisser Sep 11, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These URLs are matched by substring, so a wrong endpoint still passes. I pointed loadLogs at /logs, appended a character to loadLog's url, and defaulted loadThreadDump to ?mode=lite, and the spec stayed green each time. Can you assert the full URL off the same ConfigService, like jar.service.spec.ts does?

Comment on lines +154 to +158
httpClient.get.mockReturnValue(of([{ id: 'Status.JVM.CPU.Load', value: '0.42' }]));

const result = await firstValueFrom(service.loadMetrics('tm-1', ['Status.JVM.CPU.Load']));

expect(result).toEqual({ 'Status.JVM.CPU.Load': 0.42 });

@MartijnVisser MartijnVisser Sep 11, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

listOfMetricName.join(',') isn't pinned here: the list has one element and the get params are never asserted, so changing the separator survives. Can you pass two metric names and assert the call?

…n thin ones

FLINK-40117 added Vitest specs for most web dashboard views, but
pages/application/overview and pages/application/exceptions still had
none, and several existing specs only checked that mocked data was
loaded rather than what the component derived from it.

Adds the two missing specs, and tightens the timeline, job overview,
and cluster overview specs to assert their computed values, expands
TaskManagerService coverage beyond loadManagers/loadManager, and
replaces the HumanizeDatePipe format-'B' test's reliance on an
Angular-internal throw with one driven by an unregistered locale.

Generated-by: Claude Code (claude-sonnet-5)

@MartijnVisser MartijnVisser left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All six addressed, thanks. I re-ran the mutants on this head and they all die now, with the suite green at 159 tests. Approving.

@MartijnVisser
MartijnVisser merged commit 383996f into apache:master Sep 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants