Skip to content

Split all the BulkAll and ScrollAll related tests into their own file… #3390

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
321 changes: 0 additions & 321 deletions src/Tests/Tests/Document/Multiple/BulkAll/BulkAllApiTests.cs

This file was deleted.

52 changes: 52 additions & 0 deletions src/Tests/Tests/Document/Multiple/BulkAll/BulkAllApiTestsBase.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Elastic.Xunit.XunitPlumbing;
using FluentAssertions;
using Nest;
using Tests.Core.Extensions;
using Tests.Core.ManagedElasticsearch.Clusters;
using Tests.Framework.Integration;
using Xunit;

namespace Tests.Document.Multiple.BulkAll
{
public abstract class BulkAllApiTestsBase : IClusterFixture<IntrusiveOperationCluster>, IClassFixture<EndpointUsage>
{
protected BulkAllApiTestsBase(IntrusiveOperationCluster cluster, EndpointUsage usage) => this.Client = cluster.Client;

protected class SmallObject
{
public int Id { get; set; }
}

protected IElasticClient Client { get; }

protected static string CreateIndexName() => $"project-copy-{Guid.NewGuid().ToString("N").Substring(8)}";

protected IEnumerable<SmallObject> CreateLazyStreamOfDocuments(int count)
{
for (var i = 0; i < count; i++)
yield return new SmallObject() { Id = i };
}

protected async Task CreateIndexAsync(string indexName, int numberOfShards)
{
var result = await this.Client.CreateIndexAsync(indexName, s => s
.Settings(settings => settings
.NumberOfShards(numberOfShards)
.NumberOfReplicas(0)
)
);
result.Should().NotBeNull();
result.ShouldBeValid();
}
protected static void OnError(ref Exception ex, Exception e, EventWaitHandle handle)
{
ex = e;
handle.Set();
throw e;
}
}
}
Loading