refactor: rename remaining tests to NATS.Server.Core.Tests
- Rename tests/NATS.Server.Tests -> tests/NATS.Server.Core.Tests - Update solution file, InternalsVisibleTo, and csproj references - Remove JETSTREAM_INTEGRATION_MATRIX and NATS.NKeys from csproj (moved to JetStream.Tests and Auth.Tests) - Update all namespaces from NATS.Server.Tests.* to NATS.Server.Core.Tests.* - Replace private GetFreePort/ReadUntilAsync helpers with TestUtilities calls - Fix stale namespace in Transport.Tests/NetworkingGoParityTests.cs
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
using NATS.Server.Configuration;
|
||||
|
||||
namespace NATS.Server.Core.Tests.Configuration;
|
||||
|
||||
public class ConfigWarningsParityBatch1Tests
|
||||
{
|
||||
[Fact]
|
||||
public void Config_warning_types_expose_message_and_source()
|
||||
{
|
||||
var warning = new ConfigWarningException("warn", "conf:1:2");
|
||||
var unknown = new UnknownConfigFieldWarning("mystery_field", "conf:3:1");
|
||||
|
||||
warning.Message.ShouldBe("warn");
|
||||
warning.SourceLocation.ShouldBe("conf:1:2");
|
||||
unknown.Field.ShouldBe("mystery_field");
|
||||
unknown.SourceLocation.ShouldBe("conf:3:1");
|
||||
unknown.Message.ShouldContain("unknown field");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ProcessConfig_collects_unknown_field_warnings_when_errors_are_present()
|
||||
{
|
||||
var ex = Should.Throw<ConfigProcessorException>(() => ConfigProcessor.ProcessConfig("""
|
||||
max_sub_tokens: 300
|
||||
totally_unknown_field: 1
|
||||
"""));
|
||||
|
||||
ex.Errors.ShouldNotBeEmpty();
|
||||
ex.Warnings.ShouldContain(w => w.Contains("unknown field totally_unknown_field", StringComparison.Ordinal));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user