feat: Initialize Zastava Webhook service with TLS and Authority authentication

- Added Program.cs to set up the web application with Serilog for logging, health check endpoints, and a placeholder admission endpoint.
- Configured Kestrel server to use TLS 1.3 and handle client certificates appropriately.
- Created StellaOps.Zastava.Webhook.csproj with necessary dependencies including Serilog and Polly.
- Documented tasks in TASKS.md for the Zastava Webhook project, outlining current work and exit criteria for each task.
This commit is contained in:
2025-10-19 18:36:22 +03:00
parent 7e2fa0a42a
commit 5ce40d2eeb
966 changed files with 91038 additions and 1850 deletions

View File

@@ -41,6 +41,25 @@ public sealed class QueueLeaseIntegrationTests
second.Deduplicated.Should().BeTrue();
}
[Fact]
public async Task Lease_ShouldExposeTraceId_FromQueuedMessage()
{
var clock = new FakeTimeProvider();
var queue = new InMemoryScanQueue(_options, clock);
var payload = new byte[] { 9 };
var message = new ScanQueueMessage("job-trace", payload)
{
TraceId = "trace-123"
};
await queue.EnqueueAsync(message);
var lease = await LeaseSingleAsync(queue, consumer: "worker-trace");
lease.Should().NotBeNull();
lease!.TraceId.Should().Be("trace-123");
}
[Fact]
public async Task Lease_Acknowledge_ShouldRemoveFromQueue()
{
@@ -136,7 +155,11 @@ public sealed class QueueLeaseIntegrationTests
payload: message.Payload.ToArray(),
idempotencyKey: token,
attempt: 1,
enqueuedAt: _timeProvider.GetUtcNow());
enqueuedAt: _timeProvider.GetUtcNow(),
traceId: message.TraceId,
attributes: message.Attributes is null
? new ReadOnlyDictionary<string, string>(new Dictionary<string, string>(0, StringComparer.Ordinal))
: new ReadOnlyDictionary<string, string>(new Dictionary<string, string>(message.Attributes, StringComparer.Ordinal)));
_idempotency[token] = entry;
_ready.Enqueue(entry);
@@ -247,6 +270,7 @@ public sealed class QueueLeaseIntegrationTests
EnqueuedAt = entry.EnqueuedAt;
LeaseExpiresAt = now.Add(leaseDuration);
IdempotencyKey = entry.IdempotencyKey;
TraceId = entry.TraceId;
Attributes = entry.Attributes;
}
@@ -266,6 +290,8 @@ public sealed class QueueLeaseIntegrationTests
public string? IdempotencyKey { get; }
public string? TraceId { get; }
public IReadOnlyDictionary<string, string> Attributes { get; }
public Task AcknowledgeAsync(CancellationToken cancellationToken = default)
@@ -315,7 +341,15 @@ public sealed class QueueLeaseIntegrationTests
internal sealed class QueueEntry
{
public QueueEntry(string sequenceId, string jobId, byte[] payload, string idempotencyKey, int attempt, DateTimeOffset enqueuedAt)
public QueueEntry(
string sequenceId,
string jobId,
byte[] payload,
string idempotencyKey,
int attempt,
DateTimeOffset enqueuedAt,
string? traceId,
IReadOnlyDictionary<string, string> attributes)
{
SequenceId = sequenceId;
JobId = jobId;
@@ -324,7 +358,8 @@ public sealed class QueueLeaseIntegrationTests
Attempt = attempt;
EnqueuedAt = enqueuedAt;
LastLeaseAt = enqueuedAt;
Attributes = new ReadOnlyDictionary<string, string>(new Dictionary<string, string>(StringComparer.Ordinal));
TraceId = traceId;
Attributes = attributes;
}
public string SequenceId { get; }
@@ -345,6 +380,8 @@ public sealed class QueueLeaseIntegrationTests
public DateTimeOffset LastLeaseAt { get; set; }
public string? TraceId { get; }
public IReadOnlyDictionary<string, string> Attributes { get; }
public string? DeadLetterReason { get; set; }