Skip to content

Commit

Permalink
fix FTR test
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-tavares committed Jul 10, 2023
1 parent 3c708b6 commit d21550d
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
EuiText,
EuiTextArea,
} from '@elastic/eui';
import { PROTECTION_NOTICE_SUPPORTED_ENDPOINT_VERSION } from '../protection_notice_supported_endpoint_version';
import { useTestIdGenerator } from '../../../../../hooks/use_test_id_generator';
import { getEmptyValue } from '../../../../../../common/components/empty_value';
import { useLicense } from '../../../../../../common/hooks/use_license';
Expand Down Expand Up @@ -264,12 +265,9 @@ export const SupportedVersionForProtectionNotice = React.memo(
'data-test-subj'?: string;
}) => {
const version = useMemo(() => {
return {
malware: '7.11+',
ransomware: '7.12+',
memory_protection: '7.15+',
behavior_protection: '7.15+',
}[protection];
return PROTECTION_NOTICE_SUPPORTED_ENDPOINT_VERSION[
protection as keyof typeof PROTECTION_NOTICE_SUPPORTED_ENDPOINT_VERSION
];
}, [protection]);

if (!version) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
*/

export { PolicySettingsForm } from './policy_settings_form';
export { PROTECTION_NOTICE_SUPPORTED_ENDPOINT_VERSION } from './protection_notice_supported_endpoint_version';
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

export const PROTECTION_NOTICE_SUPPORTED_ENDPOINT_VERSION = Object.freeze({
malware: '7.11+',
ransomware: '7.12+',
memory_protection: '7.15+',
behavior_protection: '7.15+',
});
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import expect from '@kbn/expect';
import { IndexedHostsAndAlertsResponse } from '@kbn/security-solution-plugin/common/endpoint/index_data';
import { popupVersionsMap } from '@kbn/security-solution-plugin/public/management/pages/policy/view/policy_forms/protections/popup_options_to_versions';
import { PROTECTION_NOTICE_SUPPORTED_ENDPOINT_VERSION } from '@kbn/security-solution-plugin/public/management/pages/policy/view/policy_settings_form';
import { FtrProviderContext } from '../../ftr_provider_context';
import { PolicyTestResourceInfo } from '../../services/endpoint_policy';

Expand Down Expand Up @@ -108,7 +108,10 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
);

expect(await supportedVersionElement.getVisibleText()).to.equal(
'Agent version ' + popupVersionsMap.get(protection)
'Agent version ' +
PROTECTION_NOTICE_SUPPORTED_ENDPOINT_VERSION[
protection as keyof typeof PROTECTION_NOTICE_SUPPORTED_ENDPOINT_VERSION
]
);
});

Expand Down

0 comments on commit d21550d

Please sign in to comment.