Add OpenSslLegacyShim to ensure OpenSSL 1.1 libraries are accessible on Linux
Some checks failed
Docs CI / lint-and-preview (push) Has been cancelled
Some checks failed
Docs CI / lint-and-preview (push) Has been cancelled
This commit introduces the OpenSslLegacyShim class, which sets the LD_LIBRARY_PATH environment variable to include the directory containing OpenSSL 1.1 native libraries. This is necessary for Mongo2Go to function correctly on Linux platforms that do not ship these libraries by default. The shim checks if the current operating system is Linux and whether the required directory exists before modifying the environment variable.
This commit is contained in:
@@ -422,11 +422,11 @@ public sealed class BackendOperationsClientTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TriggerJobAsync_UsesAuthorityTokenWhenConfigured()
|
||||
{
|
||||
using var temp = new TempDirectory();
|
||||
|
||||
var handler = new StubHttpMessageHandler((request, _) =>
|
||||
public async Task TriggerJobAsync_UsesAuthorityTokenWhenConfigured()
|
||||
{
|
||||
using var temp = new TempDirectory();
|
||||
|
||||
var handler = new StubHttpMessageHandler((request, _) =>
|
||||
{
|
||||
Assert.NotNull(request.Headers.Authorization);
|
||||
Assert.Equal("Bearer", request.Headers.Authorization!.Scheme);
|
||||
@@ -471,10 +471,116 @@ public sealed class BackendOperationsClientTests
|
||||
var result = await client.TriggerJobAsync("test", new Dictionary<string, object?>(), CancellationToken.None);
|
||||
|
||||
Assert.True(result.Success);
|
||||
Assert.Equal("Accepted", result.Message);
|
||||
Assert.True(tokenClient.Requests > 0);
|
||||
}
|
||||
|
||||
Assert.Equal("Accepted", result.Message);
|
||||
Assert.True(tokenClient.Requests > 0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TriggerJobAsync_ThrowsWhenBackfillMetadataMissing()
|
||||
{
|
||||
using var temp = new TempDirectory();
|
||||
|
||||
var handler = new StubHttpMessageHandler((request, _) =>
|
||||
{
|
||||
return new HttpResponseMessage(HttpStatusCode.Accepted)
|
||||
{
|
||||
RequestMessage = request,
|
||||
Content = JsonContent.Create(new JobRunResponse
|
||||
{
|
||||
RunId = Guid.NewGuid(),
|
||||
Kind = "test",
|
||||
Status = "Pending",
|
||||
Trigger = "cli",
|
||||
CreatedAt = DateTimeOffset.UtcNow
|
||||
})
|
||||
};
|
||||
});
|
||||
|
||||
var httpClient = new HttpClient(handler)
|
||||
{
|
||||
BaseAddress = new Uri("https://concelier.example")
|
||||
};
|
||||
|
||||
var options = new StellaOpsCliOptions
|
||||
{
|
||||
BackendUrl = "https://concelier.example",
|
||||
Authority =
|
||||
{
|
||||
Url = "https://authority.example",
|
||||
ClientId = "cli",
|
||||
ClientSecret = "secret",
|
||||
Scope = "orch:backfill",
|
||||
TokenCacheDirectory = temp.Path
|
||||
}
|
||||
};
|
||||
|
||||
var tokenClient = new StubTokenClient();
|
||||
var loggerFactory = LoggerFactory.Create(builder => builder.SetMinimumLevel(LogLevel.Debug));
|
||||
var client = new BackendOperationsClient(httpClient, options, loggerFactory.CreateLogger<BackendOperationsClient>(), tokenClient);
|
||||
|
||||
var exception = await Assert.ThrowsAsync<InvalidOperationException>(() => client.TriggerJobAsync("test", new Dictionary<string, object?>(), CancellationToken.None));
|
||||
Assert.Contains("Authority.BackfillReason", exception.Message, StringComparison.Ordinal);
|
||||
Assert.Equal(0, tokenClient.Requests);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TriggerJobAsync_RequestsOperateAndBackfillMetadata()
|
||||
{
|
||||
using var temp = new TempDirectory();
|
||||
|
||||
var handler = new StubHttpMessageHandler((request, _) =>
|
||||
{
|
||||
Assert.NotNull(request.Headers.Authorization);
|
||||
return new HttpResponseMessage(HttpStatusCode.Accepted)
|
||||
{
|
||||
RequestMessage = request,
|
||||
Content = JsonContent.Create(new JobRunResponse
|
||||
{
|
||||
RunId = Guid.NewGuid(),
|
||||
Kind = "test",
|
||||
Status = "Pending",
|
||||
Trigger = "cli",
|
||||
CreatedAt = DateTimeOffset.UtcNow
|
||||
})
|
||||
};
|
||||
});
|
||||
|
||||
var httpClient = new HttpClient(handler)
|
||||
{
|
||||
BaseAddress = new Uri("https://concelier.example")
|
||||
};
|
||||
|
||||
var options = new StellaOpsCliOptions
|
||||
{
|
||||
BackendUrl = "https://concelier.example",
|
||||
Authority =
|
||||
{
|
||||
Url = "https://authority.example",
|
||||
ClientId = "cli",
|
||||
ClientSecret = "secret",
|
||||
Scope = "orch:operate orch:backfill",
|
||||
TokenCacheDirectory = temp.Path,
|
||||
OperatorReason = "Resume operations",
|
||||
OperatorTicket = "INC-6006",
|
||||
BackfillReason = "Historical rebuild",
|
||||
BackfillTicket = "INC-7007"
|
||||
}
|
||||
};
|
||||
|
||||
var tokenClient = new StubTokenClient();
|
||||
var loggerFactory = LoggerFactory.Create(builder => builder.SetMinimumLevel(LogLevel.Debug));
|
||||
var client = new BackendOperationsClient(httpClient, options, loggerFactory.CreateLogger<BackendOperationsClient>(), tokenClient);
|
||||
|
||||
var result = await client.TriggerJobAsync("test", new Dictionary<string, object?>(), CancellationToken.None);
|
||||
|
||||
Assert.True(result.Success);
|
||||
var metadata = Assert.NotNull(tokenClient.LastAdditionalParameters);
|
||||
Assert.Equal("Resume operations", metadata["operator_reason"]);
|
||||
Assert.Equal("INC-6006", metadata["operator_ticket"]);
|
||||
Assert.Equal("Historical rebuild", metadata["backfill_reason"]);
|
||||
Assert.Equal("INC-7007", metadata["backfill_ticket"]);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task EvaluateRuntimePolicyAsync_ParsesDecisionPayload()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user