From e626acbc24cc1178b3951c9ced3b4da9e3fd386b Mon Sep 17 00:00:00 2001 From: Sonia Aguilar <33540275+soniaAguilarPeiron@users.noreply.github.com> Date: Tue, 2 Dec 2025 13:39:56 +0100 Subject: [PATCH] Alerting: Fix RuleEditorCloudRules test flakiness in CI (#114695) Tests: Fix RuleEditorCloudRules test flakiness in CI Mock the labels plugin as not installed to ensure consistent test behavior across OSS and Enterprise environments. The labels plugin detection was causing different API calls to be made in CI vs local, leading to snapshot mismatches. This test is focused on cloud rule creation, not label plugin functionality, so explicitly disabling the plugin ensures the test remains stable. --- .../unified/rule-editor/RuleEditorCloudRules.test.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/public/app/features/alerting/unified/rule-editor/RuleEditorCloudRules.test.tsx b/public/app/features/alerting/unified/rule-editor/RuleEditorCloudRules.test.tsx index 36da4810c9e..1d70def2ae4 100644 --- a/public/app/features/alerting/unified/rule-editor/RuleEditorCloudRules.test.tsx +++ b/public/app/features/alerting/unified/rule-editor/RuleEditorCloudRules.test.tsx @@ -3,6 +3,7 @@ import { clickSelectOption } from 'test/helpers/selectOptionInTest'; import { screen } from 'test/test-utils'; import { selectors } from '@grafana/e2e-selectors'; +import * as pluginSettings from 'app/features/plugins/pluginSettings'; import { AccessControlAction } from 'app/types/accessControl'; import { ExpressionEditorProps } from '../components/rule-editor/ExpressionEditor'; @@ -33,6 +34,10 @@ setupPluginsExtensionsHook(); describe('RuleEditor cloud', () => { beforeEach(() => { + // Mock getPluginSettings to ensure labels plugin is not detected + // This ensures consistent test behavior across OSS and Enterprise environments + jest.spyOn(pluginSettings, 'getPluginSettings').mockRejectedValue(new Error('Plugin not found')); + grantUserPermissions([ AccessControlAction.AlertingRuleRead, AccessControlAction.AlertingRuleUpdate,