Skip to content

Commit 74f9af4

Browse files
authored
7.x integration tests fixes (#4166)
* fix #4154 should be more version independent * fix putmapping API test now that [Shape] is no longer attributed on ArbitraryShape
1 parent a13e933 commit 74f9af4

File tree

6 files changed

+10
-112
lines changed

6 files changed

+10
-112
lines changed

src/Tests/Tests.Core/ManagedElasticsearch/NodeSeeders/DefaultSeeder.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -342,9 +342,6 @@ public static PropertiesDescriptor<TProject> ProjectProperties<TProject>(Propert
342342
.GeoShape(g => g
343343
.Name(p => p.LocationShape)
344344
)
345-
.Shape(g => g
346-
.Name(p => p.ArbitraryShape)
347-
)
348345
.Completion(cm => cm
349346
.Name(p => p.Suggest)
350347
.Contexts(cx => cx
@@ -377,6 +374,11 @@ public static PropertiesDescriptor<TProject> ProjectProperties<TProject>(Propert
377374
.Enabled(false)
378375
);
379376

377+
if (TestConfiguration.Instance.InRange(">=7.4.0"))
378+
props.Shape(g => g
379+
.Name(p => p.ArbitraryShape)
380+
);
381+
380382
return props;
381383
}
382384

src/Tests/Tests.Domain/Project.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ public class Project
4545
public SimpleGeoPoint LocationPoint { get; set; }
4646
public IGeoShape LocationShape { get; set; }
4747

48-
[Shape] // Explicity map as a shape type
4948
public IGeoShape ArbitraryShape { get; set; }
5049
public Dictionary<string, Metadata> Metadata { get; set; }
5150
public string Name { get; set; }

src/Tests/Tests/CodeStandards/Serialization/Enums.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
using FluentAssertions;
1212
using Nest;
1313
using Tests.Core.Serialization;
14-
using Tests.QueryDsl.Geo.Shape;
1514
using Tests.XPack.MachineLearning;
1615

1716
namespace Tests.CodeStandards.Serialization

src/Tests/Tests/Indices/MappingManagement/PutMapping/PutMappingApiTest.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ public PutMappingApiTests(WritableCluster cluster, EndpointUsage usage) : base(c
164164
.Name(p => p.Name)
165165
.Index(false)
166166
)
167+
.Shape(shape => shape.Name(p => p.ArbitraryShape))
167168
.Object<Developer>(o => o
168169
.Name(p => p.LeadDeveloper)
169170
.AutoMap()

src/Tests/Tests/QueryDsl/Specialized/Shape/ShapeQueryUsageTests.cs

Lines changed: 2 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
using Tests.Domain;
66
using Tests.Framework.EndpointTests.TestState;
77

8-
namespace Tests.QueryDsl.Geo.Shape
8+
namespace Tests.QueryDsl.Specialized.Shape
99
{
1010
/**
1111
* Like geo_shape, Elasticsearch supports the ability to index arbitrary two dimension (non Geospatial) geometries making
@@ -14,6 +14,7 @@ namespace Tests.QueryDsl.Geo.Shape
1414
*
1515
* See the Elasticsearch documentation on {ref_current}/query-dsl-shape-query.html[shape queries] for more detail.
1616
*/
17+
[SkipVersion("<7.4.0", "Shape queries introduced in 7.4.0+")]
1718
public abstract class ShapeQueryUsageTestsBase : QueryDslUsageTestsBase
1819
{
1920
protected static readonly GeoCoordinate CircleCoordinates = new GeoCoordinate(-45.0, 45.0);
@@ -153,58 +154,6 @@ protected override QueryContainer QueryFluent(QueryContainerDescriptor<Project>
153154
);
154155
}
155156

156-
// hide
157-
[SkipVersion(">=7.0.0", "Multipoint queries are not supported in shape queries")]
158-
public class ShapeMultiPointQueryUsageTests : ShapeQueryUsageTestsBase
159-
{
160-
public ShapeMultiPointQueryUsageTests(ReadOnlyCluster i, EndpointUsage usage) : base(i, usage) { }
161-
162-
protected override ConditionlessWhen ConditionlessWhen => new ConditionlessWhen<IShapeQuery>(a => a.Shape)
163-
{
164-
q => q.Field = null,
165-
q => q.Shape = null,
166-
q => ((IMultiPointGeoShape)q.Shape).Coordinates = null,
167-
};
168-
169-
protected override QueryContainer QueryInitializer => new ShapeQuery
170-
{
171-
Name = "named_query",
172-
Boost = 1.1,
173-
Field = Infer.Field<Project>(p => p.ArbitraryShape),
174-
Shape = new MultiPointGeoShape(MultiPointCoordinates),
175-
Relation = ShapeRelation.Intersects,
176-
};
177-
178-
protected override object QueryJson => new
179-
{
180-
shape = new
181-
{
182-
_name = "named_query",
183-
boost = 1.1,
184-
arbitraryShape = new
185-
{
186-
relation = "intersects",
187-
shape = new
188-
{
189-
type = "multipoint",
190-
coordinates = MultiPointCoordinates
191-
}
192-
}
193-
}
194-
};
195-
196-
protected override QueryContainer QueryFluent(QueryContainerDescriptor<Project> q) => q
197-
.Shape(c => c
198-
.Name("named_query")
199-
.Boost(1.1)
200-
.Field(p => p.ArbitraryShape)
201-
.Shape(s => s
202-
.MultiPoint(MultiPointCoordinates)
203-
)
204-
.Relation(ShapeRelation.Intersects)
205-
);
206-
}
207-
208157
/**
209158
* [float]
210159
* [[shape-query-linestring]]
@@ -597,59 +546,6 @@ protected override QueryContainer QueryFluent(QueryContainerDescriptor<Project>
597546
);
598547
}
599548

600-
// hide
601-
[SkipVersion(">=7.0.0", "Circle queries are not supported in shape queries")]
602-
public class ShapeCircleQueryUsageTests : ShapeQueryUsageTestsBase
603-
{
604-
public ShapeCircleQueryUsageTests(ReadOnlyCluster i, EndpointUsage usage) : base(i, usage) { }
605-
606-
protected override ConditionlessWhen ConditionlessWhen => new ConditionlessWhen<IShapeQuery>(a => a.Shape)
607-
{
608-
q => q.Field = null,
609-
q => q.Shape = null,
610-
q => ((ICircleGeoShape)q.Shape).Coordinates = null,
611-
};
612-
613-
protected override QueryContainer QueryInitializer => new ShapeQuery
614-
{
615-
Name = "named_query",
616-
Boost = 1.1,
617-
Field = Infer.Field<Project>(p => p.ArbitraryShape),
618-
Shape = new CircleGeoShape(CircleCoordinates, "100m"),
619-
Relation = ShapeRelation.Intersects,
620-
};
621-
622-
protected override object QueryJson => new
623-
{
624-
shape = new
625-
{
626-
_name = "named_query",
627-
boost = 1.1,
628-
arbitraryShape = new
629-
{
630-
relation = "intersects",
631-
shape = new
632-
{
633-
type = "circle",
634-
radius = "100m",
635-
coordinates = CircleCoordinates
636-
}
637-
}
638-
}
639-
};
640-
641-
protected override QueryContainer QueryFluent(QueryContainerDescriptor<Project> q) => q
642-
.Shape(c => c
643-
.Name("named_query")
644-
.Boost(1.1)
645-
.Field(p => p.ArbitraryShape)
646-
.Shape(s => s
647-
.Circle(CircleCoordinates, "100m")
648-
)
649-
.Relation(ShapeRelation.Intersects)
650-
);
651-
}
652-
653549
/**
654550
* [float]
655551
* [[shape-query-indexedshape]]

src/Tests/Tests/QueryDsl/Specialized/Shape/ShapeSerializationTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@
1212
using Tests.Framework.EndpointTests;
1313
using Tests.Framework.EndpointTests.TestState;
1414

15-
namespace Tests.QueryDsl.Geo.Shape
15+
namespace Tests.QueryDsl.Specialized.Shape
1616
{
17+
[SkipVersion("<7.4.0", "Shape queries introduced in 7.4.0+")]
1718
public abstract class ShapeSerializationTestsBase
1819
: ApiIntegrationTestBase<IntrusiveOperationCluster,
1920
ISearchResponse<Domain.Shape>,

0 commit comments

Comments
 (0)