mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
[ingest pipeline mgmt] sort list of ip location databases for consistent output (#197361)
## Summary Sort ip location database list for api output. Consistent results are testable results. Closes: https://github.com/elastic/kibana/issues/196765
This commit is contained in:
parent
bd11d1ae5d
commit
fb2452e1a1
2 changed files with 10 additions and 12 deletions
|
@ -5,6 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import sortBy from 'lodash/sortBy';
|
||||
import { deserializeGeoipDatabase, type GeoipDatabaseFromES } from './serialization';
|
||||
import { API_BASE_PATH } from '../../../../common/constants';
|
||||
import { RouteDependencies } from '../../../types';
|
||||
|
@ -21,9 +22,9 @@ export const registerListDatabaseRoute = ({
|
|||
databases: GeoipDatabaseFromES[];
|
||||
};
|
||||
|
||||
const geoipDatabases = data.databases;
|
||||
const body = sortBy(data.databases.map(deserializeGeoipDatabase), 'name');
|
||||
|
||||
return res.ok({ body: geoipDatabases.map(deserializeGeoipDatabase) });
|
||||
return res.ok({ body });
|
||||
} catch (error) {
|
||||
const esErrorResponse = handleEsError({ error, response: res });
|
||||
if (esErrorResponse.status === 404) {
|
||||
|
|
|
@ -18,9 +18,7 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
const ipinfoDatabaseName = 'asn';
|
||||
const normalizedIpinfoDatabaseName = 'asn';
|
||||
|
||||
// Failing: See https://github.com/elastic/kibana/issues/196765
|
||||
// Failing: See https://github.com/elastic/kibana/issues/196765
|
||||
describe.skip('Manage databases', function () {
|
||||
describe('Manage databases', function () {
|
||||
after(async () => {
|
||||
await ingestPipelines.api.deleteGeoipDatabases();
|
||||
});
|
||||
|
@ -64,21 +62,20 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
});
|
||||
});
|
||||
|
||||
// FLAKY: https://github.com/elastic/kibana/issues/196765
|
||||
describe.skip('List', () => {
|
||||
describe('List', () => {
|
||||
it('returns existing databases', async () => {
|
||||
const { body } = await supertest.get(url).set('kbn-xsrf', 'xxx').expect(200);
|
||||
expect(body).to.eql([
|
||||
{
|
||||
id: normalizedIpinfoDatabaseName,
|
||||
name: ipinfoDatabaseName,
|
||||
type: 'ipinfo',
|
||||
},
|
||||
{
|
||||
id: normalizedMaxmindDatabaseName,
|
||||
name: maxmindDatabaseName,
|
||||
type: 'maxmind',
|
||||
},
|
||||
{
|
||||
id: normalizedIpinfoDatabaseName,
|
||||
name: ipinfoDatabaseName,
|
||||
type: 'ipinfo',
|
||||
},
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue