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:
master
2025-10-19 18:36:22 +03:00
parent 2062da7a8b
commit d099a90f9b
966 changed files with 91038 additions and 1850 deletions

View File

@@ -0,0 +1,89 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using FluentAssertions;
using Machine.Specifications;
using Mongo2Go.Helper;
using MongoDB.Driver;
using MongoDB.Driver.Linq;
using It = Machine.Specifications.It;
// ReSharper disable InconsistentNaming
// ReSharper disable UnusedMember.Local
namespace Mongo2GoTests.Runner
{
[Subject("Runner Integration Test")]
public class when_using_monogoexport : MongoDebuggingTest
{
static readonly string _testFile = Path.GetTempPath() + "testExport.json";
static IList<TestDocument> parsedContent;
Establish context = () =>
{
CreateConnection();
_database.DropCollection(_collectionName);
_collection.InsertOne(TestDocument.DummyData1());
_collection.InsertOne(TestDocument.DummyData2());
_collection.InsertOne(TestDocument.DummyData3());
};
Because of = () =>
{
_runner.Export(_databaseName, _collectionName, _testFile);
Thread.Sleep(500);
parsedContent = ReadBsonFile<TestDocument>(_testFile);
};
It should_preserve_all_values1 = () => parsedContent[0].Should().BeEquivalentTo(TestDocument.DummyData1(), cfg => cfg.Excluding(d => d.Id));
It should_preserve_all_values2 = () => parsedContent[1].Should().BeEquivalentTo(TestDocument.DummyData2(), cfg => cfg.Excluding(d => d.Id));
It should_preserve_all_values3 = () => parsedContent[2].Should().BeEquivalentTo(TestDocument.DummyData3(), cfg => cfg.Excluding(d => d.Id));
Cleanup stuff = () =>
{
new FileSystem().DeleteFile(_testFile);
_runner.Dispose();
};
}
[Subject("Runner Integration Test")]
public class when_using_monogoimport : MongoDebuggingTest
{
static IQueryable<TestDocument> query;
static readonly string _testFile = Path.GetTempPath() + "testImport.json";
const string _filecontent =
@"{ ""_id"" : { ""$oid"" : ""50227b375dff9218248eadc4"" }, ""StringTest"" : ""Hello World"", ""IntTest"" : 42, ""DateTest"" : { ""$date"" : ""1984-09-30T06:06:06.171Z"" }, ""ListTest"" : [ ""I"", ""am"", ""a"", ""list"", ""of"", ""strings"" ] }" + "\r\n" +
@"{ ""_id"" : { ""$oid"" : ""50227b375dff9218248eadc5"" }, ""StringTest"" : ""Foo"", ""IntTest"" : 23, ""DateTest"" : null, ""ListTest"" : null }" + "\r\n" +
@"{ ""_id"" : { ""$oid"" : ""50227b375dff9218248eadc6"" }, ""StringTest"" : ""Bar"", ""IntTest"" : 77, ""DateTest"" : null, ""ListTest"" : null }" + "\r\n";
Establish context = () =>
{
CreateConnection();
_database.DropCollection(_collectionName);
File.WriteAllText(_testFile, _filecontent);
};
Because of = () =>
{
_runner.Import(_databaseName, _collectionName, _testFile, true);
Thread.Sleep(500);
query = _collection.AsQueryable().Select(c => c).OrderBy(c => c.Id); ;
};
It should_return_document1 = () => query.ToList().ElementAt(0).Should().BeEquivalentTo(TestDocument.DummyData1(), cfg => cfg.Excluding(d => d.Id));
It should_return_document2 = () => query.ToList().ElementAt(1).Should().BeEquivalentTo(TestDocument.DummyData2(), cfg => cfg.Excluding(d => d.Id));
It should_return_document3 = () => query.ToList().ElementAt(2).Should().BeEquivalentTo(TestDocument.DummyData3(), cfg => cfg.Excluding(d => d.Id));
Cleanup stuff = () =>
{
new FileSystem().DeleteFile(_testFile);
_runner.Dispose();
};
}
}
// ReSharper restore UnusedMember.Local
// ReSharper restore InconsistentNaming