Improves unsupported Cloud Foundry service message
[#37] This message is specific to Cloud Foundry. Making a more generic handling of this error will require a more substantial rewrite.
This commit is contained in:
Родитель
b8091fb7b3
Коммит
d11f2c64cb
|
@ -99,7 +99,12 @@ namespace Steeltoe.Tooling.Drivers.CloudFoundry
|
|||
public void DeployService(string service)
|
||||
{
|
||||
var svcInfo = _context.Configuration.GetServiceInfo(service);
|
||||
var cfServiceDef = _context.Target.Configuration.ServiceTypeProperties[svcInfo.ServiceType];
|
||||
_context.Target.Configuration.ServiceTypeProperties.TryGetValue(svcInfo.ServiceType, out var cfServiceDef);
|
||||
if (cfServiceDef == null)
|
||||
{
|
||||
throw new ToolingException($"No Cloud Foundry service available for '{svcInfo.Service}' [{svcInfo.ServiceType}]");
|
||||
}
|
||||
|
||||
var cfCmd = $"create-service {cfServiceDef["service"]} {cfServiceDef["plan"]} {service}";
|
||||
var svcArgs = _context.Configuration.GetServiceArgs(service, "cloud-foundry") ?? "";
|
||||
if (svcArgs.Length > 0)
|
||||
|
|
|
@ -135,6 +135,15 @@ namespace Steeltoe.Tooling.Test.Drivers.CloudFoundry
|
|||
Shell.LastCommand.ShouldBe("cf create-service p-redis shared-vm my-service");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestDeployUnavailableService()
|
||||
{
|
||||
Context.Configuration.AddService("my-service", "zipkin");
|
||||
var e = Assert.Throws<ToolingException>(
|
||||
() => _driver.DeployService("my-service")
|
||||
);
|
||||
e.Message.ShouldBe("No Cloud Foundry service available for 'my-service' [zipkin]");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestUndeployService()
|
||||
|
|
Загрузка…
Ссылка в новой задаче