Skip to content

Commit 0792b97

Browse files
committed
Fix XPackCluster. Set license json from reading file, based on path in environment variable.
1 parent 97455b8 commit 0792b97

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/Tests/Framework/ManagedElasticsearch/Clusters/XPackCluster.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
using Elastic.Managed.Ephemeral;
1+
using System;
2+
using System.IO;
3+
using Elastic.Managed.Ephemeral;
24
using Elastic.Xunit;
35
using Elasticsearch.Net;
46
using Nest;
@@ -13,8 +15,15 @@ public XPackClusterConfiguration() : this(ClusterFeatures.SSL | ClusterFeatures.
1315

1416
public XPackClusterConfiguration(ClusterFeatures features) : base(ClusterFeatures.XPack | features, 1)
1517
{
16-
this.ShowElasticsearchOutputAfterStarted = false;
18+
// Get license file path from environment variable
19+
var licenseFilePath = Environment.GetEnvironmentVariable("ES_LICENSE_FILE");
20+
if (!string.IsNullOrEmpty(licenseFilePath) && File.Exists(licenseFilePath))
21+
{
22+
var licenseContents = File.ReadAllText(licenseFilePath);
23+
this.XPackLicenseJson = licenseContents;
24+
}
1725

26+
this.ShowElasticsearchOutputAfterStarted = false;
1827
this.AdditionalBeforeNodeStartedTasks.Add(new EnsureWatcherActionConfigurationInElasticsearchYaml());
1928
}
2029
}

0 commit comments

Comments
 (0)