Skip to content

Conversation

@Mpdreamz
Copy link
Member

@Mpdreamz Mpdreamz commented Jul 2, 2019

Moves our virtual clustering we use in tests into its own package.

@Mpdreamz Mpdreamz requested review from codebrain and russcam July 2, 2019 20:13
@Mpdreamz Mpdreamz force-pushed the feature/7.x/virtual-connection branch from 4fb2b02 to f3f5280 Compare August 7, 2019 07:58
@Mpdreamz
Copy link
Member Author

Mpdreamz commented Aug 7, 2019

Rebased, the idea behind spinning this off into its own project is

To help testing, since many interfaces are gone mocking is not an option. This is by design we feel that you should mock the boundaries you control in your application (service layers/etc) injecting a connection that behaves a certain way can aid with testing though and VirtualConnection can help out here.

E.g for elastic/apm-agent-dotnet#329 I want to use this to write unit test for the clients integration with APM.

Copy link
Contributor

@russcam russcam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes look good, but I left some comments around naming and descriptions


namespace Elasticsearch.Net.Virtual
{
public class VirtualizedCluster
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VirtualCluster, to align with VirtualConnection?

<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>Elasticsearch.Net.Virtual</id>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Naming is hard 😃

Elasticsearch.Net.Virtual feels somewhat vague. The package is a way to mock/stub a cluster, with a specific IConnection implementation. Would Elasticsearch.Net.VirtualCluster, or Elasticsearch.Net.MockCluster or Elasticsearch.Net.StubCluster or Elasticsearch.Net.FakeCluster better convey the usage?

<iconUrl>https://raw.githubusercontent.com/elastic/elasticsearch-net/master/build/nuget-icon.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<summary>Provides a way to assert cluent behaviour through a rule engine backed VirtualClusterConnection</summary>
<description>Provides a way to assert cluent behaviour through a rule engine backed VirtualClusterConnection</description>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<description>Provides a way to assert cluent behaviour through a rule engine backed VirtualClusterConnection</description>
<description>Provides a way to assert client behaviour through a rule engine backed VirtualClusterConnection</description>

<summary>Provides a way to assert cluent behaviour through a rule engine backed VirtualClusterConnection</summary>
<description>Provides a way to assert cluent behaviour through a rule engine backed VirtualClusterConnection</description>
<releaseNotes>See https://github.com/elastic/elasticsearch-net/releases/tag/$version$</releaseNotes>
<copyright>2014-$year$ Elasticsearch BV</copyright>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<copyright>2014-$year$ Elasticsearch BV</copyright>
<copyright>2019-$year$ Elasticsearch BV</copyright>

<description>Provides a way to assert cluent behaviour through a rule engine backed VirtualClusterConnection</description>
<releaseNotes>See https://github.com/elastic/elasticsearch-net/releases/tag/$version$</releaseNotes>
<copyright>2014-$year$ Elasticsearch BV</copyright>
<tags>elasticsearch,elastic,search,lucene,nest</tags>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<tags>elasticsearch,elastic,search,lucene,nest</tags>
<tags>elasticsearch,elastic,search,lucene,nest,tests,testing</tags>

<iconUrl>https://raw.githubusercontent.com/elastic/elasticsearch-net/master/build/nuget-icon.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<summary>Provides a way to assert cluent behaviour through a rule engine backed VirtualClusterConnection</summary>
<description>Provides a way to assert cluent behaviour through a rule engine backed VirtualClusterConnection</description>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be useful to also mention that it's useful for testing purposes?

@Mpdreamz Mpdreamz merged commit 25c0019 into 7.x Sep 24, 2019
@Mpdreamz Mpdreamz deleted the feature/7.x/virtual-connection branch September 24, 2019 14:38
Mpdreamz added a commit that referenced this pull request Sep 24, 2019
* rename Serializer subfolder to Auxiliary

* introduced seperate project for virtual cluster

* VirtualCluster auditor returns a more real fake response

* moved WaitingInMemoryConnection back

* Union was copied twice

* make sure VirtualClusterConnection is exposed

* Add Elasticsearch.Net.Virtual as project into the build

* do not rely on HttpClientException on net461

* Exception test needs to be .NET core specific now

* build for canary was still looking in Serializers folder not Auxiliary

* canary handling for Elasticsearch.Net.Virtual

* skip nuget testing for Elasticearch.Net.Virtual

* reference TestPackageVersion of Elasticsearch.Net optionally

* still included csproj

* Use targetting pack and made sure canary works under linux too

* Update build/Elasticsearch.Net.Virtual.nuspec

Co-Authored-By: Russ Cam <russ.cam@elastic.co>

* Client on VirtualizedCluster became public on 7.x, mirror that here

* change namespace to Elasticsearch.Net.VirtualizedCluster

* update tests from 7.x and bumped sdk version

* bump global json back

* canary build needs to resolve Elasticsearch.Net reference as nuget for virtualized cluster project

* bulk all exception tests canary ignore

* bulk all exception tests canary ignore

* make test less strict

* skip test on CI

(cherry picked from commit 25c0019)
russcam pushed a commit that referenced this pull request Oct 1, 2019
* rename Serializer subfolder to Auxiliary

* introduced seperate project for virtual cluster

* VirtualCluster auditor returns a more real fake response

* moved WaitingInMemoryConnection back

* Union was copied twice

* make sure VirtualClusterConnection is exposed

* Add Elasticsearch.Net.Virtual as project into the build

* do not rely on HttpClientException on net461

* Exception test needs to be .NET core specific now

* build for canary was still looking in Serializers folder not Auxiliary

* canary handling for Elasticsearch.Net.Virtual

* skip nuget testing for Elasticearch.Net.Virtual

* reference TestPackageVersion of Elasticsearch.Net optionally

* still included csproj

* Use targetting pack and made sure canary works under linux too

* Update build/Elasticsearch.Net.Virtual.nuspec

Co-Authored-By: Russ Cam <russ.cam@elastic.co>

* Client on VirtualizedCluster became public on 7.x, mirror that here

* change namespace to Elasticsearch.Net.VirtualizedCluster

* update tests from 7.x and bumped sdk version

* bump global json back

* canary build needs to resolve Elasticsearch.Net reference as nuget for virtualized cluster project

* bulk all exception tests canary ignore

* bulk all exception tests canary ignore

* make test less strict

* skip test on CI
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants