Skip to content

Commit

Permalink
[8.x] [ingest pipeline mgmt] sort list of ip location databases for c…
Browse files Browse the repository at this point in the history
…onsistent output (#197361) (#197672)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[ingest pipeline mgmt] sort list of ip location databases for
consistent output
(#197361)](#197361)

<!--- Backport version: 8.9.8 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Matthew
Kime","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-10-24T10:06:06Z","message":"[ingest
pipeline mgmt] sort list of ip location databases for consistent output
(#197361)\n\n## Summary\r\n\r\nSort ip location database list for api
output. Consistent results are\r\ntestable results.\r\n\r\nCloses:
https://github.com/elastic/kibana/issues/196765","sha":"fb2452e1a129fbefe0866b734ae4111e63222cad","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Kibana
Management","release_note:skip","v9.0.0","Feature:Ingest Node
Pipelines","backport:prev-minor"],"number":197361,"url":"https://github.com/elastic/kibana/pull/197361","mergeCommit":{"message":"[ingest
pipeline mgmt] sort list of ip location databases for consistent output
(#197361)\n\n## Summary\r\n\r\nSort ip location database list for api
output. Consistent results are\r\ntestable results.\r\n\r\nCloses:
https://github.com/elastic/kibana/issues/196765","sha":"fb2452e1a129fbefe0866b734ae4111e63222cad"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","labelRegex":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/197361","number":197361,"mergeCommit":{"message":"[ingest
pipeline mgmt] sort list of ip location databases for consistent output
(#197361)\n\n## Summary\r\n\r\nSort ip location database list for api
output. Consistent results are\r\ntestable results.\r\n\r\nCloses:
https://github.com/elastic/kibana/issues/196765","sha":"fb2452e1a129fbefe0866b734ae4111e63222cad"}}]}]
BACKPORT-->
  • Loading branch information
mattkime authored Oct 25, 2024
1 parent cd01cb5 commit cf69825
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ export default function ({ getService }: FtrProviderContext) {
const ipinfoDatabaseName = 'asn';
const normalizedIpinfoDatabaseName = 'asn';

// Failing: See https://github.com/elastic/kibana/issues/196765
describe.skip('Manage databases', function () {
describe('Manage databases', function () {
after(async () => {
await ingestPipelines.api.deleteGeoipDatabases();
});
Expand Down Expand Up @@ -67,16 +66,16 @@ export default function ({ getService }: FtrProviderContext) {
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',
},
]);
});
});
Expand Down

0 comments on commit cf69825

Please sign in to comment.