private static void ExecuteAgent(string statusFileName, string statusUrl, string agentName, string operationUrl)
{
// Call agent main operation
string status = AgentHelper.Request(operationUrl, agentName);
// If the package installation process takes more than http timeout, retrieve status
if (!IsCompleted(status))
{
// Retrieve status while the previous request timed out, status is in progress or package is already being installed
while (!IsCompleted(status) && !status.StartsWith("Failed", StringComparison.OrdinalIgnoreCase))
{
Thread.Sleep(2000);
status = AgentHelper.Request(statusUrl, statusFileName);
}
// Break the process if something went wrong and the package is not installed
Assert.IsTrue(IsCompleted(status), status);
}
}