Skip to content

Commit

Permalink
Fix/7.x/snapshot test bundled jdk (#3990)
Browse files Browse the repository at this point in the history
* Update abstractions to version that prints JAVA_HOME just before starting elasticsearch and forces it on the Process instance

(cherry picked from commit ee496ad)

* update abstractions

(cherry picked from commit 2b409ff)

* update to abstraction versions that takes prereleases into account again with SkipVersion

* Audit trail test assumed timespan is never TimeSpan.Zero but of course can be (#3989)


(cherry picked from commit 79a71ac)

* Rename SkipOnTeamCity to skip on CI

* skip xpack usage/info on CI, tad flakey due to elastic/elasticsearch#45250
  • Loading branch information
Mpdreamz authored Aug 7, 2019
1 parent 79a71ac commit 3da50b6
Show file tree
Hide file tree
Showing 16 changed files with 50 additions and 14 deletions.
2 changes: 1 addition & 1 deletion build/scripts/scripts.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Bullseye" Version="2.4.0-rc.2" />
<PackageReference Include="Elastic.Managed" Version="0.1.0-ci20190724T022011" />
<PackageReference Include="Elastic.Managed" Version="0.1.0-ci20190806T115008" />
<PackageReference Include="Fake.Core.Environment" Version="5.15.0" />
<PackageReference Include="Fake.Core.SemVer" Version="5.15.0" />
<PackageReference Include="Fake.IO.FileSystem" Version="5.15.0" />
Expand Down
2 changes: 1 addition & 1 deletion src/Tests/Tests.Benchmarking/Tests.Benchmarking.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.11.5" />
<PackageReference Include="Elastic.BenchmarkDotNetExporter" Version="0.1.0-ci20190724T022011" />
<PackageReference Include="Elastic.BenchmarkDotNetExporter" Version="0.1.0-ci20190806T115008" />
<PackageReference Include="LibGit2Sharp" Version="0.26.0-preview-0062" />
</ItemGroup>
</Project>
3 changes: 3 additions & 0 deletions src/Tests/Tests.Configuration/TestConfigurationBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ public abstract class TestConfigurationBase
/// <summary> The Elasticsearch version to test against, defined for both unit and integration tests</summary>
public string ElasticsearchVersion { get; protected set; }

public bool ElasticsearchVersionIsSnapshot => !string.IsNullOrWhiteSpace(ElasticsearchVersion)
&& (ElasticsearchVersion.Contains("SNAPSHOT") || ElasticsearchVersion.Contains("latest"));

/// <summary> Force a reseed (bootstrap) of the cluster even if checks indicate bootstrap already ran </summary>
public bool ForceReseed { get; protected set; }

Expand Down
2 changes: 1 addition & 1 deletion src/Tests/Tests.Configuration/tests.default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ mode: i

# the elasticsearch version that should be started
# Can be a snapshot version of sonatype or "latest" to get the latest snapshot of sonatype
elasticsearch_version: 7.0.0
elasticsearch_version: latest-7
# cluster filter allows you to only run the integration tests of a particular cluster (cluster suffix not needed)
# cluster_filter:
# whether we want to forcefully reseed on the node, if you are starting the tests with a node already running
Expand Down
2 changes: 1 addition & 1 deletion src/Tests/Tests.Core/Tests.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Tests.Domain\Tests.Domain.csproj" />
<PackageReference Include="Elastic.Xunit" Version="0.1.0-ci20190724T022011" />
<PackageReference Include="Elastic.Xunit" Version="0.1.0-ci20190806T115008" />
<PackageReference Include="Proc" Version="0.6.1" />
<PackageReference Include="xunit" Version="2.3.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.1.1" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@

namespace Tests.Core.Xunit
{
public class SkipOnTeamCityAttribute : SkipTestAttributeBase
public class SkipOnCiAttribute : SkipTestAttributeBase
{
public override string Reason { get; } = "Skip running this test on TeamCity, this is usually a sign this test is flakey?";

public static bool RunningOnTeamCity => !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("TEAMCITY_VERSION"));
public override bool Skip => RunningOnTeamCity;
public static bool RunningOnAzureDevops => !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("TF_BUILD"));
public static bool RunningOnAppVeyor => !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("APPVEYOR_BUILD_VERSION"));
public override bool Skip => RunningOnTeamCity || RunningOnAppVeyor || RunningOnAzureDevops;
}
//

Expand Down
2 changes: 1 addition & 1 deletion src/Tests/Tests.Domain/Tests.Domain.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Bogus" Version="22.1.2" />
<PackageReference Include="Elastic.Managed" Version="0.1.0-ci20190724T022011" />
<PackageReference Include="Elastic.Managed" Version="0.1.0-ci20190806T115008" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
<ProjectReference Include="..\Tests.Configuration\Tests.Configuration.csproj" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Tests/Tests/Cat/CatFielddata/CatFielddataApiTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ protected override void ExpectResponse(CatResponse<CatFielddataRecord> response)
// TODO investigate flakiness
// build seed:64178 integrate 6.3.0 "readonly" "catfielddata"
// fails on TeamCity but not locally, assuming the different PC sizes come into play
if (SkipOnTeamCityAttribute.RunningOnTeamCity || _initialSearchResponse == null || _initialSearchResponse.Total <= 0)
if (SkipOnCiAttribute.RunningOnTeamCity || _initialSearchResponse == null || _initialSearchResponse.Total <= 0)
return;

