-
Notifications
You must be signed in to change notification settings - Fork 364
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
feat: [M3-8837] - Add LKE-E feature flag #11259
feat: [M3-8837] - Add LKE-E feature flag #11259
Conversation
9dd6ce7
to
53d3170
Compare
server.use( | ||
http.get('*/account/betas/apl', () => { | ||
return HttpResponse.json(accountBeta); | ||
}) | ||
); | ||
const { result } = renderHook(() => useAPLAvailability(), { | ||
wrapper: (ui) => wrapWithTheme(ui, { flags: { apl: true } }), | ||
|
||
queryMocks.useAccountBetaQuery.mockReturnValue({ | ||
data: accountBeta, | ||
}); | ||
await waitFor(() => { | ||
expect(result.current.showAPL).toBe(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to modify this test with the addition of the useIsLkeEnterpriseEnabled
tests, due to the use of feature flags in both.
In the words of the wise @jdamore-linode, the APL test needed to be modified because:
the vi.mock for
useFlags
that technically broke the APL availability test, because theuseAccountBetaQuery
function callsuseFlags
. And sinceuseAccountBetaQuery
wasn’t getting mocked butuseFlags
was,useFlags
was responding with an empty object causinguseAccountBetaQuery
to always return an object indicating that APL is disabled.
(And so the APL test would fail.)
In the interest of using one mocking solution in this file (not both server.use
and vi.mock
), I switched this one over to using the queryMocks, as well.
/** | ||
* @TODO LKE-E - M3-8838: Clean up after released to GA, if not otherwise in use | ||
*/ | ||
export const useAccountBeta = () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not to be confused with the useAccountBetaQuery
... if there's a suggestion for a better name here, I'm open to it!
Coverage Report: ✅ |
Any thoughts about adding a Mock Service Worker preset for this? Doesn't help too much now since there aren't any UI changes, but might be handy once development ramps up a bit more. I took a quick stab at a preset (that does the absolute bare minimum, there's probably a lot of room for improvement): // New file at `src/mocks/presets/extra/account/lkeEnterpriseEnabled.ts` or similar
import { http } from 'msw';
import {
accountFactory,
} from 'src/factories';
import { makeResponse } from 'src/mocks/utilities/response';
import type { MockPresetExtra } from 'src/mocks/types';
const mockLkeEnabledCapability = () => {
return [
http.get('*/v4*/account', async ({ request }) => {
return makeResponse(
accountFactory.build({
capabilities: [
// Other account capabilities might be necessary here, too...
// TODO Make a `defaultAccountCapabilities` factory.
'Kubernetes',
'Kubernetes Enterprise',
],
})
);
}),
]
};
export const lkeEnterpriseEnabledPreset: MockPresetExtra = {
desc: 'Mock account with LKE Enterprise capability',
group: { id: 'Account', type: 'select' },
handlers: [mockLkeEnabledCapability],
id: 'account:lke-enterprise-enabled',
label: 'LKE Enterprise Enabled',
}; (And then there are some accompanying changes required to the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @mjac0bs!
3cf7aeb
to
7ea9f24
Compare
Putting this back up for review with some updates:
|
Cloud Manager UI test results🎉 452 passing tests on test run #5 ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @mjac0bs!
Description 📝
We will need a feature flag in Launch Darkly to gate access to the UI changes for LKE-Enterprise.
Changes 🔄
lkeEnterprise
flag exists in Launch Darkly.useIsLkeEnterpriseEnabled
hook handles the enablement of the feature.How to test 🧪
Prerequisites
(How to setup test environment)
OR
Verification steps
(How to verify changes)
KubernetesLanding.tsx
, console.log the return value, and confirm you see a v4beta/account network request.As an Author, I have considered 🤔
As an Author, before moving this PR from Draft to Open, I confirmed ✅