mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-03-25 19:02:24 +01:00
WireMock.Net.Testcontainers: implement watching the static mapping folder for changes (#1189)
* WireMock.Net.Testcontainers: implement watching the static mapping files + folder for changes * ReloadStaticMappings * fix * . * . * . * . * . * . * . * CopyAsync * <VersionPrefix>1.6.7-preview-02</VersionPrefix> * <VersionPrefix>1.6.7-preview-03</VersionPrefix>
This commit is contained in:
@@ -17,7 +17,7 @@ public class WireMockServerArgumentsTests
|
||||
args.AdminUsername.Should().BeNull();
|
||||
args.AdminPassword.Should().BeNull();
|
||||
args.ReadStaticMappings.Should().BeFalse();
|
||||
args.WithWatchStaticMappings.Should().BeFalse();
|
||||
args.WatchStaticMappings.Should().BeFalse();
|
||||
args.MappingsPath.Should().BeNull();
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ public class WireMockServerArgumentsTests
|
||||
// Arrange
|
||||
var args = new WireMockServerArguments
|
||||
{
|
||||
WithWatchStaticMappings = true,
|
||||
WatchStaticMappings = true,
|
||||
ReadStaticMappings = readStaticMappings
|
||||
};
|
||||
|
||||
@@ -104,7 +104,7 @@ public class WireMockServerArgumentsTests
|
||||
// Arrange
|
||||
var args = new WireMockServerArguments
|
||||
{
|
||||
WithWatchStaticMappings = false
|
||||
WatchStaticMappings = false
|
||||
};
|
||||
|
||||
// Act
|
||||
|
||||
@@ -63,7 +63,7 @@ public class WireMockServerBuilderExtensionsTests
|
||||
AdminPassword = password,
|
||||
AdminUsername = username,
|
||||
ReadStaticMappings = true,
|
||||
WithWatchStaticMappings = false,
|
||||
WatchStaticMappings = false,
|
||||
MappingsPath = null,
|
||||
HttpPort = port
|
||||
});
|
||||
|
||||
@@ -1126,5 +1126,19 @@ text
|
||||
|
||||
server.Stop();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task IWireMockAdminApi_ReadStaticMappingsAsync()
|
||||
{
|
||||
// Arrange
|
||||
using var server = WireMockServer.StartWithAdminInterface();
|
||||
var api = RestClient.For<IWireMockAdminApi>(server.Url);
|
||||
|
||||
// Act
|
||||
var status = await api.ReloadStaticMappingsAsync().ConfigureAwait(false);
|
||||
|
||||
// Assert
|
||||
status.Status.Should().Be("Static Mappings reloaded");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@@ -100,7 +100,7 @@ public class WireMockServerProxyTests
|
||||
Url = "http://www.google.com",
|
||||
SaveMapping = true,
|
||||
SaveMappingToFile = false,
|
||||
ExcludedHeaders = new[] { "Connection" } // Needed for .NET 4.5.x and 4.6.x
|
||||
ExcludedHeaders = ["Connection"] // Needed for .NET 4.5.x and 4.6.x
|
||||
},
|
||||
StartAdminInterface = true
|
||||
};
|
||||
@@ -119,7 +119,7 @@ public class WireMockServerProxyTests
|
||||
}
|
||||
|
||||
// Assert
|
||||
server.Mappings.Should().HaveCount(36);
|
||||
server.Mappings.Should().HaveCount(37);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
@@ -75,6 +75,8 @@ public class WireMockServerSettingsTests
|
||||
[Fact]
|
||||
public void WireMockServer_WireMockServerSettings_PriorityFromAllAdminMappingsIsLow_When_StartAdminInterface_IsTrue()
|
||||
{
|
||||
const int count = 35;
|
||||
|
||||
// Assign and Act
|
||||
var server = WireMockServer.Start(new WireMockServerSettings
|
||||
{
|
||||
@@ -83,13 +85,15 @@ public class WireMockServerSettingsTests
|
||||
|
||||
// Assert
|
||||
server.Mappings.Should().NotBeNull();
|
||||
server.Mappings.Should().HaveCount(34);
|
||||
server.Mappings.Should().HaveCount(count);
|
||||
server.Mappings.All(m => m.Priority == WireMockConstants.AdminPriority).Should().BeTrue();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void WireMockServer_WireMockServerSettings_ProxyAndRecordSettings_ProxyPriority_IsMinus2000000_When_StartAdminInterface_IsTrue()
|
||||
{
|
||||
const int count = 36;
|
||||
|
||||
// Assign and Act
|
||||
var server = WireMockServer.Start(new WireMockServerSettings
|
||||
{
|
||||
@@ -102,9 +106,9 @@ public class WireMockServerSettingsTests
|
||||
|
||||
// Assert
|
||||
server.Mappings.Should().NotBeNull();
|
||||
server.Mappings.Should().HaveCount(35);
|
||||
server.Mappings.Should().HaveCount(count);
|
||||
|
||||
server.Mappings.Count(m => m.Priority == WireMockConstants.AdminPriority).Should().Be(34);
|
||||
server.Mappings.Count(m => m.Priority == WireMockConstants.AdminPriority).Should().Be(count - 1);
|
||||
server.Mappings.Count(m => m.Priority == WireMockConstants.ProxyPriority).Should().Be(1);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user