response.Records.Should().NotBeEmpty();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ protected override void ExpectResponse(RootNodeInfoResponse response)
response.Version.BuildDate.Should().BeAfter(default);
response.Version.BuildFlavor.Should().NotBeNullOrWhiteSpace();
response.Version.BuildHash.Should().NotBeNullOrWhiteSpace();
response.Version.BuildSnapshot.Should().Be(TestConfiguration.Instance.ElasticsearchVersion.Contains("SNAPSHOT"));
response.Version.BuildSnapshot.Should().Be(TestConfiguration.Instance.ElasticsearchVersionIsSnapshot);
response.Version.BuildType.Should().NotBeNullOrWhiteSpace();
response.Version.MinimumIndexCompatibilityVersion.Should().NotBeNullOrWhiteSpace();
response.Version.MinimumWireCompatibilityVersion.Should().NotBeNullOrWhiteSpace();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class BulkAllCancellationTokenApiTests : BulkAllApiTestsBase
{
public BulkAllCancellationTokenApiTests(IntrusiveOperationCluster cluster) : base(cluster) { }

[I] [SkipOnTeamCity]
[I] [SkipOnCi]
public void CancelBulkAll()
{
var index = CreateIndexName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class BulkAllDisposeApiTests : BulkAllApiTestsBase
{
public BulkAllDisposeApiTests(IntrusiveOperationCluster cluster) : base(cluster) { }

[I] [SkipOnTeamCity]
[I] [SkipOnCi]
public void DisposingObservableCancelsBulkAll()
{
var index = CreateIndexName();
Expand Down
2 changes: 2 additions & 0 deletions src/Tests/Tests/XPack/Info/XPackInfoApiTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
using FluentAssertions;
using Nest;
using Tests.Core.ManagedElasticsearch.Clusters;
using Tests.Core.Xunit;
using Tests.Framework.EndpointTests;
using Tests.Framework.EndpointTests.TestState;

namespace Tests.XPack.Info
{
[SkipVersion("<6.8.0", "All APIs exist in Elasticsearch 6.8.0")]
[SkipOnCi] //TODO https://github.com/elastic/elasticsearch/issues/45250
public class XPackInfoApiTests : CoordinatedIntegrationTestBase<XPackCluster>
{
private const string XPackInfoStep = nameof(XPackInfoStep);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
namespace Tests.XPack.License.GetBasicLicenseStatus
{
[SkipVersion("<6.5.0", "")]
[SkipOnTeamCity]
[SkipOnCi]
public class GetBasicLicenseStatusApiTests
: ApiIntegrationTestBase<XPackCluster, GetBasicLicenseStatusResponse, IGetBasicLicenseStatusRequest, GetBasicLicenseStatusDescriptor, GetBasicLicenseStatusRequest>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
namespace Tests.XPack.License.GetTrialLicenseStatus
{
[SkipVersion("<6.1.0", "Only exists in Elasticsearch 6.1.0+")]
[SkipOnTeamCity]
[SkipOnCi]
public class GetTrialLicenseStatusApiTests
: ApiIntegrationTestBase<XPackCluster, GetTrialLicenseStatusResponse, IGetTrialLicenseStatusRequest, GetTrialLicenseStatusDescriptor,
GetTrialLicenseStatusRequest>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
namespace Tests.XPack.MachineLearning
{
[SkipVersion("<5.5.0", "Machine Learning does not exist in previous versions")]
[SkipOnTeamCity]
[SkipOnCi]
public abstract class MachineLearningIntegrationTestBase<TResponse, TInterface, TDescriptor, TInitializer>
: ApiIntegrationTestBase<MachineLearningCluster, TResponse, TInterface, TDescriptor, TInitializer>
where TResponse : class, IResponse
Expand Down
29 changes: 29 additions & 0 deletions src/Tests/Tests/XPack/Security/ApiKey/SecurityApiKeyUsageTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,41 @@
using Nest;
using Tests.Core.Extensions;
using Tests.Core.ManagedElasticsearch.Clusters;
using Tests.Core.Xunit;
using Tests.Framework.EndpointTests;
using Tests.Framework.EndpointTests.TestState;

namespace Tests.XPack.Security.ApiKey
{
/*
* On the server internally create api key does a search. on CI this search often fails and the PUT for create api key returns with:
*
* - [1] BadResponse: Node: https://localhost:9200/ Took: 00:00:00.9531746
# OriginalException: Elasticsearch.Net.ElasticsearchClientException: The remote server returned an error: (503) Server Unavailable.. Call: Status code 503 from: PUT /_security/api_key?pretty=true&error_trace=true. ServerError: Type: search_phase_execution_exception Reason: "all shards failed" ---> System.Net.WebException: The remote server returned an error: (503) Server Unavailable.
at System.Net.HttpWebRequest.GetResponse()
at Elasticsearch.Net.HttpWebRequestConnection.Request[TResponse](RequestData requestData) in D:\a\1\s\src\Elasticsearch.Net\Connection\HttpWebRequestConnection.cs:line 59
--- End of inner exception stack trace ---
# Request:
{"name":"nest-initializer-c241e819","role_descriptors":{}}
# Response:
{
"error" : {
"root_cause" : [ ],
"type" : "search_phase_execution_exception",
"reason" : "all shards failed",
"phase" : "query",
"grouped" : true,
"failed_shards" : [ ],
"stack_trace" : "Failed to execute phase [query], all shards failed\r\n\tat ....."
},
"status" : 503
}
*
*/

[SkipVersion("<7.0.0", "Implemented in version 7.0.0")]
[SkipOnCi] //TODO flakey: investigate see above for more information
public class SecurityApiKeyUsageTests
: ApiIntegrationTestBase<XPackCluster, NodesInfoResponse, INodesInfoRequest,
NodesInfoDescriptor, NodesInfoRequest>
Expand Down

0 comments on commit 3da50b6

Please sign in to comment.