Beispiel #1
0
        public async Task <IActionResult> InspectSwarmAsync()
        {
            try
            {
                var response = await _swarmClient.GetSwarmInfo();

                return(Json(response));
            }
            catch (Exception ex)
            {
                return(CreateErrorResponse(ex, "Cannot fetch information about swarm status."));
            }
        }
Beispiel #2
0
        public async Task ShouldReturnSystemInfoWhenInspectCluster()
        {
            //Given
            _swarmClient.GetSwarmInfo().Returns(Task.FromResult(_any.Create <SwarmInspectResponse>()));
            var swarmService      = new SwarmApi.Services.SwarmService(_swarmClient, _loggerFactory);
            var serviceController = new SwarmController(swarmService);

            //When
            var response = await serviceController.InspectCluster();

            var result = response as JsonResult;

            //Then
            Assert.NotNull(result);
            Assert.Equal(200, result.StatusCode);
        }