[Obs UX] Unskip transaction duration alerts test (#174069)

Closes https://github.com/elastic/kibana/issues/173267

### Summary

Test was likely failing because the opbeans-java alert was not deleted
from previous tests. To prevent that from happening again, I've changed
the test to make sure the rules are cleaned before each test.

https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4707

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Miriam 2024-01-03 11:07:00 +00:00 committed by GitHub
parent 3ce276dbae
commit e9508e3946
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -44,8 +44,7 @@ export default function ApiTest({ getService }: FtrProviderContext) {
groupBy: ['service.name', 'service.environment', 'transaction.type', 'transaction.name'],
};
// FLAKY: https://github.com/elastic/kibana/issues/173267
registry.when.skip('transaction duration alert', { config: 'basic', archives: [] }, () => {
registry.when('transaction duration alert', { config: 'basic', archives: [] }, () => {
before(async () => {
const opbeansJava = apm
.service({ name: 'opbeans-java', environment: 'production', agentName: 'java' })
@ -192,7 +191,7 @@ export default function ApiTest({ getService }: FtrProviderContext) {
let ruleId: string;
let alerts: ApmAlertFields[];
before(async () => {
beforeEach(async () => {
const createdRule = await createApmRule({
supertest,
ruleTypeId: ApmRuleType.TransactionDuration,
@ -213,7 +212,7 @@ export default function ApiTest({ getService }: FtrProviderContext) {
alerts = await waitForAlertsForRule({ es, ruleId });
});
after(async () => {
afterEach(async () => {
await cleanupRuleAndAlertState({ es, supertest, logger });
});
@ -235,8 +234,7 @@ export default function ApiTest({ getService }: FtrProviderContext) {
expect(alerts[0]).property('transaction.name', 'tx-node');
});
// FLAKY: https://github.com/elastic/kibana/issues/173127
it.skip('shows alert count=1 for opbeans-node on service inventory', async () => {
it('shows alert count=1 for opbeans-node on service inventory', async () => {
const serviceInventoryAlertCounts = await fetchServiceInventoryAlertCounts(apmApiClient);
expect(serviceInventoryAlertCounts).to.eql({
'opbeans-node': 1,