private async Task WaitForScaleUnitReadiness()
        {
            await EnsureClientInitialized();

            await ReliableRun.Execute(async() =>
            {
                ScaleUnitStatus status = await scaleUnitAosClient.CheckScaleUnitConfigurationStatus();

                status.Should().NotBeNull();
                status.Health.Should().Be(ScaleUnitHealthConstants.Running, "Scale unit should be in a healthy/running state.");
            }, "Wait for scale unit readiness");
        }
Пример #2
0
        public async Task <ScaleUnitStatus> CheckScaleUnitConfigurationStatus()
        {
            // Call requires an empty payload.
            var msg        = new HttpRequestMessage(HttpMethod.Post, $"{requestPathPrefix}api/services/ScaleUnitInitializationServiceGroup/ScaleUnitInitializationService/checkStatus/");
            var getPayload = "{}";

            msg.Content = new StringContent(getPayload, Encoding.UTF8, "application/json");
            var response = await httpClient.SendAsync(msg);

            string result = await response.Content.ReadAsStringAsync();

            if (response.IsSuccessStatusCode)
            {
                ScaleUnitStatus parsed = JsonConvert.DeserializeObject <ScaleUnitStatus>(result);
                return(parsed);
            }
            else
            {
                throw RequestFailure((int)response.StatusCode, result);
            }
        }