mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
AzureMonitor: Fix dimension migration (#62485)
Remove unneeded properties post migration
This commit is contained in:
@@ -155,6 +155,27 @@ describe('AzureMonitor: migrateQuery', () => {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
it('correctly removes outdated fields', () => {
|
||||||
|
const result = migrateQuery({
|
||||||
|
...azureMonitorQueryV8,
|
||||||
|
azureMonitor: { dimension: 'testDimension', dimensionFilter: 'testFilter' },
|
||||||
|
});
|
||||||
|
expect(result).toMatchObject(
|
||||||
|
expect.objectContaining({
|
||||||
|
azureMonitor: expect.objectContaining({
|
||||||
|
dimensionFilters: [
|
||||||
|
{
|
||||||
|
dimension: 'testDimension',
|
||||||
|
operator: 'eq',
|
||||||
|
filters: ['testFilter'],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
);
|
||||||
|
expect(result.azureMonitor).not.toHaveProperty('dimension');
|
||||||
|
expect(result.azureMonitor).not.toHaveProperty('dimensionFilter');
|
||||||
|
});
|
||||||
|
|
||||||
it('correctly migrates a metric definition', () => {
|
it('correctly migrates a metric definition', () => {
|
||||||
const result = migrateQuery({ ...azureMonitorQueryV8, azureMonitor: { metricDefinition: 'ms.ns/mn' } });
|
const result = migrateQuery({ ...azureMonitorQueryV8, azureMonitor: { metricDefinition: 'ms.ns/mn' } });
|
||||||
|
|||||||
@@ -103,6 +103,9 @@ function migrateDimensionToDimensionFilter(query: AzureMonitorQuery): AzureMonit
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delete workingQuery.azureMonitor?.dimension;
|
||||||
|
delete workingQuery.azureMonitor?.dimensionFilter;
|
||||||
|
|
||||||
return workingQuery;
|
return workingQuery;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user