Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(upgrade-service): allow no preflights and no config #4942

Merged

Conversation

JGAntunes
Copy link
Member

@JGAntunes JGAntunes commented Oct 10, 2024

What this PR does / why we need it:

This PR fixes the upgrade flow for when an upgrade doesn't have config or preflight checks (the shortcut story has a video which illustrates the whole flow).

Which issue(s) this PR fixes:

https://app.shortcut.com/replicated/story/113259/new-upgrade-workflow-doesn-t-work-if-there-is-no-config
https://app.shortcut.com/replicated/story/113787/upgrade-workflow-doesn-t-work-if-you-don-t-have-preflights

Does this PR require a test?

Yes, I'll be looking into adding a playwright test to the EC repo.

Does this PR require a release note?

Fix for the upgrade flow in embedded cluster when there's no config and/or preflight checks available.

Does this PR require documentation?

NONE

@CLAassistant
Copy link

CLAassistant commented Oct 10, 2024

CLA assistant check
All committers have signed the CLA.

@JGAntunes JGAntunes added type::bug Something isn't working bug::normal labels Oct 11, 2024
@JGAntunes JGAntunes requested a review from sgalsaleh October 11, 2024 10:44
@JGAntunes JGAntunes marked this pull request as ready for review October 11, 2024 10:44
@JGAntunes JGAntunes requested a review from miaawong October 11, 2024 14:02
miaawong
miaawong previously approved these changes Oct 11, 2024
Copy link
Member

@miaawong miaawong left a comment

Choose a reason for hiding this comment

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

just two little linter errors! Great work Joao!

@laverya
Copy link
Member

laverya commented Oct 11, 2024

lint-web has a few failures - any reason those can't be fixed?

Copy link
Member

@sgalsaleh sgalsaleh left a comment

Choose a reason for hiding this comment

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

I see a unit test for info API call, but not one for validating that the UI shows what's expected based on the values of hasPreflight and isConfigurable.

@JGAntunes JGAntunes force-pushed the jooantunes/sc-113259/new-upgrade-workflow-doesn-t-work-if-there branch from 9f7b297 to d37f4ed Compare October 14, 2024 19:08
web/config/jest-setup.ts Outdated Show resolved Hide resolved
Comment on lines +200 to +204
"testEnvironmentOptions": {
"customExportConditions": [
""
]
},
Copy link
Member Author

Choose a reason for hiding this comment

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

Comment on lines +1 to +2
import "intersection-observer";
import "@testing-library/jest-dom";
Copy link
Member Author

Choose a reason for hiding this comment

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

There's a whole set of things which aren't pollyfilled by jsdom which is what the @testing-library/jest-dom is for. We also need to pollyfill the intersection-observer for the AppConfig component to render.

@JGAntunes
Copy link
Member Author

Ok, after fighting a lot with jest, react router and its related friends I think this is ready for review. Could I get a 👀 again @sgalsaleh and @miaawong 🙏 There's a bit of noise in the tests because some of the components we're testing end up logging a lot but the tests are 🟢 if y'all want I can eventually remove the console.* calls we have spread out, or potentially silence them in some way in jest.

</MemoryRouter>
);

await findByTestId("preflight-check-area");
Copy link
Member

Choose a reason for hiding this comment

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

is this right? should this be available if preflights are not available?

Copy link
Member Author

@JGAntunes JGAntunes Oct 14, 2024

Choose a reason for hiding this comment

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

Ah nice catch, thanks! This doesn't make sense though, there's something in the tests that's leading to this behaviour because if I it.only this test it fails as expected, if I run the whole file it passes 🙃 need to debug this further tomorrow 😩 I wonder if it's something to do with the http interception.

Copy link
Member Author

Choose a reason for hiding this comment

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

Managed to reproduce the failure locally while running the full harness of tests, turns out the state of the interceptors wasn't being correctly reset. I've also created different slugs per test to ensure we have fully decoupled setup processes (and prevent stuff like this in the future), fixed via - 84eb952

sgalsaleh
sgalsaleh previously approved these changes Oct 14, 2024
@JGAntunes JGAntunes requested a review from sgalsaleh October 15, 2024 09:46
@sgalsaleh sgalsaleh merged commit d20730a into main Oct 15, 2024
122 checks passed
@sgalsaleh sgalsaleh deleted the jooantunes/sc-113259/new-upgrade-workflow-doesn-t-work-if-there branch October 15, 2024 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug::normal type::bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants