Skip to content

Commit

Permalink
fix vnetpeering controller
Browse files Browse the repository at this point in the history
  • Loading branch information
xingyang-li committed Jan 2, 2025
1 parent 5c02d5a commit 595d417
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/SwiftTestingFrameworkAPI/Controllers/VnetPeeringController.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Http.Extensions;
using Azure.Core;
using Microsoft.AspNetCore.Http.Extensions;
using Microsoft.AspNetCore.Mvc;
using SwiftTestingFrameworkAPI.Utils;

Expand Down Expand Up @@ -26,9 +27,10 @@ public TestResponse GetInfo()
}

[HttpPost]
public TestResponse PeerVM()
public ObjectResult PeerVM()
{
Helper.ProcessOutput p;
TestResponse testResponse;
try
{

Expand All @@ -43,16 +45,19 @@ public TestResponse PeerVM()

if (p.ExitCode == 0)
{
return new TestResponse(Constants.ApiVersion, TestName, "Success", p.StdOutput, string.Empty);
testResponse = new TestResponse(Constants.ApiVersion, TestName, "Success", p.StdOutput, string.Empty);
return StatusCode(200, testResponse);
}
else
{
return new TestResponse(Constants.ApiVersion, TestName, "Failure", string.Empty, p.StdError);
testResponse = new TestResponse(Constants.ApiVersion, TestName, "Failure", string.Empty, p.StdError);
return StatusCode(555, testResponse);
}
}
catch (Exception ex)
{
return new TestResponse(Constants.ApiVersion, TestName, "Failure", string.Empty, ex.Message + ex.StackTrace);
testResponse = new TestResponse(Constants.ApiVersion, TestName, "Failure", string.Empty, ex.Message + ex.StackTrace);
return StatusCode(555, testResponse);
}
}
}
Expand Down

0 comments on commit 595d417

Please sign in to comment.