* Add timeout logic as some students create azure function never return response.

* change timeout and delay value.

* Fix resource group region.
This commit is contained in:
Cyrus 2022-10-03 10:14:12 +00:00 коммит произвёл GitHub
Родитель 0a0f44c477
Коммит 8046b958f3
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
11 изменённых файлов: 19 добавлений и 13 удалений

Просмотреть файл

@ -8,10 +8,10 @@ using NUnit.Framework;
namespace AzureProjectTest;
[GameClass(5)]
[GameClass(5), Timeout(Constants.TIMEOUT)]
internal class AppServiceTest
{
private static readonly HttpClient HttpClient = new();
private HttpClient HttpClient;
private IAppServicePlan? appServicePlan;
private IAppServiceManager? client;
private IFunctionApp? functionApp;
@ -25,6 +25,9 @@ internal class AppServiceTest
[SetUp]
public void Setup()
{
HttpClient = new();
HttpClient.Timeout = TimeSpan.FromSeconds(85);
var config = new Config();
client = AppServiceManager.Configure().Authenticate(config.Credentials, config.SubscriptionId);
appServicePlan = client.AppServicePlans.ListByResourceGroup(Constants.ResourceGroupName)

Просмотреть файл

@ -7,7 +7,7 @@ using NUnit.Framework;
namespace AzureProjectTest;
[GameClass(4)]
[Parallelizable(ParallelScope.Children)]
[Parallelizable(ParallelScope.Children), Timeout(Constants.TIMEOUT)]
internal class ApplicationInsightTest
{
private ApplicationInsightsComponent? applicationInsight;

Просмотреть файл

@ -4,7 +4,7 @@
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Azure.Identity" Version="1.6.0" />

Просмотреть файл

@ -1,8 +1,11 @@
namespace AzureProjectTest;
public class Constants
public static class Constants
{
public static readonly string ResourceGroupName = "projProd";
public static readonly string Vnet1Name = "projVnet1Prod";
public static readonly string Vnet2Name = "projVnet2Prod";
public const int TIMEOUT = 90000;
}

Просмотреть файл

@ -4,7 +4,7 @@ using NUnit.Framework;
namespace AzureProjectTest;
[Parallelizable(ParallelScope.Children)]
[Parallelizable(ParallelScope.Children), Timeout(Constants.TIMEOUT)]
internal class LogAnalyticsWorkspaceTest
{
private MonitorManagementClient? client;

Просмотреть файл

@ -9,7 +9,7 @@ internal class Run
{
//var trace = "trace";
//var tempDir = @"C:\Users\developer\Documents\test";
//var tempCredentialsFilePath = @"C:\Users\developer\Documents\AzureCloudLabEnvironment.json";
//var tempCredentialsFilePath = @"C:\Users\developer\Documents\debug.json";
//var where = "";
//var where = "test==\"AzureProjectTest.VnetTests.Test01_Have2VnetsIn2Regions\"||test==\"AzureProjectTest.VnetTests.Test02_VnetAddressSpace\"";

Просмотреть файл

@ -6,7 +6,7 @@ using NUnit.Framework;
namespace AzureProjectTest;
[GameClass(1)]
[GameClass(1), Timeout(Constants.TIMEOUT)]
internal class ResourceGroupTest
{
private ArmClient? armClient;
@ -26,7 +26,7 @@ internal class ResourceGroupTest
rg = (await subscription.GetResourceGroups()!.GetAsync(Constants.ResourceGroupName)).Value.Data;
}
[GameTask("Can you create a resource group named 'projProd' in Singapore?", 2, 10, 1)]
[GameTask("Can you create a resource group named 'projProd' in Hong Kong?", 2, 10, 1)]
[Test]
public void Test01_ResourceGroupExist()
{

Просмотреть файл

@ -6,7 +6,7 @@ using NUnit.Framework;
namespace AzureProjectTest;
[GameClass(2)]
[GameClass(2), Timeout(Constants.TIMEOUT)]
internal class StorageAccountTest
{
private static readonly HttpClient HttpClient = new();

Просмотреть файл

@ -6,7 +6,7 @@ using NUnit.Framework;
namespace AzureProjectTest;
[GameClass(3)]
[Parallelizable(ParallelScope.Children)]
[Parallelizable(ParallelScope.Children), Timeout(Constants.TIMEOUT)]
public class VnetTests
{
[GameTask(

Просмотреть файл

@ -6,7 +6,7 @@
"AzureProjectTest.ResourceGroupTest.Test01_ResourceGroupExist",
"AzureProjectTest.ResourceGroupTest.Test02_ResourceGroupLocation"
],
"instruction": "Can you create a resource group named 'projProd' in Singapore?",
"instruction": "Can you create a resource group named 'projProd' in Hong Kong?",
"filter": "test==\"AzureProjectTest.ResourceGroupTest.Test01_ResourceGroupExist\"||test==\"AzureProjectTest.ResourceGroupTest.Test02_ResourceGroupLocation\"",
"timeLimit": 2,
"reward": 10

Просмотреть файл

@ -79,7 +79,7 @@ class AzureAutomaticGradingEngineGraderStack extends TerraformStack {
resourceGroup,
skuName: "Basic_1",
wpiUsers: [{ email: process.env.API_EMAIL!, firstName: "API", lastName: "API", id: "unique" }],
functionNames: ["AzureGraderApi", "AzureGraderFunction"],
functionNames: ["AzureGraderFunction"],
ipRateLimit: 60,
corsDomain: "*"
})