From d9891595506e12d4d95843397f2caede4242b00f Mon Sep 17 00:00:00 2001 From: gladysheva Date: Mon, 12 Feb 2024 13:25:09 +0500 Subject: [PATCH] fix test --- .../ApplicationsStorage_Tests.cs | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/Vostok.ServiceDiscovery.Tests/ServiceLocatorStorage/ApplicationsStorage_Tests.cs b/Vostok.ServiceDiscovery.Tests/ServiceLocatorStorage/ApplicationsStorage_Tests.cs index dea2ba7..625dd2f 100644 --- a/Vostok.ServiceDiscovery.Tests/ServiceLocatorStorage/ApplicationsStorage_Tests.cs +++ b/Vostok.ServiceDiscovery.Tests/ServiceLocatorStorage/ApplicationsStorage_Tests.cs @@ -251,25 +251,29 @@ public void Should_delete_application_from_cache_if_app_and_env_nodes_were_delet [Test] public void Should_not_delete_application_from_cache_when_env_exists_and_observation_of_deleted_apps_is_disabled() { - CreateEnvironmentNode("environment1"); - CreateApplicationNode("environment1", "application1", new Dictionary {{"key", "1/1"}}); + var environment = "environment1"; + var app = "application1"; + CreateEnvironmentNode(environment); + CreateApplicationNode(environment, app, new Dictionary {{"key", "1/1"}}); using (var storage = GetApplicationsStorage(out var envStorage, observeNonExistentApplications: true)) { var expectedTopology = ServiceTopology.Build(new Uri[0], new Dictionary {{"key", "1/1"}}); ShouldReturnImmediately( storage, - "environment1", - "application1", + environment, + app, expectedTopology); - DeleteApplicationNode("environment1", "application1"); + envStorage.Get(environment).Should().BeEquivalentTo(new EnvironmentInfo(environment, null, null)); + + DeleteApplicationNode(environment, app); envStorage.UpdateAll(); - envStorage.Contains("environment1").Should().BeTrue(); + envStorage.Contains(environment).Should().BeTrue(); storage.UpdateAll(); - storage.Contains("environment1", "application1").Should().BeTrue(); + storage.Contains(environment, app).Should().BeTrue(); } } @@ -291,7 +295,7 @@ public void Should_not_delete_application_from_cache_when_observation_of_deleted expectedTopology); envStorage.Get(environment).Should().BeEquivalentTo(new EnvironmentInfo(environment, null, null)); - + Ensemble.Stop(); envStorage.UpdateAll();