THIS IS A TEST INSTANCE ONLY! REPOSITORIES CAN BE DELETED AT ANY TIME!

Browse Source

Merge branch 'Branch_b0227fa1' into ca

# Conflicts:
#	src/Nacos.Microsoft.Extensions.Configuration/Impl/MsConfigServerHttpAgent.cs
#	src/Nacos/Config/AbstNacosConfigClient.cs
#	src/Nacos/Config/Failover/FileLocalConfigInfoProcessor.cs
#	src/Nacos/Config/ServerListManager.cs
#	src/Nacos/Naming/Cache/DiskCache.cs
#	src/Nacos/Naming/Cache/FailoverReactor.cs
#	src/Nacos/Security/SecurityProxy.cs
pull/101/head
彭伟 2 months ago
parent
commit
065f3e5008
  1. 4
      tests/Nacos.Tests/ClusterTest.cs
  2. 14
      tests/Nacos.Tests/ConfigTest.cs
  3. 46
      tests/Nacos.Tests/InstanceTest.cs
  4. 2
      tests/Nacos.Tests/MetricsTest.cs
  5. 10
      tests/Nacos.Tests/ServiceTest.cs
  6. 4
      tests/Nacos.Tests/SwitchesTest.cs

4
tests/Nacos.Tests/ClusterTest.cs

@ -11,14 +11,14 @@
var request = new ListClusterServersRequest
{ };
var res = await _namingClient.ListClusterServersAsync(request);
var res = await _namingClient.ListClusterServersAsync(request).ConfigureAwait(false);
Assert.NotNull(res);
}
[Fact]
public async Task GetCurrentClusterLeader_Should_Succeed()
{
var res = await _namingClient.GetCurrentClusterLeaderAsync();
var res = await _namingClient.GetCurrentClusterLeaderAsync().ConfigureAwait(false);
Assert.NotNull(res);
}
}

14
tests/Nacos.Tests/ConfigTest.cs

@ -17,7 +17,7 @@
Group = "DEFAULT_GROUP",
};
var res = await _configClient.GetConfigAsync(request);
var res = await _configClient.GetConfigAsync(request).ConfigureAwait(false);
Assert.NotNull(res);
Assert.Equal("test", res);
}
@ -36,7 +36,7 @@
AppName = "appdemo"
};
var res = await _configClient.PublishConfigAsync(request);
var res = await _configClient.PublishConfigAsync(request).ConfigureAwait(false);
Assert.True(res);
}
@ -50,7 +50,7 @@
Group = "DEFAULT_GROUP",
};
var res = await _configClient.RemoveConfigAsync(request);
var res = await _configClient.RemoveConfigAsync(request).ConfigureAwait(false);
Assert.True(res);
}
@ -69,20 +69,20 @@
}
};
await _configClient.AddListenerAsync(request);
await _configClient.AddListenerAsync(request).ConfigureAwait(false);
Assert.True(true);
await Task.Delay(1000);
await Task.Delay(1000).ConfigureAwait(false);
var rRequest = new RemoveListenerRequest
{
DataId = "dataId",
};
await _configClient.RemoveListenerAsync(rRequest);
await _configClient.RemoveListenerAsync(rRequest).ConfigureAwait(false);
await Task.Delay(50000);
await Task.Delay(50000).ConfigureAwait(false);
}
}
}

46
tests/Nacos.Tests/InstanceTest.cs

