-
Notifications
You must be signed in to change notification settings - Fork 332
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-8104] - Add options for default policies when creating a Firewall #10474
feat: [M3-8104] - Add options for default policies when creating a Firewall #10474
Conversation
|
||
import { ActionsPanel } from 'src/components/ActionsPanel/ActionsPanel'; | ||
import { Box } from 'src/components/Box'; | ||
import { Drawer } from 'src/components/Drawer'; | ||
import { FormControlLabel } from 'src/components/FormControlLabel'; |
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, Radio, and RadioGroup are the new imports. The rest are just reordering to satisfy the linter.
const handleInboundPolicyChange = React.useCallback( | ||
(e: React.ChangeEvent<HTMLInputElement>, value: 'ACCEPT' | 'DROP') => { | ||
setFieldValue('rules.inbound_policy', value); | ||
}, | ||
[setFieldValue] | ||
); | ||
|
||
const handleOutboundPolicyChange = React.useCallback( | ||
(e: React.ChangeEvent<HTMLInputElement>, value: 'ACCEPT' | 'DROP') => { | ||
setFieldValue('rules.outbound_policy', value); | ||
}, | ||
[setFieldValue] | ||
); |
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 considered DRYing this up but it didn't seem worth it. Open to other perspective.
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.
- Verified the new radio buttons.
- Verified I can create a new firewall with any combination of default inbound/outbound policies and they will be reflected accurately on the firewall's details page.
- Verified tests pass; left a small suggestion for slightly more coverage.
- We now have a merge conflict since I merged in the form analytics PR that will need to be resolved.
Since this looked good overall, approving pending feedback is addressed. π’
expect(withinInboundPolicy.getByText('Accept')).toBeVisible(); | ||
expect(withinInboundPolicy.getByText('Drop')).toBeVisible(); | ||
|
||
const withinOutboundPolicy = within( | ||
screen.getByTestId('default-inbound-policy') | ||
); | ||
expect(withinOutboundPolicy.getByText('Accept')).toBeVisible(); | ||
expect(withinOutboundPolicy.getByText('Drop')).toBeVisible(); |
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.
In addition to the radio buttons being visible, can we also test that the default are what we expect (e.g. Inbound is Drop and Outbound is Accept)?
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.
Good suggestion, I will add that.
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 suggestion led to me finding/fixing a bug in the test: a17087b#diff-0c798b84bbae6cb1eff09a58fffcf5f797803962ecfbc555de867a42f946cc85R41
Thanks again!
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.
Unit test passes β
New radio buttons present in drawer and functionality (incl. different policy combinations) works as expected β
Can we get a changeset added before merging?
Thanks for the reviews @mjac0bs and @dwiley-akamai. Today I will:
|
LGTM!
Pending the suggestions from Mariah and Dajahi plus some merge conflicts to resolve. |
07a1fb0
to
8cd4e93
Compare
Coverage Report: β
|
Description π
This adds "Default Inbound Policy" and "Default Outbound Policy" to the Create Firewall Drawer.
The default inbound policy is now "Drop", which is a change from what Firewalls implicitly default to in Production today. Note: Cloud Manager currently specifies this default, not the API.
Changes π
Target release date ποΈ
May 27, 2024
Preview π·
How to test π§ͺ
yarn test CreateFirewallDrawer
As an Author I have considered π€
Check all that apply