Skip to content

Commit a2a742f

Browse files
committed
fixed monitoring tests
1 parent d31f044 commit a2a742f

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

x-pack/plugins/monitoring/server/alerts/cluster_state.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ describe('getClusterState', () => {
9696
it('should alert if green -> yellow', async () => {
9797
const result = await setupAlert(AlertClusterStateState.Green, AlertClusterStateState.Yellow);
9898
expect(executeActions).toHaveBeenCalledWith(
99-
undefined,
99+
services.alertInstanceFactory(ALERT_TYPE_CLUSTER_STATE),
100100
cluster,
101101
AlertClusterStateState.Yellow,
102102
emailAddress
@@ -110,7 +110,7 @@ describe('getClusterState', () => {
110110
it('should alert if yellow -> green', async () => {
111111
const result = await setupAlert(AlertClusterStateState.Yellow, AlertClusterStateState.Green);
112112
expect(executeActions).toHaveBeenCalledWith(
113-
undefined,
113+
services.alertInstanceFactory(ALERT_TYPE_CLUSTER_STATE),
114114
cluster,
115115
AlertClusterStateState.Green,
116116
emailAddress,
@@ -124,7 +124,7 @@ describe('getClusterState', () => {
124124
it('should alert if green -> red', async () => {
125125
const result = await setupAlert(AlertClusterStateState.Green, AlertClusterStateState.Red);
126126
expect(executeActions).toHaveBeenCalledWith(
127-
undefined,
127+
services.alertInstanceFactory(ALERT_TYPE_CLUSTER_STATE),
128128
cluster,
129129
AlertClusterStateState.Red,
130130
emailAddress
@@ -138,7 +138,7 @@ describe('getClusterState', () => {
138138
it('should alert if red -> green', async () => {
139139
const result = await setupAlert(AlertClusterStateState.Red, AlertClusterStateState.Green);
140140
expect(executeActions).toHaveBeenCalledWith(
141-
undefined,
141+
services.alertInstanceFactory(ALERT_TYPE_CLUSTER_STATE),
142142
cluster,
143143
AlertClusterStateState.Green,
144144
emailAddress,

x-pack/plugins/monitoring/server/alerts/license_expiration.test.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ describe('getLicenseExpiration', () => {
9595
}
9696

9797
afterEach(() => {
98+
jest.clearAllMocks();
9899
(executeActions as jest.Mock).mockClear();
99100
(getPreparedAlert as jest.Mock).mockClear();
100101
});
@@ -124,7 +125,7 @@ describe('getLicenseExpiration', () => {
124125
const newState = result[clusterUuid] as AlertLicensePerClusterState;
125126
expect(newState.expiredCheckDateMS > 0).toBe(true);
126127
expect(executeActions).toHaveBeenCalledWith(
127-
undefined,
128+
services.alertInstanceFactory(ALERT_TYPE_LICENSE_EXPIRATION),
128129
cluster,
129130
moment.utc(expiryDateMS),
130131
dateFormat,
@@ -146,7 +147,7 @@ describe('getLicenseExpiration', () => {
146147
const newState = result[clusterUuid] as AlertLicensePerClusterState;
147148
expect(newState.expiredCheckDateMS).toBe(0);
148149
expect(executeActions).toHaveBeenCalledWith(
149-
undefined,
150+
services.alertInstanceFactory(ALERT_TYPE_LICENSE_EXPIRATION),
150151
cluster,
151152
moment.utc(expiryDateMS),
152153
dateFormat,
@@ -185,7 +186,7 @@ describe('getLicenseExpiration', () => {
185186
const newState = result[clusterUuid] as AlertLicensePerClusterState;
186187
expect(newState.expiredCheckDateMS > 0).toBe(true);
187188
expect(executeActions).toHaveBeenCalledWith(
188-
undefined,
189+
services.alertInstanceFactory(ALERT_TYPE_LICENSE_EXPIRATION),
189190
cluster,
190191
moment.utc(expiryDateMS),
191192
dateFormat,

0 commit comments

Comments
 (0)