@ -17,12 +17,12 @@
Port = 9999
};
var res = await _namingClient.RegisterInstanceAsync(request);
var res = await _namingClient.RegisterInstanceAsync(request).ConfigureAwait(false);
Assert.True(res);
await Task.Delay(1000);
await Task.Delay(1000).ConfigureAwait(false);
// await _namingClient.(rRequest);
await Task.Delay(10000);
await Task.Delay(10000).ConfigureAwait(false);
}
[Fact]
@ -41,11 +41,11 @@
Port = 9999
};
await _namingClient.SubscribeAsync("testservice", "", action);
await Task.Delay(10000);
await _namingClient.SubscribeAsync("testservice", "", action).ConfigureAwait(false);
await Task.Delay(10000).ConfigureAwait(false);
var resA = await _namingClient.RegisterInstanceAsync(requestA);
await Task.Delay(5000);
var resA = await _namingClient.RegisterInstanceAsync(requestA).ConfigureAwait(false);
await Task.Delay(5000).ConfigureAwait(false);
var requestB = new RegisterInstanceRequest
{
@ -55,11 +55,11 @@
Port = 9999
};
var resB = await _namingClient.RegisterInstanceAsync(requestB);
await Task.Delay(5000);
var resB = await _namingClient.RegisterInstanceAsync(requestB).ConfigureAwait(false);
await Task.Delay(5000).ConfigureAwait(false);
await _namingClient.UnSubscribeAsync("testservice", "", action);
await Task.Delay(10000);
await _namingClient.UnSubscribeAsync("testservice", "", action).ConfigureAwait(false);
await Task.Delay(10000).ConfigureAwait(false);
var requestC = new RegisterInstanceRequest
{
@ -69,8 +69,8 @@
Port = 9999
};
var resC = await _namingClient.RegisterInstanceAsync(requestC);
await Task.Delay(5000);
var resC = await _namingClient.RegisterInstanceAsync(requestC).ConfigureAwait(false);
await Task.Delay(5000).ConfigureAwait(false);
Assert.True(true);
}
@ -85,8 +85,8 @@
Port = 9999
};
var resA = await _namingClient.RegisterInstanceAsync(request);
await Task.Delay(10000);
var resA = await _namingClient.RegisterInstanceAsync(request).ConfigureAwait(false);
await Task.Delay(10000).ConfigureAwait(false);
var requestA = new RemoveInstanceRequest
{
@ -95,8 +95,8 @@
Ephemeral = true,
Port = 9999
};
var resB = await _namingClient.RemoveInstanceAsync(requestA);
await Task.Delay(10000);
var resB = await _namingClient.RemoveInstanceAsync(requestA).ConfigureAwait(false);
await Task.Delay(10000).ConfigureAwait(false);
Assert.True(true);
}
@ -111,7 +111,7 @@
Port = 9999
};
var res = await _namingClient.RemoveInstanceAsync(request);
var res = await _namingClient.RemoveInstanceAsync(request).ConfigureAwait(false);
Assert.True(res);
}
@ -125,7 +125,7 @@
Port = 5000
};
var res = await _namingClient.ModifyInstanceAsync(request);
var res = await _namingClient.ModifyInstanceAsync(request).ConfigureAwait(false);
Assert.True(res);
}
@ -137,7 +137,7 @@
ServiceName = "testservice",
};
var res = await _namingClient.ListInstancesAsync(request);
var res = await _namingClient.ListInstancesAsync(request).ConfigureAwait(false);
Assert.NotNull(res);
}
@ -151,7 +151,7 @@
Port = 9999,
};
var res = await _namingClient.GetInstanceAsync(request);
var res = await _namingClient.GetInstanceAsync(request).ConfigureAwait(false);
Assert.NotNull(res);
}
@ -169,7 +169,7 @@
}
};
var res = await _namingClient.SendHeartbeatAsync(request);
var res = await _namingClient.SendHeartbeatAsync(request).ConfigureAwait(false);
Assert.True(res);
}
@ -184,7 +184,7 @@
Healthy = false,
};
var res = await _namingClient.ModifyInstanceHealthStatusAsync(request);
var res = await _namingClient.ModifyInstanceHealthStatusAsync(request).ConfigureAwait(false);
// 集群配置了健康检查时,该接口会返回错误
Assert.False(res);

2
tests/Nacos.Tests/MetricsTest.cs

@ -8,7 +8,7 @@
[Fact]
public async Task GetMetrics_Should_Succeed()
{
var res = await _namingClient.GetMetricsAsync();
var res = await _namingClient.GetMetricsAsync().ConfigureAwait(false);
Assert.NotNull(res);
}
}

10
tests/Nacos.Tests/ServiceTest.cs

@ -14,7 +14,7 @@
ProtectThreshold = 0.1f
};
var res = await _namingClient.CreateServiceAsync(request);
var res = await _namingClient.CreateServiceAsync(request).ConfigureAwait(false);
Assert.True(res);
}
@ -26,7 +26,7 @@
ServiceName = "testservice"
};
var res = await _namingClient.RemoveServiceAsync(request);
var res = await _namingClient.RemoveServiceAsync(request).ConfigureAwait(false);
Assert.True(res);
}
@ -39,7 +39,7 @@
ProtectThreshold = 0.5f,
};
var res = await _namingClient.ModifyServiceAsync(request);
var res = await _namingClient.ModifyServiceAsync(request).ConfigureAwait(false);
Assert.True(res);
}
@ -51,7 +51,7 @@
ServiceName = "testservice",
};
var res = await _namingClient.GetServiceAsync(request);
var res = await _namingClient.GetServiceAsync(request).ConfigureAwait(false);
Assert.NotNull(res);
}
@ -64,7 +64,7 @@
PageSize = 2,
};
var res = await _namingClient.ListServicesAsync(request);
var res = await _namingClient.ListServicesAsync(request).ConfigureAwait(false);
Assert.NotNull(res);
}
}

4
tests/Nacos.Tests/SwitchesTest.cs

@ -8,7 +8,7 @@
[Fact]
public async Task GetSwitches_Should_Succeed()
{
var res = await _namingClient.GetSwitchesAsync();
var res = await _namingClient.GetSwitchesAsync().ConfigureAwait(false);
Assert.NotNull(res);
}
@ -22,7 +22,7 @@
Value = "test"
};
var res = await _namingClient.ModifySwitchesAsync(request);
var res = await _namingClient.ModifySwitchesAsync(request).ConfigureAwait(false);
Assert.True(res);
}
}

Loading…
Cancel
Save