Skip to content

Commit ea5e741

Browse files
committed
added more scroll tests for #326
1 parent d86490e commit ea5e741

File tree

2 files changed

+42
-5
lines changed

2 files changed

+42
-5
lines changed

src/Tests/Nest.Tests.Integration/Search/Scroll/ScrollTests.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
using System.Linq;
22
using Elasticsearch.Net;
3+
using FluentAssertions;
34
using Nest.Tests.MockData.Domain;
45
using NUnit.Framework;
5-
using FluentAssertions;
66

77
namespace Nest.Tests.Integration.Search.Scroll
88
{
@@ -108,5 +108,18 @@ public void SearchTypeScanMoreThanOne()
108108
}
109109
Assert.AreEqual(scanResults.Total, hitCount);
110110
}
111+
112+
private readonly string _scrollId = "c2Nhbjs1Ozc3NjgyOjYwZFRpNmJwVGZPdUpRNkh2cmRBSmc7Nzc2ODU6NjBkVGk2YnBUZk91SlE2SHZyZEFKZzs3NzY4NDo2MGRUaTZicFRmT3VKUTZIdnJkQUpnOzc3NjgxOjYwZFRpNmJwVGZPdUpRNkh2cmRBSmc7Nzc2ODM6NjBkVGk2YnBUZk91SlE2SHZyZEFKZzsxO3RvdGFsX2hpdHM6Mjs=";
113+
[Test]
114+
public void DoesNotThrowOnBase64()
115+
{
116+
var results = this.Client.Scroll<ElasticsearchProject>(s =>s
117+
.Scroll("4s")
118+
.ScrollId(_scrollId));
119+
120+
results.IsValid.Should().BeFalse();
121+
results.RequestInformation.HttpStatusCode.Should().Be(503);
122+
123+
}
111124
}
112125
}

src/Tests/Nest.Tests.Unit/ObjectInitializer/Scroll/ScrollRequestTests.cs

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using Elasticsearch.Net;
1+
using Elasticsearch.Net;
52
using FluentAssertions;
63
using Nest.Tests.MockData.Domain;
74
using NUnit.Framework;
@@ -34,4 +31,31 @@ public void ScrollBody()
3431
}
3532
}
3633

34+
[TestFixture]
35+
public class ScrollRequestBase64Tests : BaseJsonTests
36+
{
37+
private readonly IElasticsearchResponse _status;
38+
private readonly string _scrollId = "c2Nhbjs1Ozc3NjgyOjYwZFRpNmJwVGZPdUpRNkh2cmRBSmc7Nzc2ODU6NjBkVGk2YnBUZk91SlE2SHZyZEFKZzs3NzY4NDo2MGRUaTZicFRmT3VKUTZIdnJkQUpnOzc3NjgxOjYwZFRpNmJwVGZPdUpRNkh2cmRBSmc7Nzc2ODM6NjBkVGk2YnBUZk91SlE2SHZyZEFKZzsxO3RvdGFsX2hpdHM6Mjs=";
39+
40+
public ScrollRequestBase64Tests()
41+
{
42+
var request = new ScrollRequest(_scrollId, "5m");
43+
var response = this._client.Scroll<ElasticsearchProject>(request);
44+
this._status = response.ConnectionStatus;
45+
}
46+
47+
[Test]
48+
public void Url()
49+
{
50+
this._status.RequestUrl.Should().EndWith("/_search/scroll?scroll=5m");
51+
this._status.RequestMethod.Should().Be("POST");
52+
}
53+
54+
[Test]
55+
public void ScrollBody()
56+
{
57+
this._status.Request.Utf8String().Should().Be(_scrollId);
58+
}
59+
}
60+
3761
}

0 commit comments

Comments
 (0)