Skip to content

Commit b24cc44

Browse files
committed
chore(security, tests): log a warning in tests if deprecated feature privilege is replaced with more privileges than necessary
1 parent 193eb33 commit b24cc44

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

x-pack/test/security_api_integration/tests/features/deprecated_features.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,13 +316,25 @@ export default function ({ getService }: FtrProviderContext) {
316316
for (const deprecatedAction of deprecatedActions) {
317317
if (
318318
isReplaceableAction(deprecatedAction) &&
319-
!replacementActions.has(deprecatedAction)
319+
!replacementActions.delete(deprecatedAction)
320320
) {
321321
throw new Error(
322322
`Action "${deprecatedAction}" granted by the privilege "${privilegeId}" of the deprecated feature "${feature.id}" is not properly replaced.`
323323
);
324324
}
325325
}
326+
327+
const extraReplacementActions =
328+
Array.from(replacementActions).filter(isReplaceableAction);
329+
if (extraReplacementActions.length > 0) {
330+
log.warning(
331+
`Replacement actions for the privilege "${privilegeId}" of the deprecated feature "${
332+
feature.id
333+
}" grant more privileges than they were granting before: ${JSON.stringify(
334+
extraReplacementActions
335+
)} via ${JSON.stringify(replacedBy)}.`
336+
);
337+
}
326338
}
327339
}
328340
});

0 commit comments

Comments
 (0)