From 8e13878684a992151bcd7bafc5211abf804a4406 Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Mon, 23 Jan 2023 16:32:50 +0100 Subject: [PATCH] fix #1 include better integration tests for IndexChannel and DataStreamChannel (#2) * fix #1 include better integration tests for IndexChannel and DataStreamChannel * include shared Elastic DotSettings file * update license headers * remove unwanted linefeed in shared settings to apply standard license header --- .github/add-license-headers.sh | 0 elastic-ingest-dotnet.sln | 2 +- elastic-ingest-dotnet.sln.DotSettings | 430 ++++++++++++++++++ src/Elastic.Ingest.Apm/ApmChannelOptions.cs | 3 + src/Elastic.Ingest.Apm/Helpers/Time.cs | 3 + .../Model/IngestResponse.cs | 3 + src/Elastic.Ingest.Apm/Model/Transaction.cs | 3 + .../DataStreams/DataStreamChannel.cs | 3 + .../DataStreams/DataStreamChannelOptions.cs | 3 + .../DataStreams/DataStreamName.cs | 3 + .../ElasticsearchBufferOptions.cs | 3 + .../ElasticsearchChannelBase.cs | 3 + .../ElasticsearchChannelOptionsBase.cs | 3 + .../Indices/IndexChannel.cs | 5 +- .../Indices/IndexChannelOptions.cs | 17 +- .../IsExternalInit.cs | 3 + .../Serialization/BulkOperationHeader.cs | 3 + .../Serialization/BulkResponse.cs | 3 + .../Serialization/BulkResponseItem.cs | 3 + .../CustomActivityExporter.cs | 5 +- .../CustomOtlpTraceExporter.cs | 3 + .../TransportChannelOptionsBase.cs | 3 + src/Elastic.Ingest/ChannelBuffer.cs | 3 + src/Elastic.Ingest/ChannelOptionsBase.cs | 3 + .../DataStreamIngestionTests.cs | 70 +++ ...est.Elasticsearch.IntegrationTests.csproj} | 0 .../IndexIngestionTests.cs | 70 +++ .../IngestionCluster.cs | 40 ++ .../IntegrationTestBase.cs | 25 + .../TestDocument.cs | 28 ++ .../CommonSchemaIngestionTests.cs | 63 --- .../IngestionCluster.cs | 14 - .../TestDocument.cs | 9 - tests/Elastic.Ingest.Tests/BehaviorTests.cs | 3 + .../Elasticsearch/BulkResponseBuilder.cs | 3 + .../ElasticsearchChannelTests.cs | 3 + .../Elasticsearch/SerializationTests.cs | 3 + .../Elasticsearch/Setup.cs | 5 +- .../Elasticsearch/TestDocument.cs | 3 + 39 files changed, 761 insertions(+), 91 deletions(-) mode change 100644 => 100755 .github/add-license-headers.sh create mode 100644 elastic-ingest-dotnet.sln.DotSettings create mode 100644 tests/Elastic.Ingest.Elasticsearch.IntegrationTests/DataStreamIngestionTests.cs rename tests/{Elastic.Ingest.IntegrationTests/Elastic.Ingest.IntegrationTests.csproj => Elastic.Ingest.Elasticsearch.IntegrationTests/Elastic.Ingest.Elasticsearch.IntegrationTests.csproj} (100%) create mode 100644 tests/Elastic.Ingest.Elasticsearch.IntegrationTests/IndexIngestionTests.cs create mode 100644 tests/Elastic.Ingest.Elasticsearch.IntegrationTests/IngestionCluster.cs create mode 100644 tests/Elastic.Ingest.Elasticsearch.IntegrationTests/IntegrationTestBase.cs create mode 100644 tests/Elastic.Ingest.Elasticsearch.IntegrationTests/TestDocument.cs delete mode 100644 tests/Elastic.Ingest.IntegrationTests/CommonSchemaIngestionTests.cs delete mode 100644 tests/Elastic.Ingest.IntegrationTests/IngestionCluster.cs delete mode 100644 tests/Elastic.Ingest.IntegrationTests/TestDocument.cs diff --git a/.github/add-license-headers.sh b/.github/add-license-headers.sh old mode 100644 new mode 100755 diff --git a/elastic-ingest-dotnet.sln b/elastic-ingest-dotnet.sln index ef8fb5d..b190796 100644 --- a/elastic-ingest-dotnet.sln +++ b/elastic-ingest-dotnet.sln @@ -36,7 +36,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elastic.Ingest.Transport", EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elastic.Ingest.Tests", "tests\Elastic.Ingest.Tests\Elastic.Ingest.Tests.csproj", "{F6A52569-8F07-4E1E-935E-7AE9D664EF77}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elastic.Ingest.IntegrationTests", "tests\Elastic.Ingest.IntegrationTests\Elastic.Ingest.IntegrationTests.csproj", "{E09CEEE6-DD3A-4603-890D-6364C7E4639F}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elastic.Ingest.Elasticsearch.IntegrationTests", "tests\Elastic.Ingest.Elasticsearch.IntegrationTests\Elastic.Ingest.Elasticsearch.IntegrationTests.csproj", "{E09CEEE6-DD3A-4603-890D-6364C7E4639F}" EndProject Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "scripts", "build\scripts\scripts.fsproj", "{8AFDD165-F5B1-4555-97E3-A376B30236D3}" EndProject diff --git a/elastic-ingest-dotnet.sln.DotSettings b/elastic-ingest-dotnet.sln.DotSettings new file mode 100644 index 0000000..ca8a101 --- /dev/null +++ b/elastic-ingest-dotnet.sln.DotSettings @@ -0,0 +1,430 @@ + + Licensed to Elasticsearch B.V under one or more agreements. +Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +See the LICENSE file in the project root for more information + True + True + 56A87048-9065-459B-826D-3DF68B409845/d:Views + + *.Doc.cs + True + HINT + <?xml version="1.0" encoding="utf-16"?><Profile name="SilentCodeCleanUp"><AspOptimizeRegisterDirectives>True</AspOptimizeRegisterDirectives><HtmlReformatCode>True</HtmlReformatCode><CSArrangeThisQualifier>True</CSArrangeThisQualifier><CSUseAutoProperty>True</CSUseAutoProperty><CSMakeFieldReadonly>True</CSMakeFieldReadonly><CSUseVar><BehavourStyle>CAN_CHANGE_TO_IMPLICIT</BehavourStyle><LocalVariableStyle>IMPLICIT_WHEN_INITIALIZER_HAS_TYPE</LocalVariableStyle><ForeachVariableStyle>ALWAYS_IMPLICIT</ForeachVariableStyle></CSUseVar><CSOptimizeUsings><OptimizeUsings>True</OptimizeUsings><EmbraceInRegion>False</EmbraceInRegion><RegionName></RegionName></CSOptimizeUsings><CSShortenReferences>True</CSShortenReferences><CSReformatCode>True</CSReformatCode><CSharpFormatDocComments>True</CSharpFormatDocComments><CSReorderTypeMembers>True</CSReorderTypeMembers><JsInsertSemicolon>True</JsInsertSemicolon><JsReformatCode>True</JsReformatCode><JsFormatDocComments>True</JsFormatDocComments><XMLReformatCode>True</XMLReformatCode><CssReformatCode>True</CssReformatCode><CssAlphabetizeProperties>True</CssAlphabetizeProperties><StyleCop.Documentation><SA1600ElementsMustBeDocumented>False</SA1600ElementsMustBeDocumented><SA1604ElementDocumentationMustHaveSummary>False</SA1604ElementDocumentationMustHaveSummary><SA1609PropertyDocumentationMustHaveValueDocumented>False</SA1609PropertyDocumentationMustHaveValueDocumented><SA1611ElementParametersMustBeDocumented>False</SA1611ElementParametersMustBeDocumented><SA1615ElementReturnValueMustBeDocumented>False</SA1615ElementReturnValueMustBeDocumented><SA1617VoidReturnValueMustNotBeDocumented>False</SA1617VoidReturnValueMustNotBeDocumented><SA1618GenericTypeParametersMustBeDocumented>False</SA1618GenericTypeParametersMustBeDocumented><SA1626SingleLineCommentsMustNotUseDocumentationStyleSlashes>False</SA1626SingleLineCommentsMustNotUseDocumentationStyleSlashes><SA1628DocumentationTextMustBeginWithACapitalLetter>False</SA1628DocumentationTextMustBeginWithACapitalLetter><SA1629DocumentationTextMustEndWithAPeriod>False</SA1629DocumentationTextMustEndWithAPeriod><SA1633SA1641UpdateFileHeader>Ignore</SA1633SA1641UpdateFileHeader><SA1639FileHeaderMustHaveSummary>False</SA1639FileHeaderMustHaveSummary><SA1642ConstructorSummaryDocumentationMustBeginWithStandardText>False</SA1642ConstructorSummaryDocumentationMustBeginWithStandardText><SA1643DestructorSummaryDocumentationMustBeginWithStandardText>False</SA1643DestructorSummaryDocumentationMustBeginWithStandardText><SA1644DocumentationHeadersMustNotContainBlankLines>False</SA1644DocumentationHeadersMustNotContainBlankLines></StyleCop.Documentation><CSArrangeQualifiers>True</CSArrangeQualifiers><CSCodeStyleAttributes ArrangeTypeAccessModifier="True" ArrangeTypeMemberAccessModifier="True" SortModifiers="True" RemoveRedundantParentheses="True" AddMissingParentheses="True" ArrangeBraces="True" ArrangeAttributes="True" ArrangeArgumentsStyle="True" ArrangeCodeBodyStyle="True" ArrangeVarStyle="True" /><IDEA_SETTINGS>&lt;profile version="1.0"&gt; + &lt;option name="myName" value="SilentCodeCleanUp" /&gt; +&lt;/profile&gt;</IDEA_SETTINGS><CSUpdateFileHeader>True</CSUpdateFileHeader></Profile> + SilentCodeCleanUp + SilentCodeCleanUp + False + OPTIMAL_FILL + 0 + 1 + 0 + 1 + 0 + TOGETHER_SAME_LINE + ALWAYS_ADD + ALWAYS_ADD + ALWAYS_ADD + ALWAYS_ADD + ALWAYS_ADD + ALWAYS_ADD + Tab + True + IF_OWNER_IS_SINGLE_LINE + IF_OWNER_IS_SINGLE_LINE + True + IF_OWNER_IS_SINGLE_LINE + True + True + False + True + True + False + False + True + True + True + True + False + CHOP_IF_LONG + 150 + CHOP_IF_LONG + DoNotTouch + DoNotTouch + <?xml version="1.0" encoding="utf-16"?> +<Patterns xmlns="urn:schemas-jetbrains-com:member-reordering-patterns"> + <TypePattern DisplayName="COM interfaces or structs" RemoveRegions="All" Priority="100"> + <TypePattern.Match> + <Or> + <And> + <Kind Is="Interface" /> + <Or> + <HasAttribute Name="System.Runtime.InteropServices.InterfaceTypeAttribute" /> + <HasAttribute Name="System.Runtime.InteropServices.ComImport" /> + </Or> + </And> + <Kind Is="Struct" /> + </Or> + </TypePattern.Match> + </TypePattern> + <TypePattern DisplayName="Interfaces"> + <TypePattern.Match> + <Kind Is="Interface" /> + </TypePattern.Match> + <Entry DisplayName="Properties First"> + <Entry.Match> + <Kind Is="Property" /> + </Entry.Match> + <Entry.SortBy> + <Kind Is="Member" /> + <Name /> + </Entry.SortBy> + </Entry> + <Entry DisplayName="Rest sorted by kind and name"> + <Entry.SortBy> + <Kind Is="Member" /> + <Name /> + </Entry.SortBy> + </Entry> + </TypePattern> + <TypePattern DisplayName="Default Pattern" RemoveRegions="All" Priority="0"> + <Entry DisplayName="Public Delegates" Priority="100"> + <Entry.Match> + <And> + <Access Is="Public" /> + <Kind Is="Delegate" /> + </And> + </Entry.Match> + <Entry.SortBy> + <Name /> + </Entry.SortBy> + </Entry> + <Entry DisplayName="Public Enums" Priority="100"> + <Entry.Match> + <And> + <Access Is="Public" /> + <Kind Is="Enum" /> + </And> + </Entry.Match> + <Entry.SortBy> + <Name /> + </Entry.SortBy> + </Entry> + <Entry DisplayName="Static Fields and Constants"> + <Entry.Match> + <Or> + <Kind Is="Constant" /> + <And> + <Kind Is="Field" /> + <Static /> + </And> + </Or> + </Entry.Match> + <Entry.SortBy> + <Kind Is="Member" /> + <Name Is="Enter Pattern Here" /> + </Entry.SortBy> + </Entry> + <Entry DisplayName="Readonly Fields"> + <Entry.Match> + <And> + <And> + <Kind Is="Field" /> + <Not> + <Static /> + </Not> + <Readonly /> + </And> + </And> + </Entry.Match> + <Entry.SortBy> + <Access /> + <Readonly /> + <Name Is="Enter Pattern Here" /> + </Entry.SortBy> + </Entry> + <Entry DisplayName="Constructors"> + <Entry.Match> + <Kind Is="Constructor" /> + </Entry.Match> + <Entry.SortBy> + <Static /> + </Entry.SortBy> + </Entry> + <Entry DisplayName="Abstract members"> + <Entry.Match> + <Abstract /> + </Entry.Match> + <Entry.SortBy> + <Kind Is="Member" /> + <Name /> + </Entry.SortBy> + </Entry> + <Entry DisplayName="Properties, Indexers, Assignable Fields"> + <Entry.Match> + <Or> + <Kind Is="Property" /> + <Kind Is="Indexer" /> + <And> + <Kind Is="Field" /> + <Not> + <Readonly /> + </Not> + </And> + </Or> + </Entry.Match> + <Entry.SortBy> + <Name /> + </Entry.SortBy> + </Entry> + <Entry DisplayName="All other members" /> + <Entry DisplayName="Nested Types"> + <Entry.Match> + <Kind Is="Type" /> + </Entry.Match> + </Entry> + </TypePattern> +</Patterns> + <Patterns xmlns="urn:shemas-jetbrains-com:member-reordering-patterns"> + + <!--Do not reorder COM interfaces--> + <Pattern RemoveAllRegions="true"> + <Match> + <And Weight="100"> + <Kind Is="interface"/> + <HasAttribute CLRName="System.Runtime.InteropServices.InterfaceTypeAttribute"/> + </And> + </Match> + </Pattern> + + <!--Special formatting of NUnit test fixture--> + <Pattern RemoveAllRegions="true"> + <Match> + <And Weight="100"> + <Kind Is="class"/> + <HasAttribute CLRName="NUnit.Framework.TestFixtureAttribute" Inherit="true"/> + </And> + </Match> + + <!--Setup/Teardown--> + <Entry> + <Match> + <And> + <Kind Is="method"/> + <Or> + <HasAttribute CLRName="NUnit.Framework.SetUpAttribute" Inherit="true"/> + <HasAttribute CLRName="NUnit.Framework.TearDownAttribute" Inherit="true"/> + <HasAttribute CLRName="NUnit.Framework.FixtureSetUpAttribute" Inherit="true"/> + <HasAttribute CLRName="NUnit.Framework.FixtureTearDownAttribute" Inherit="true"/> + </Or> + </And> + </Match> + </Entry> + + <!--All other members--> + <Entry/> + + <!--Test methods--> + <Entry> + <Match> + <And Weight="100"> + <Kind Is="method"/> + <HasAttribute CLRName="NUnit.Framework.TestAttribute" Inherit="false"/> + </And> + </Match> + <Sort> + <Name/> + </Sort> + </Entry> + </Pattern> + + <!--Default pattern--> + <Pattern RemoveAllRegions="true"> + + <!--Delegates--> + <Entry> + <Match> + <And Weight="100"> + <Access Is="public"/> + <Kind Is="delegate"/> + </And> + </Match> + <Sort> + <Access Order="public internal protected-internal protected private" /> + <Name/> + </Sort> + </Entry> + + <!--Fields and constants--> + <Entry> + <Match> + <Or> + <Kind Is="field"/> + <Kind Is="constant"/> + </Or> + </Match> + <Sort> + <Access Order="public internal protected-internal protected private" /> + <Kind Order="constant"/> + <Readonly/> + <Static/> + <Name/> + </Sort> + </Entry> + + <!--Enums--> + <Entry> + <Match> + <Kind Is="enum"/> + </Match> + <Sort> + <Access Order="public internal protected-internal protected private" /> + <Name/> + </Sort> + </Entry> + + <!--Constructors. Place static one first--> + <Entry> + <Match> + <Kind Is="constructor"/> + </Match> + <Sort> + <Static/> + <Access Order="public internal protected-internal protected private" /> + </Sort> + </Entry> + + <!--Destructors. Place static one first--> + <Entry> + <Match> + <Kind Is="destructor"/> + </Match> + <Sort> + <Static/> + <Access Order="public internal protected-internal protected private" /> + </Sort> + </Entry> + + <!-- Events --> + <Entry> + <Match> + <Kind Is="event"/> + </Match> + <Sort> + <Access Order="public internal protected-internal protected private" /> + <Name/> + </Sort> + </Entry> + + <!--Properties--> + <Entry> + <Match> + <And> + <Kind Is="property"/> + <Not> + <Kind Is="indexer"/> + </Not> + </And> + </Match> + <Sort> + <Access Order="public internal protected-internal protected private" /> + <Static/> + <Abstract/> + <Virtual/> + <Override/> + <Name/> + </Sort> + </Entry> + + <!--Indexers--> + <Entry> + <Match> + <Kind Is="indexer"/> + </Match> + <Sort> + <Access Order="public internal protected-internal protected private" /> + <Static/> + <Abstract/> + <Virtual/> + <Override/> + <Name/> + </Sort> + </Entry> + + <!--Methods--> + <Entry> + <Match> + <And> + <Or> + <Kind Is="method"/> + <Kind Is="operator"/> + <HandlesEvent /> + </Or> + <Not> + <Kind Is="destructor"/> + </Not> + </And> + </Match> + <Sort> + <Access Order="public internal protected-internal protected private" /> + <Static/> + <Abstract/> + <Virtual/> + <Override/> + <Name/> + </Sort> + </Entry> + + <!--all other members--> + <Entry/> + + <!--nested types--> + <Entry> + <Match> + <Kind Is="type"/> + </Match> + <Sort> + <Access Order="public internal protected-internal protected private" /> + <Static/> + <Abstract/> + <Virtual/> + <Override/> + <Name/> + </Sort> + </Entry> + </Pattern> +</Patterns> + CustomLayout + False + False + False + True + Replace + True + False + True + Default body (from options) + True + Default body (from options) + True + False + KM + False + True + True + True + True + True + True + False + True + HotTrack + Hack + (?<=\W|^)(?<TAG>HACK)(\W|$)(.*) + Warning + True + True + True + True + True + True diff --git a/src/Elastic.Ingest.Apm/ApmChannelOptions.cs b/src/Elastic.Ingest.Apm/ApmChannelOptions.cs index b46a208..65f55bd 100644 --- a/src/Elastic.Ingest.Apm/ApmChannelOptions.cs +++ b/src/Elastic.Ingest.Apm/ApmChannelOptions.cs @@ -1,3 +1,6 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information using System; using Elastic.Ingest.Apm.Model; using Elastic.Ingest.Transport; diff --git a/src/Elastic.Ingest.Apm/Helpers/Time.cs b/src/Elastic.Ingest.Apm/Helpers/Time.cs index 2f5b564..c94ee2b 100644 --- a/src/Elastic.Ingest.Apm/Helpers/Time.cs +++ b/src/Elastic.Ingest.Apm/Helpers/Time.cs @@ -1,3 +1,6 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information using System; namespace Elastic.Ingest.Apm.Helpers diff --git a/src/Elastic.Ingest.Apm/Model/IngestResponse.cs b/src/Elastic.Ingest.Apm/Model/IngestResponse.cs index 0a193b2..28b8932 100644 --- a/src/Elastic.Ingest.Apm/Model/IngestResponse.cs +++ b/src/Elastic.Ingest.Apm/Model/IngestResponse.cs @@ -1,3 +1,6 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information using System.Collections.Generic; using System.Text.Json.Serialization; using Elastic.Transport; diff --git a/src/Elastic.Ingest.Apm/Model/Transaction.cs b/src/Elastic.Ingest.Apm/Model/Transaction.cs index 532ecae..0ab3f75 100644 --- a/src/Elastic.Ingest.Apm/Model/Transaction.cs +++ b/src/Elastic.Ingest.Apm/Model/Transaction.cs @@ -1,3 +1,6 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information using System.Collections.Generic; using System.Text.Json.Serialization; diff --git a/src/Elastic.Ingest.Elasticsearch/DataStreams/DataStreamChannel.cs b/src/Elastic.Ingest.Elasticsearch/DataStreams/DataStreamChannel.cs index c5b5cb9..b30a1fa 100644 --- a/src/Elastic.Ingest.Elasticsearch/DataStreams/DataStreamChannel.cs +++ b/src/Elastic.Ingest.Elasticsearch/DataStreams/DataStreamChannel.cs @@ -1,3 +1,6 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information using System.Collections.Generic; using Elastic.Ingest.Elasticsearch.Serialization; diff --git a/src/Elastic.Ingest.Elasticsearch/DataStreams/DataStreamChannelOptions.cs b/src/Elastic.Ingest.Elasticsearch/DataStreams/DataStreamChannelOptions.cs index bfff523..d5bf032 100644 --- a/src/Elastic.Ingest.Elasticsearch/DataStreams/DataStreamChannelOptions.cs +++ b/src/Elastic.Ingest.Elasticsearch/DataStreams/DataStreamChannelOptions.cs @@ -1,3 +1,6 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information using Elastic.Transport; namespace Elastic.Ingest.Elasticsearch.DataStreams diff --git a/src/Elastic.Ingest.Elasticsearch/DataStreams/DataStreamName.cs b/src/Elastic.Ingest.Elasticsearch/DataStreams/DataStreamName.cs index fd1c2fb..6818b57 100644 --- a/src/Elastic.Ingest.Elasticsearch/DataStreams/DataStreamName.cs +++ b/src/Elastic.Ingest.Elasticsearch/DataStreams/DataStreamName.cs @@ -1,3 +1,6 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information using System; using System.Linq; diff --git a/src/Elastic.Ingest.Elasticsearch/ElasticsearchBufferOptions.cs b/src/Elastic.Ingest.Elasticsearch/ElasticsearchBufferOptions.cs index c96fc0c..da1e6e5 100644 --- a/src/Elastic.Ingest.Elasticsearch/ElasticsearchBufferOptions.cs +++ b/src/Elastic.Ingest.Elasticsearch/ElasticsearchBufferOptions.cs @@ -1,3 +1,6 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information using Elastic.Ingest.Elasticsearch.Serialization; namespace Elastic.Ingest.Elasticsearch diff --git a/src/Elastic.Ingest.Elasticsearch/ElasticsearchChannelBase.cs b/src/Elastic.Ingest.Elasticsearch/ElasticsearchChannelBase.cs index 4fc99b2..ec370f4 100644 --- a/src/Elastic.Ingest.Elasticsearch/ElasticsearchChannelBase.cs +++ b/src/Elastic.Ingest.Elasticsearch/ElasticsearchChannelBase.cs @@ -1,3 +1,6 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information using System; using System.Collections.Generic; using System.IO; diff --git a/src/Elastic.Ingest.Elasticsearch/ElasticsearchChannelOptionsBase.cs b/src/Elastic.Ingest.Elasticsearch/ElasticsearchChannelOptionsBase.cs index a9d00dc..bda0a55 100644 --- a/src/Elastic.Ingest.Elasticsearch/ElasticsearchChannelOptionsBase.cs +++ b/src/Elastic.Ingest.Elasticsearch/ElasticsearchChannelOptionsBase.cs @@ -1,3 +1,6 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information using Elastic.Ingest.Elasticsearch.Serialization; using Elastic.Ingest.Transport; using Elastic.Transport; diff --git a/src/Elastic.Ingest.Elasticsearch/Indices/IndexChannel.cs b/src/Elastic.Ingest.Elasticsearch/Indices/IndexChannel.cs index e3d7dab..18e9e56 100644 --- a/src/Elastic.Ingest.Elasticsearch/Indices/IndexChannel.cs +++ b/src/Elastic.Ingest.Elasticsearch/Indices/IndexChannel.cs @@ -1,3 +1,6 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information using System; using Elastic.Ingest.Elasticsearch.Serialization; @@ -12,7 +15,7 @@ protected override BulkOperationHeader CreateBulkOperationHeader(TEvent @event) var indexTime = Options.TimestampLookup?.Invoke(@event) ?? DateTimeOffset.Now; if (Options.IndexOffset.HasValue) indexTime = indexTime.ToOffset(Options.IndexOffset.Value); - var index = string.Format(Options.Index, indexTime); + var index = string.Format(Options.IndexFormat, indexTime); var id = Options.BulkOperationIdLookup?.Invoke(@event); return !string.IsNullOrWhiteSpace(id) diff --git a/src/Elastic.Ingest.Elasticsearch/Indices/IndexChannelOptions.cs b/src/Elastic.Ingest.Elasticsearch/Indices/IndexChannelOptions.cs index c3d5c5a..946e25a 100644 --- a/src/Elastic.Ingest.Elasticsearch/Indices/IndexChannelOptions.cs +++ b/src/Elastic.Ingest.Elasticsearch/Indices/IndexChannelOptions.cs @@ -1,3 +1,6 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information using System; using Elastic.Transport; @@ -10,8 +13,10 @@ public IndexChannelOptions(HttpTransport transport) : base(transport) { } /// /// Gets or sets the format string for the Elastic search index. The current DateTimeOffset is passed as parameter /// 0. + /// Defaults to "dotnet-{0:yyyy.MM.dd}" + /// If no {0} parameter is defined the index name is effectively fixed /// - public string Index { get; set; } = "dotnet-{0:yyyy.MM.dd}"; + public string IndexFormat { get; set; } = "dotnet-{0:yyyy.MM.dd}"; /// /// Gets or sets the offset to use for the index DateTimeOffset. Default value is null, which uses the system local @@ -19,8 +24,18 @@ public IndexChannelOptions(HttpTransport transport) : base(transport) { } /// public TimeSpan? IndexOffset { get; set; } + /// + /// Provide a per document DateTimeOffset to be used as the date passed as parameter 0 to + /// public Func TimestampLookup { get; set; } = null!; + /// + /// If the document provides an Id this allows you to set a per document `_id`. + /// If an `_id` is defined an `_index` bulk operation will be created. + /// Otherwise (the default) `_create` bulk operation will be issued for the document. + /// Read more about bulk operations here: + /// https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html#bulk-api-request-body + /// public Func BulkOperationIdLookup { get; set; } = null!; } } diff --git a/src/Elastic.Ingest.Elasticsearch/IsExternalInit.cs b/src/Elastic.Ingest.Elasticsearch/IsExternalInit.cs index 8909ece..15850eb 100644 --- a/src/Elastic.Ingest.Elasticsearch/IsExternalInit.cs +++ b/src/Elastic.Ingest.Elasticsearch/IsExternalInit.cs @@ -1,3 +1,6 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information // ReSharper disable once CheckNamespace namespace System.Runtime.CompilerServices { diff --git a/src/Elastic.Ingest.Elasticsearch/Serialization/BulkOperationHeader.cs b/src/Elastic.Ingest.Elasticsearch/Serialization/BulkOperationHeader.cs index fb4533a..c2ae4ac 100644 --- a/src/Elastic.Ingest.Elasticsearch/Serialization/BulkOperationHeader.cs +++ b/src/Elastic.Ingest.Elasticsearch/Serialization/BulkOperationHeader.cs @@ -1,3 +1,6 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information using System; using System.Collections.Generic; using System.Collections.ObjectModel; diff --git a/src/Elastic.Ingest.Elasticsearch/Serialization/BulkResponse.cs b/src/Elastic.Ingest.Elasticsearch/Serialization/BulkResponse.cs index 5b36691..24dfe1a 100644 --- a/src/Elastic.Ingest.Elasticsearch/Serialization/BulkResponse.cs +++ b/src/Elastic.Ingest.Elasticsearch/Serialization/BulkResponse.cs @@ -1,3 +1,6 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information using System; using System.Collections.Generic; using System.Collections.ObjectModel; diff --git a/src/Elastic.Ingest.Elasticsearch/Serialization/BulkResponseItem.cs b/src/Elastic.Ingest.Elasticsearch/Serialization/BulkResponseItem.cs index c1a8366..cf88e3a 100644 --- a/src/Elastic.Ingest.Elasticsearch/Serialization/BulkResponseItem.cs +++ b/src/Elastic.Ingest.Elasticsearch/Serialization/BulkResponseItem.cs @@ -1,3 +1,6 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information using System; using System.Text.Json; using System.Text.Json.Serialization; diff --git a/src/Elastic.Ingest.OpenTelemetry/CustomActivityExporter.cs b/src/Elastic.Ingest.OpenTelemetry/CustomActivityExporter.cs index 4adeb9c..1b004ec 100644 --- a/src/Elastic.Ingest.OpenTelemetry/CustomActivityExporter.cs +++ b/src/Elastic.Ingest.OpenTelemetry/CustomActivityExporter.cs @@ -1,4 +1,7 @@ -using System.Diagnostics; +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information +using System.Diagnostics; using OpenTelemetry; namespace Elastic.Ingest.OpenTelemetry diff --git a/src/Elastic.Ingest.OpenTelemetry/CustomOtlpTraceExporter.cs b/src/Elastic.Ingest.OpenTelemetry/CustomOtlpTraceExporter.cs index 8c0c735..4cc8886 100644 --- a/src/Elastic.Ingest.OpenTelemetry/CustomOtlpTraceExporter.cs +++ b/src/Elastic.Ingest.OpenTelemetry/CustomOtlpTraceExporter.cs @@ -1,3 +1,6 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/src/Elastic.Ingest.Transport/TransportChannelOptionsBase.cs b/src/Elastic.Ingest.Transport/TransportChannelOptionsBase.cs index 85a38d6..5b17517 100644 --- a/src/Elastic.Ingest.Transport/TransportChannelOptionsBase.cs +++ b/src/Elastic.Ingest.Transport/TransportChannelOptionsBase.cs @@ -1,3 +1,6 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information using Elastic.Transport; namespace Elastic.Ingest.Transport diff --git a/src/Elastic.Ingest/ChannelBuffer.cs b/src/Elastic.Ingest/ChannelBuffer.cs index bdf906a..acbcb02 100644 --- a/src/Elastic.Ingest/ChannelBuffer.cs +++ b/src/Elastic.Ingest/ChannelBuffer.cs @@ -1,3 +1,6 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information using System; using System.Collections.Generic; using System.Collections.ObjectModel; diff --git a/src/Elastic.Ingest/ChannelOptionsBase.cs b/src/Elastic.Ingest/ChannelOptionsBase.cs index 0b5de54..efcea5c 100644 --- a/src/Elastic.Ingest/ChannelOptionsBase.cs +++ b/src/Elastic.Ingest/ChannelOptionsBase.cs @@ -1,3 +1,6 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information using System; using System.Collections.Generic; using System.IO; diff --git a/tests/Elastic.Ingest.Elasticsearch.IntegrationTests/DataStreamIngestionTests.cs b/tests/Elastic.Ingest.Elasticsearch.IntegrationTests/DataStreamIngestionTests.cs new file mode 100644 index 0000000..eb5415c --- /dev/null +++ b/tests/Elastic.Ingest.Elasticsearch.IntegrationTests/DataStreamIngestionTests.cs @@ -0,0 +1,70 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information +using System; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Elastic.Clients.Elasticsearch.IndexManagement; +using Elastic.Elasticsearch.Managed; +using Elastic.Ingest.Elasticsearch.DataStreams; +using Elastic.Transport; +using FluentAssertions; +using Xunit; +using Xunit.Abstractions; + +namespace Elastic.Ingest.Elasticsearch.IntegrationTests +{ + public class DataStreamIngestionTests : IntegrationTestBase + { + public DataStreamIngestionTests(IngestionCluster cluster, ITestOutputHelper output) : base(cluster, output) + { + } + + [Fact] + public async Task EnsureDocumentsEndUpInDataStream() + { + // logs-* will use data streams by default in Elasticsearch. + var targetDataStream = new DataStreamName("logs", "dotnet"); + var slim = new CountdownEvent(1); + var options = new DataStreamChannelOptions(Client.Transport) + { + DataStream = targetDataStream, + BufferOptions = new ElasticsearchBufferOptions + { + WaitHandle = slim, MaxConsumerBufferSize = 1, + } + }; + var ecsChannel = new DataStreamChannel(options); + + var dataStream = + await Client.Indices.GetDataStreamAsync(new GetDataStreamRequest(targetDataStream.ToString())); + dataStream.DataStreams.Should().BeNullOrEmpty(); + + ecsChannel.TryWrite(new TimeSeriesDocument { Timestamp = DateTimeOffset.Now, Message = "hello-world" }); + if (!slim.WaitHandle.WaitOne(TimeSpan.FromSeconds(10))) + throw new Exception("ecs document was not persisted within 10 seconds"); + + var refreshResult = await Client.Indices.RefreshAsync(targetDataStream.ToString()); + refreshResult.IsValidResponse.Should().BeTrue("{0}", refreshResult.DebugInformation); + var searchResult = await Client.SearchAsync(s => s.Indices(targetDataStream.ToString())); + searchResult.Total.Should().Be(1); + + var storedDocument = searchResult.Documents.First(); + storedDocument.Message.Should().Be("hello-world"); + + var hit = searchResult.Hits.First(); + hit.Index.Should().StartWith($".ds-{targetDataStream}-"); + + // the following throws in the 8.0.4 version of the client + // The JSON value could not be converted to Elastic.Clients.Elasticsearch.HealthStatus. Path: $.data_stre... + // await Client.Indices.GetDataStreamAsync(new GetDataStreamRequest(targetDataStream.ToString()) + var getDataStream = + await Client.Transport.RequestAsync(HttpMethod.GET, $"/_data_stream/{targetDataStream}"); + + getDataStream.ApiCallDetails.HttpStatusCode.Should() + .Be(200, "{0}", getDataStream.ApiCallDetails.DebugInformation); + + } + } +} diff --git a/tests/Elastic.Ingest.IntegrationTests/Elastic.Ingest.IntegrationTests.csproj b/tests/Elastic.Ingest.Elasticsearch.IntegrationTests/Elastic.Ingest.Elasticsearch.IntegrationTests.csproj similarity index 100% rename from tests/Elastic.Ingest.IntegrationTests/Elastic.Ingest.IntegrationTests.csproj rename to tests/Elastic.Ingest.Elasticsearch.IntegrationTests/Elastic.Ingest.Elasticsearch.IntegrationTests.csproj diff --git a/tests/Elastic.Ingest.Elasticsearch.IntegrationTests/IndexIngestionTests.cs b/tests/Elastic.Ingest.Elasticsearch.IntegrationTests/IndexIngestionTests.cs new file mode 100644 index 0000000..55af138 --- /dev/null +++ b/tests/Elastic.Ingest.Elasticsearch.IntegrationTests/IndexIngestionTests.cs @@ -0,0 +1,70 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information +using System; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Elastic.Clients.Elasticsearch; +using Elastic.Clients.Elasticsearch.IndexManagement; +using Elastic.Elasticsearch.Managed; +using Elastic.Ingest.Elasticsearch.DataStreams; +using Elastic.Ingest.Elasticsearch.Indices; +using Elastic.Transport; +using FluentAssertions; +using Xunit; +using Xunit.Abstractions; + +namespace Elastic.Ingest.Elasticsearch.IntegrationTests +{ + public class IndexIngestionTests : IntegrationTestBase + { + public IndexIngestionTests(IngestionCluster cluster, ITestOutputHelper output) : base(cluster, output) + { + } + + [Fact] + public async Task EnsureDocumentsEndUpInIndex() + { + var indexPrefix = "catalog-data-"; + var slim = new CountdownEvent(1); + var options = new IndexChannelOptions(Client.Transport) + { + IndexFormat = indexPrefix + "{0:yyyy.MM.dd}", + BulkOperationIdLookup = c => c.Id, + TimestampLookup = c => c.Created, + BufferOptions = new ElasticsearchBufferOptions + { + WaitHandle = slim, MaxConsumerBufferSize = 1, + } + }; + var ecsChannel = new IndexChannel(options); + + var date = DateTimeOffset.Now; + var indexName = string.Format(options.IndexFormat, date); + + var index = await Client.Indices.GetAsync(new GetIndexRequest(indexName)); + index.Indices.Should().BeNullOrEmpty(); + + ecsChannel.TryWrite(new CatalogDocument { Created = date, Title = "Hello World!", Id = "hello-world" }); + if (!slim.WaitHandle.WaitOne(TimeSpan.FromSeconds(10))) + throw new Exception("ecs document was not persisted within 10 seconds"); + + var refreshResult = await Client.Indices.RefreshAsync(indexName); + refreshResult.IsValidResponse.Should().BeTrue("{0}", refreshResult.DebugInformation); + var searchResult = await Client.SearchAsync(s => s.Indices(indexName)); + searchResult.Total.Should().Be(1); + + var storedDocument = searchResult.Documents.First(); + storedDocument.Id.Should().Be("hello-world"); + storedDocument.Title.Should().Be("Hello World!"); + + var hit = searchResult.Hits.First(); + hit.Index.Should().Be(indexName); + + index = await Client.Indices.GetAsync(new GetIndexRequest(indexName)); + index.Indices.Should().NotBeNullOrEmpty(); + + } + } +} diff --git a/tests/Elastic.Ingest.Elasticsearch.IntegrationTests/IngestionCluster.cs b/tests/Elastic.Ingest.Elasticsearch.IntegrationTests/IngestionCluster.cs new file mode 100644 index 0000000..bbcdc57 --- /dev/null +++ b/tests/Elastic.Ingest.Elasticsearch.IntegrationTests/IngestionCluster.cs @@ -0,0 +1,40 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch; +using Elastic.Elasticsearch.Xunit; +using Elastic.Transport; +using Xunit; +using Xunit.Abstractions; + +[assembly: TestFramework("Elastic.Elasticsearch.Xunit.Sdk.ElasticTestFramework", "Elastic.Elasticsearch.Xunit")] + +namespace Elastic.Ingest.Elasticsearch.IntegrationTests +{ + /// Declare our cluster that we want to inject into our test classes + public class IngestionCluster : XunitClusterBase + { + public IngestionCluster() : base(new XunitClusterConfiguration("8.3.1") { StartingPortNumber = 9202 }) { } + + public ElasticsearchClient CreateClient(ITestOutputHelper output) => + this.GetOrAddClient(c => + { + var hostName = (System.Diagnostics.Process.GetProcessesByName("mitmproxy").Any() + ? "ipv4.fiddler" + : "localhost"); + var nodes = NodesUris(hostName); + var connectionPool = new StaticNodePool(nodes); + var settings = new ElasticsearchClientSettings(connectionPool) + .Proxy(new Uri("http://ipv4.fiddler:8080"), (string)null, (string)null) + .OnRequestCompleted(d => + { + try { output.WriteLine(d.DebugInformation);} + catch { } + }) + .EnableDebugMode(); + return new ElasticsearchClient(settings); + }); + } +} diff --git a/tests/Elastic.Ingest.Elasticsearch.IntegrationTests/IntegrationTestBase.cs b/tests/Elastic.Ingest.Elasticsearch.IntegrationTests/IntegrationTestBase.cs new file mode 100644 index 0000000..dbf32f1 --- /dev/null +++ b/tests/Elastic.Ingest.Elasticsearch.IntegrationTests/IntegrationTestBase.cs @@ -0,0 +1,25 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch; +using Elastic.Elasticsearch.Xunit; +using Elastic.Elasticsearch.Xunit.XunitPlumbing; +using Elastic.Transport; +using Xunit.Abstractions; + +namespace Elastic.Ingest.Elasticsearch.IntegrationTests; + +public abstract class IntegrationTestBase : IClusterFixture +{ + private readonly ITestOutputHelper _output; + + protected ElasticsearchClient Client { get; } + + protected IntegrationTestBase(IngestionCluster cluster, ITestOutputHelper output) + { + _output = output; + Client = cluster.CreateClient(output); + } +} diff --git a/tests/Elastic.Ingest.Elasticsearch.IntegrationTests/TestDocument.cs b/tests/Elastic.Ingest.Elasticsearch.IntegrationTests/TestDocument.cs new file mode 100644 index 0000000..d9d0620 --- /dev/null +++ b/tests/Elastic.Ingest.Elasticsearch.IntegrationTests/TestDocument.cs @@ -0,0 +1,28 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information +using System; +using System.Text.Json.Serialization; + +namespace Elastic.Ingest.Elasticsearch.IntegrationTests; + +public class TimeSeriesDocument +{ + [JsonPropertyName("@timestamp")] + public DateTimeOffset Timestamp { get; set; } + + [JsonPropertyName("message")] + public string Message { get; set; } +} + +public class CatalogDocument +{ + [JsonPropertyName("id")] + public string Id { get; set; } + + [JsonPropertyName("title")] + public string Title { get; set; } + + [JsonPropertyName("created")] + public DateTimeOffset Created { get; set; } +} diff --git a/tests/Elastic.Ingest.IntegrationTests/CommonSchemaIngestionTests.cs b/tests/Elastic.Ingest.IntegrationTests/CommonSchemaIngestionTests.cs deleted file mode 100644 index c1d7fc3..0000000 --- a/tests/Elastic.Ingest.IntegrationTests/CommonSchemaIngestionTests.cs +++ /dev/null @@ -1,63 +0,0 @@ -using System; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using Elastic.Clients.Elasticsearch; -using Elastic.Clients.Elasticsearch.IndexManagement; -using Elastic.Elasticsearch.Xunit; -using Elastic.Elasticsearch.Xunit.XunitPlumbing; -using Elastic.Ingest.Elasticsearch; -using Elastic.Ingest.Elasticsearch.DataStreams; -using Elastic.Transport; -using FluentAssertions; -using Xunit; - -namespace Elastic.Ingest.IntegrationTests -{ - public class DataStreamIngestionTests : IClusterFixture - { - private ElasticsearchClient Client { get; } - - public DataStreamIngestionTests(IngestionCluster cluster) => - Client = cluster.GetOrAddClient(c => - { - var nodes = cluster.NodesUris(); - var connectionPool = new StaticNodePool(nodes); - var settings = new ElasticsearchClientSettings(connectionPool) - .EnableDebugMode(); - return new ElasticsearchClient(settings); - }); - - - [Fact] - public async Task ChannelCanSetupElasticsearchTemplates() - { - var targetDataStream = new Elasticsearch.DataStreamName("hello", "world"); - var slim = new CountdownEvent(1); - var options = new DataStreamChannelOptions(Client.Transport) - { - DataStream = targetDataStream, - BufferOptions = new ElasticsearchBufferOptions - { - WaitHandle = slim, - MaxConsumerBufferSize = 1, - } - }; - var ecsChannel = new DataStreamChannel(options); - - var dataStream = await Client.Indices.GetDataStreamAsync(new GetDataStreamRequest(targetDataStream.ToString())); - dataStream.DataStreams.Should().BeNullOrEmpty(); - - ecsChannel.TryWrite(new TestDocument { Timestamp = DateTimeOffset.Now, Message = "hello-world" }); - if (!slim.WaitHandle.WaitOne(TimeSpan.FromSeconds(10))) - throw new Exception("ecs document was not persisted within 10 seconds"); - - // Client error - // dataStream = await Client.Indices.GetDataStreamAsync(new DataStreamRequest(targetDataStream.ToString())); - // dataStream.DataStreams.Should().NotBeNullOrEmpty(); - - } - - } - -} diff --git a/tests/Elastic.Ingest.IntegrationTests/IngestionCluster.cs b/tests/Elastic.Ingest.IntegrationTests/IngestionCluster.cs deleted file mode 100644 index 4fb32e5..0000000 --- a/tests/Elastic.Ingest.IntegrationTests/IngestionCluster.cs +++ /dev/null @@ -1,14 +0,0 @@ -using Elastic.Elasticsearch.Xunit; -using Xunit; - -[assembly: TestFramework("Elastic.Elasticsearch.Xunit.Sdk.ElasticTestFramework", "Elastic.Elasticsearch.Xunit")] - -namespace Elastic.Ingest.IntegrationTests -{ - /// Declare our cluster that we want to inject into our test classes - public class IngestionCluster : XunitClusterBase - { - public IngestionCluster() : base(new XunitClusterConfiguration("8.3.1") { StartingPortNumber = 9202 }) { } - - } -} diff --git a/tests/Elastic.Ingest.IntegrationTests/TestDocument.cs b/tests/Elastic.Ingest.IntegrationTests/TestDocument.cs deleted file mode 100644 index 3605339..0000000 --- a/tests/Elastic.Ingest.IntegrationTests/TestDocument.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System; - -namespace Elastic.Ingest.IntegrationTests; - -public class TestDocument -{ - public DateTimeOffset Timestamp { get; set; } - public string Message { get; set; } -} diff --git a/tests/Elastic.Ingest.Tests/BehaviorTests.cs b/tests/Elastic.Ingest.Tests/BehaviorTests.cs index 540e474..2ddda35 100644 --- a/tests/Elastic.Ingest.Tests/BehaviorTests.cs +++ b/tests/Elastic.Ingest.Tests/BehaviorTests.cs @@ -1,3 +1,6 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information using System; using System.Collections.Generic; using System.Threading; diff --git a/tests/Elastic.Ingest.Tests/Elasticsearch/BulkResponseBuilder.cs b/tests/Elastic.Ingest.Tests/Elasticsearch/BulkResponseBuilder.cs index b484bca..7e2954b 100644 --- a/tests/Elastic.Ingest.Tests/Elasticsearch/BulkResponseBuilder.cs +++ b/tests/Elastic.Ingest.Tests/Elasticsearch/BulkResponseBuilder.cs @@ -1,3 +1,6 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information using System.Linq; namespace Elastic.Ingest.Tests.Elasticsearch diff --git a/tests/Elastic.Ingest.Tests/Elasticsearch/ElasticsearchChannelTests.cs b/tests/Elastic.Ingest.Tests/Elasticsearch/ElasticsearchChannelTests.cs index 36b28c0..8b01654 100644 --- a/tests/Elastic.Ingest.Tests/Elasticsearch/ElasticsearchChannelTests.cs +++ b/tests/Elastic.Ingest.Tests/Elasticsearch/ElasticsearchChannelTests.cs @@ -1,3 +1,6 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information using System; using Elastic.Transport.VirtualizedCluster.Rules; using FluentAssertions; diff --git a/tests/Elastic.Ingest.Tests/Elasticsearch/SerializationTests.cs b/tests/Elastic.Ingest.Tests/Elasticsearch/SerializationTests.cs index fd54a3e..e8031ae 100644 --- a/tests/Elastic.Ingest.Tests/Elasticsearch/SerializationTests.cs +++ b/tests/Elastic.Ingest.Tests/Elasticsearch/SerializationTests.cs @@ -1,3 +1,6 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information using System.Text.Json; using Elastic.Ingest.Elasticsearch.Serialization; using FluentAssertions; diff --git a/tests/Elastic.Ingest.Tests/Elasticsearch/Setup.cs b/tests/Elastic.Ingest.Tests/Elasticsearch/Setup.cs index 35f9fb0..945eb87 100644 --- a/tests/Elastic.Ingest.Tests/Elasticsearch/Setup.cs +++ b/tests/Elastic.Ingest.Tests/Elasticsearch/Setup.cs @@ -1,4 +1,7 @@ -using System; +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information +using System; using System.Linq; using System.Threading; using Elastic.Ingest.Elasticsearch; diff --git a/tests/Elastic.Ingest.Tests/Elasticsearch/TestDocument.cs b/tests/Elastic.Ingest.Tests/Elasticsearch/TestDocument.cs index e1234a3..4ed3e2d 100644 --- a/tests/Elastic.Ingest.Tests/Elasticsearch/TestDocument.cs +++ b/tests/Elastic.Ingest.Tests/Elasticsearch/TestDocument.cs @@ -1,3 +1,6 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information using System; namespace Elastic.Ingest.Tests.Elasticsearch;