Skip to content

Commit c2a480b

Browse files
author
elasticsearchmachine
committed
Merge remote-tracking branch 'origin/main' into lucene_snapshot
2 parents 4721a67 + b23984d commit c2a480b

File tree

73 files changed

+2275
-742
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+2275
-742
lines changed

docs/changelog/114457.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pr: 114457
2+
summary: "[Inference API] Introduce Update API to change some aspects of existing\
3+
\ inference endpoints"
4+
area: Machine Learning
5+
type: enhancement
6+
issues: []
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the "Elastic License
4+
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
5+
* Public License v 1"; you may not use this file except in compliance with, at
6+
* your election, the "Elastic License 2.0", the "GNU Affero General Public
7+
* License v3.0 only", or the "Server Side Public License, v 1".
8+
*/
9+
10+
package org.elasticsearch.ingest.geoip;
11+
12+
import org.elasticsearch.common.util.set.Sets;
13+
import org.elasticsearch.test.ESTestCase;
14+
15+
import java.util.Set;
16+
17+
import static org.hamcrest.Matchers.empty;
18+
import static org.hamcrest.Matchers.equalTo;
19+
import static org.hamcrest.Matchers.is;
20+
21+
public class DatabaseTests extends ESTestCase {
22+
23+
public void testDatabasePropertyInvariants() {
24+
// the city database is like a specialization of the country database
25+
assertThat(Sets.difference(Database.Country.properties(), Database.City.properties()), is(empty()));
26+
assertThat(Sets.difference(Database.Country.defaultProperties(), Database.City.defaultProperties()), is(empty()));
27+
28+
// the isp database is like a specialization of the asn database
29+
assertThat(Sets.difference(Database.Asn.properties(), Database.Isp.properties()), is(empty()));
30+
assertThat(Sets.difference(Database.Asn.defaultProperties(), Database.Isp.defaultProperties()), is(empty()));
31+
32+
// the enterprise database is like these other databases joined together
33+
for (Database type : Set.of(
34+
Database.City,
35+
Database.Country,
36+
Database.Asn,
37+
Database.AnonymousIp,
38+
Database.ConnectionType,
39+
Database.Domain,
40+
Database.Isp
41+
)) {
42+
assertThat(Sets.difference(type.properties(), Database.Enterprise.properties()), is(empty()));
43+
}
44+
// but in terms of the default fields, it's like a drop-in replacement for the city database
45+
// n.b. this is just a choice we decided to make here at Elastic
46+
assertThat(Database.Enterprise.defaultProperties(), equalTo(Database.City.defaultProperties()));
47+
}
48+
49+
public void testDatabaseVariantPropertyInvariants() {
50+
// the second ASN variant database is like a specialization of the ASN database
51+
assertThat(Sets.difference(Database.Asn.properties(), Database.AsnV2.properties()), is(empty()));
52+
assertThat(Database.Asn.defaultProperties(), equalTo(Database.AsnV2.defaultProperties()));
53+
54+
// the second City variant database is like a version of the ordinary City database but lacking many fields
55+
assertThat(Sets.difference(Database.CityV2.properties(), Database.City.properties()), is(empty()));
56+
assertThat(Sets.difference(Database.CityV2.defaultProperties(), Database.City.defaultProperties()), is(empty()));
57+
58+
// the second Country variant database is like a version of the ordinary Country database but lacking come fields
59+
assertThat(Sets.difference(Database.CountryV2.properties(), Database.CountryV2.properties()), is(empty()));
60+
assertThat(Database.CountryV2.defaultProperties(), equalTo(Database.Country.defaultProperties()));
61+
}
62+
}

0 commit comments

Comments
 (0)