Skip to content

[7833] Flaky HA unit test + update cypress config#7834

Merged
cstns merged 3 commits into
mainfrom
7833-flaky-tests
Jul 16, 2026
Merged

[7833] Flaky HA unit test + update cypress config#7834
cstns merged 3 commits into
mainfrom
7833-flaky-tests

Conversation

@n-lark

@n-lark n-lark commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Description

Several unrelated CI flakes, green locally, red on runners. Different causes, not one bug.

File Fix
ha/index_spec.js Dropped a state === 'suspended' check that raced the restart's re-write; kept the reliable inflight check.
InstanceStatusPolling.vue Caught the 404 when an instance is deleted mid-poll (was an unhandled rejection failing random tests).
tokens.spec.js Count baseline now read via retryable cy.get() (not sync Cypress.$ pre-render); expiry assertion made timezone-safe.
admin.spec.js Wait for the team redirect to settle on /overview before clicking the Applications nav. The click was racing the pending redirect and getting bounced back.
cypress-shared.config.js retries: { runMode: 2 } absorbs CI variance. Retried passes still log Attempt 2 of 3. See below.

Retries: on CI a failing test is re-run up to 2 more times (3 attempts total); it only counts as failed if all 3 fail, so a one-off hiccup no longer reds the build. Local cypress open keeps 0 retries for instant feedback.

Downside: a genuinely flaky test can now pass silently, but will torture us less. Check run logs for Attempt 2 of 3 when that matters.

Related Issue(s)

Resolves #7833

Checklist

  • I have read the contribution guidelines
  • Suitable unit/system level tests have been added and they pass
  • Documentation has been updated
    • Upgrade instructions
    • Configuration details
    • Concepts
  • Changes flowforge.yml?
    • Issue/PR raised on FlowFuse/helm to update ConfigMap Template
    • Issue/PR raised on FlowFuse/CloudProject to update values for Staging/Production
  • Link to Changelog Entry PR, or note why one is not needed.

Labels

  • Includes a DB migration? -> add the area:migration label

@n-lark n-lark self-assigned this Jul 15, 2026
@n-lark
n-lark requested review from Steve-Mcl and cstns July 15, 2026 18:08
@codecov

codecov Bot commented Jul 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.10%. Comparing base (a7b9f86) to head (15e6289).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7834   +/-   ##
=======================================
  Coverage   75.09%   75.10%           
=======================================
  Files         430      430           
  Lines       22838    22846    +8     
  Branches     6052     6055    +3     
=======================================
+ Hits        17151    17159    +8     
  Misses       5687     5687           
Flag Coverage Δ
backend 75.10% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Steve-Mcl Steve-Mcl 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.

Approved with nit - you decide 😸

Comment on lines -112 to -114
cy.get('[data-el="tokens-table"] tbody').find('tr').last().should('contain', '31')
cy.get('[data-el="tokens-table"] tbody').find('tr').last().should('contain', '12')
cy.get('[data-el="tokens-table"] tbody').find('tr').last().should('contain', '2050')

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.

nit - are these exact presence checks handled in other test? If not, I would be tempted to include (a version of) them in the should => callback on line 113?

not a blocker.

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.

This is just checking that the correct expiry date was set on the token, I'd say it's good enough

@cstns cstns 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.

I'll push a fix for the flaky admin test in order to get this in sooner

module.exports = {
viewportWidth: 1024,
viewportHeight: 768,
retries: {

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.

I was certain we had this enabled for this runner.. I must have been thinking of the dashboard repo

Comment on lines -112 to -114
cy.get('[data-el="tokens-table"] tbody').find('tr').last().should('contain', '31')
cy.get('[data-el="tokens-table"] tbody').find('tr').last().should('contain', '12')
cy.get('[data-el="tokens-table"] tbody').find('tr').last().should('contain', '2050')

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.

This is just checking that the correct expiry date was set on the token, I'd say it's good enough


// retryable read - a synchronous Cypress.$ count can beat the table render on slow CI, undercounting the baseline
let rows
cy.get('[data-el="tokens-table"] tbody').find('tr.ff-data-table--row').then($rows => { rows = $rows.length })

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.

counting the number of rows in a table was never a good idea to begin with. If there's a next time, we should rethink how we validate entries exist in the table


cy.url().should('match', /\/team\/[^/]+/)
// wait for the team redirect to settle on /overview, else the Applications click below can race the pending redirect
cy.url().should('match', /\/team\/[^/]+\/overview/)

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.

I think this was just a gross oversight.. the url should never have matched team after navigating away from the admin teams list. Running the suites locally were just fast enough to catch the old href before navigation.

We should only be checking if the page matches overview after nav

@cstns
cstns enabled auto-merge (squash) July 16, 2026 09:09
@cstns
cstns merged commit 3b1810f into main Jul 16, 2026
29 checks passed
@cstns
cstns deleted the 7833-flaky-tests branch July 16, 2026 09:27
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.

Flaky HA unit test (probably)

3 participants