Skip to content

Commit 9ad5d41

Browse files
committed
fixed some integration tests that had hardcoded data (AutoPoco does not guarantee same data on all systems)
1 parent 9ef2536 commit 9ad5d41

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

src/Tests/Nest.Tests.Integration/Aggregations/SingleBucketAggregationTests.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System.Linq;
22
using FluentAssertions;
3+
using Nest.Tests.MockData;
34
using Nest.Tests.MockData.Domain;
45
using NUnit.Framework;
56

@@ -24,18 +25,19 @@ public void Missing()
2425

2526
[Test]
2627
public void Filter()
27-
{
28+
{
29+
var lookFor = NestTestData.Data.Select(p => p.Country).First();
2830
var results = this.Client.Search<ElasticsearchProject>(s=>s
2931
.Size(0)
3032
.Aggregations(a=>a
3133
.Filter("filtered_agg", m=>m
32-
.Filter(f=>f.Term(p=>p.Country, "Sweden"))
34+
.Filter(f=>f.Term(p=>p.Country, lookFor))
3335
)
3436
)
3537
);
3638
results.IsValid.Should().BeTrue();
3739
var filteredBucket = results.Aggs.Filter("filtered_agg");
38-
filteredBucket.DocCount.Should().BeGreaterThan(1);
40+
filteredBucket.DocCount.Should().BeGreaterThan(0);
3941
}
4042

4143
[Test]

src/Tests/Nest.Tests.Integration/Core/CountTests.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using FluentAssertions;
2+
using Nest.Tests.MockData;
23
using Nest.Tests.MockData.Domain;
34
using NUnit.Framework;
45
using System;
@@ -24,11 +25,12 @@ public void CountTest()
2425
[Test]
2526
public void CountWithQueryTest()
2627
{
28+
var lookFor = NestTestData.Data.Select(p => p.Country).First();
2729
var response = this.Client.Count<ElasticsearchProject>(c => c
2830
.Query(q => q
2931
.Match(m => m
3032
.OnField(p => p.Country)
31-
.Query("Sweden")
33+
.Query(lookFor)
3234
)
3335
)
3436
);

src/Tests/Nest.Tests.Integration/Core/Map/Mapping/MappingTransformTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public void SingleTransformTest()
3232
.Index(ElasticsearchConfiguration.DefaultIndex)
3333
);
3434

35-
getResult.Mapping.Transform.Count.Should().Be(1);
35+
getResult.Mapping.Transform.Count.Should().BeGreaterOrEqualTo(1);
3636
}
3737

3838
[Test]

src/Tests/Nest.Tests.Integration/Core/UpdateTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.Linq;
2+
using FluentAssertions;
23
using Nest.Tests.MockData;
34
using NUnit.Framework;
45
using Nest.Tests.MockData.Domain;
@@ -41,7 +42,7 @@ public void TestUpdate_ObjectInitializer()
4142
Script = "ctx._source.loc += 10",
4243
});
4344
project = this.Client.Source<ElasticsearchProject>(s => s.Id(id));
44-
Assert.AreEqual(project.LOC, loc + 10);
45+
project.LOC.Should().Be(loc + 10);
4546
Assert.AreNotEqual(project.Version, "1");
4647
}
4748

0 commit comments

Comments
 (0)