Add comprehensive tests for PathConfidenceScorer, PathEnumerator, ShellSymbolicExecutor, and SymbolicState
- Implemented unit tests for PathConfidenceScorer to evaluate path scoring under various conditions, including empty constraints, known and unknown constraints, environmental dependencies, and custom weights. - Developed tests for PathEnumerator to ensure correct path enumeration from simple scripts, handling known environments, and respecting maximum paths and depth limits. - Created tests for ShellSymbolicExecutor to validate execution of shell scripts, including handling of commands, branching, and environment tracking. - Added tests for SymbolicState to verify state management, variable handling, constraint addition, and environment dependency collection.
This commit is contained in:
@@ -179,6 +179,8 @@ public class AuthorityPluginConfigurationLoaderTests : IDisposable
|
||||
options.Storage.ConnectionString = "Host=localhost;Port=5432;Database=authority_test";
|
||||
options.Signing.ActiveKeyId = "test-key";
|
||||
options.Signing.KeyPath = "/tmp/authority-test-key.pem";
|
||||
options.Notifications.AckTokens.Enabled = false;
|
||||
options.Notifications.Webhooks.Enabled = false;
|
||||
return options;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,8 @@ public class StellaOpsAuthorityOptionsTests
|
||||
options.Storage.ConnectionString = "Host=localhost;Port=5432;Database=authority";
|
||||
options.Signing.ActiveKeyId = "test-key";
|
||||
options.Signing.KeyPath = "/tmp/test-key.pem";
|
||||
options.Notifications.AckTokens.Enabled = false;
|
||||
options.Notifications.Webhooks.Enabled = false;
|
||||
|
||||
options.PluginDirectories.Add(" ./plugins ");
|
||||
options.PluginDirectories.Add("./plugins");
|
||||
@@ -61,6 +63,8 @@ public class StellaOpsAuthorityOptionsTests
|
||||
options.Storage.ConnectionString = "Host=localhost;Port=5432;Database=authority";
|
||||
options.Signing.ActiveKeyId = "test-key";
|
||||
options.Signing.KeyPath = "/tmp/test-key.pem";
|
||||
options.Notifications.AckTokens.Enabled = false;
|
||||
options.Notifications.Webhooks.Enabled = false;
|
||||
options.AdvisoryAi.RemoteInference.Enabled = true;
|
||||
|
||||
var exception = Assert.Throws<InvalidOperationException>(() => options.Validate());
|
||||
@@ -79,6 +83,8 @@ public class StellaOpsAuthorityOptionsTests
|
||||
options.Storage.ConnectionString = "Host=localhost;Port=5432;Database=authority";
|
||||
options.Signing.ActiveKeyId = "test-key";
|
||||
options.Signing.KeyPath = "/tmp/test-key.pem";
|
||||
options.Notifications.AckTokens.Enabled = false;
|
||||
options.Notifications.Webhooks.Enabled = false;
|
||||
|
||||
var descriptor = new AuthorityPluginDescriptorOptions
|
||||
{
|
||||
@@ -110,6 +116,8 @@ public class StellaOpsAuthorityOptionsTests
|
||||
options.Storage.ConnectionString = "Host=localhost;Port=5432;Database=authority";
|
||||
options.Signing.ActiveKeyId = "test-key";
|
||||
options.Signing.KeyPath = "/tmp/test-key.pem";
|
||||
options.Notifications.AckTokens.Enabled = false;
|
||||
options.Notifications.Webhooks.Enabled = false;
|
||||
options.AdvisoryAi.RemoteInference.Enabled = true;
|
||||
options.AdvisoryAi.RemoteInference.RequireTenantConsent = true;
|
||||
options.AdvisoryAi.RemoteInference.AllowedProfiles.Add("cloud-openai");
|
||||
@@ -144,6 +152,8 @@ public class StellaOpsAuthorityOptionsTests
|
||||
options.Storage.ConnectionString = "Host=localhost;Port=5432;Database=authority";
|
||||
options.Signing.ActiveKeyId = "test-key";
|
||||
options.Signing.KeyPath = "/tmp/test-key.pem";
|
||||
options.Notifications.AckTokens.Enabled = false;
|
||||
options.Notifications.Webhooks.Enabled = false;
|
||||
options.AdvisoryAi.RemoteInference.Enabled = true;
|
||||
options.AdvisoryAi.RemoteInference.RequireTenantConsent = true;
|
||||
options.AdvisoryAi.RemoteInference.AllowedProfiles.Add("cloud-openai");
|
||||
@@ -174,6 +184,8 @@ public class StellaOpsAuthorityOptionsTests
|
||||
};
|
||||
options.Signing.ActiveKeyId = "test-key";
|
||||
options.Signing.KeyPath = "/tmp/test-key.pem";
|
||||
options.Notifications.AckTokens.Enabled = false;
|
||||
options.Notifications.Webhooks.Enabled = false;
|
||||
|
||||
var exception = Assert.Throws<InvalidOperationException>(() => options.Validate());
|
||||
|
||||
@@ -206,7 +218,9 @@ public class StellaOpsAuthorityOptionsTests
|
||||
["Authority:Signing:Enabled"] = "true",
|
||||
["Authority:Signing:ActiveKeyId"] = "authority-signing-dev",
|
||||
["Authority:Signing:KeyPath"] = "../certificates/authority-signing-dev.pem",
|
||||
["Authority:Signing:KeySource"] = "file"
|
||||
["Authority:Signing:KeySource"] = "file",
|
||||
["Authority:Notifications:AckTokens:Enabled"] = "false",
|
||||
["Authority:Notifications:Webhooks:Enabled"] = "false"
|
||||
});
|
||||
};
|
||||
});
|
||||
@@ -244,6 +258,8 @@ public class StellaOpsAuthorityOptionsTests
|
||||
options.Storage.ConnectionString = "Host=localhost;Port=5432;Database=authority";
|
||||
options.Signing.ActiveKeyId = "test-key";
|
||||
options.Signing.KeyPath = "/tmp/test-key.pem";
|
||||
options.Notifications.AckTokens.Enabled = false;
|
||||
options.Notifications.Webhooks.Enabled = false;
|
||||
|
||||
options.Exceptions.RoutingTemplates.Add(new AuthorityExceptionRoutingTemplateOptions
|
||||
{
|
||||
@@ -275,6 +291,8 @@ public class StellaOpsAuthorityOptionsTests
|
||||
options.Storage.ConnectionString = "Host=localhost;Port=5432;Database=authority";
|
||||
options.Signing.ActiveKeyId = "test-key";
|
||||
options.Signing.KeyPath = "/tmp/test-key.pem";
|
||||
options.Notifications.AckTokens.Enabled = false;
|
||||
options.Notifications.Webhooks.Enabled = false;
|
||||
|
||||
options.Exceptions.RoutingTemplates.Add(new AuthorityExceptionRoutingTemplateOptions
|
||||
{
|
||||
@@ -303,6 +321,8 @@ public class StellaOpsAuthorityOptionsTests
|
||||
options.Security.RateLimiting.Token.PermitLimit = 0;
|
||||
options.Signing.ActiveKeyId = "test-key";
|
||||
options.Signing.KeyPath = "/tmp/test-key.pem";
|
||||
options.Notifications.AckTokens.Enabled = false;
|
||||
options.Notifications.Webhooks.Enabled = false;
|
||||
|
||||
var exception = Assert.Throws<InvalidOperationException>(() => options.Validate());
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using StellaOps.Cryptography;
|
||||
using StellaOps.Cryptography.DependencyInjection;
|
||||
@@ -11,7 +12,9 @@ public sealed class BouncyCastleEd25519CryptoProviderTests
|
||||
[Fact]
|
||||
public async Task SignAndVerify_WithBouncyCastleProvider_Succeeds()
|
||||
{
|
||||
var configuration = new ConfigurationBuilder().Build();
|
||||
var services = new ServiceCollection();
|
||||
services.AddSingleton<IConfiguration>(configuration);
|
||||
services.AddStellaOpsCrypto();
|
||||
services.AddBouncyCastleEd25519Provider();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user