Skip to content

Commit

Permalink
[EDR Workflows][chore] Change previously added `antivirus_registratio…
Browse files Browse the repository at this point in the history
…n.mode` from optional to required (#181986)

## Summary

`antivirus_registration.mode` field was added to Endpoint integration
policy config in this PR: #180484

It was optional to support roll-out, now it's changed to required as it
has been released since.

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
gergoabraham and kibanamachine committed May 3, 2024
1 parent 8d5341f commit 2e9099d
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1000,7 +1000,7 @@ export interface PolicyConfig {
};
};
antivirus_registration: {
mode?: AntivirusRegistrationModes;
mode: AntivirusRegistrationModes;
enabled: boolean;
};
attack_surface_reduction: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,28 +169,4 @@ describe('Policy Form Antivirus Registration Card', () => {
expect(getRadioButton(antivirusTestSubj.syncRadioButton).checked).toBe(true);
});
});

describe('when antivirus_registration.mode is not available (serverless rollout)', () => {
beforeEach(() => {
delete formProps.policy.windows.antivirus_registration.mode;
});

it('should show disabled if `antivirus_registration.enabled` is false', () => {
formProps.policy.windows.antivirus_registration.enabled = false;
render();

expect(getRadioButton(antivirusTestSubj.disabledRadioButton).checked).toBe(true);
expect(getRadioButton(antivirusTestSubj.enabledRadioButton).checked).toBe(false);
expect(getRadioButton(antivirusTestSubj.syncRadioButton).checked).toBe(false);
});

it('should show enabled if `antivirus_registration.enabled` is true', () => {
formProps.policy.windows.antivirus_registration.enabled = true;
render();

expect(getRadioButton(antivirusTestSubj.disabledRadioButton).checked).toBe(false);
expect(getRadioButton(antivirusTestSubj.enabledRadioButton).checked).toBe(true);
expect(getRadioButton(antivirusTestSubj.syncRadioButton).checked).toBe(false);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,7 @@ export const AntivirusRegistrationCard = memo<AntivirusRegistrationCardProps>(
const getTestId = useTestIdGenerator(dataTestSubj);
const isProtectionsAllowed = !useGetProtectionsUnavailableComponent();
const isEditMode = mode === 'edit';

let currentMode: AntivirusRegistrationModes;
if (policy.windows.antivirus_registration.mode) {
currentMode = policy.windows.antivirus_registration.mode;
} else {
currentMode = policy.windows.antivirus_registration.enabled
? AntivirusRegistrationModes.enabled
: AntivirusRegistrationModes.disabled;
}
const currentMode = policy.windows.antivirus_registration.mode;

const labels: Record<AntivirusRegistrationModes, React.ReactNode> = useMemo(
() => ({
Expand Down

0 comments on commit 2e9099d

Please sign in to comment.