Alerting: Fix flakey silence test (#61395)

This commit is contained in:
Gilles De Mey 2023-01-12 18:32:25 +01:00 committed by GitHub
parent 447e56b557
commit 6b620c79e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -268,7 +268,6 @@ describe('Silence edit', () => {
const start = new Date(); const start = new Date();
const end = new Date(start.getTime() + 24 * 60 * 60 * 1000); const end = new Date(start.getTime() + 24 * 60 * 60 * 1000);
const now = dateTime().format('YYYY-MM-DD HH:mm');
const startDateString = dateTime(start).format('YYYY-MM-DD'); const startDateString = dateTime(start).format('YYYY-MM-DD');
const endDateString = dateTime(end).format('YYYY-MM-DD'); const endDateString = dateTime(end).format('YYYY-MM-DD');
@ -312,7 +311,7 @@ describe('Silence edit', () => {
expect(mocks.api.createOrUpdateSilence).toHaveBeenCalledWith( expect(mocks.api.createOrUpdateSilence).toHaveBeenCalledWith(
'grafana', 'grafana',
expect.objectContaining({ expect.objectContaining({
comment: `created ${now}`, comment: expect.stringMatching(/created (\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2})/),
matchers: [ matchers: [
{ isEqual: true, isRegex: false, name: 'foo', value: 'bar' }, { isEqual: true, isRegex: false, name: 'foo', value: 'bar' },
{ isEqual: false, isRegex: false, name: 'bar', value: 'buzz' }, { isEqual: false, isRegex: false, name: 'bar', value: 'buzz' },