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

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

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

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

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

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

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

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

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

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

@ -9,7 +9,7 @@ internal class Run
{ {
//var trace = "trace"; //var trace = "trace";
//var tempDir = @"C:\Users\developer\Documents\test"; //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 = "";
//var where = "test==\"AzureProjectTest.VnetTests.Test01_Have2VnetsIn2Regions\"||test==\"AzureProjectTest.VnetTests.Test02_VnetAddressSpace\""; //var where = "test==\"AzureProjectTest.VnetTests.Test01_Have2VnetsIn2Regions\"||test==\"AzureProjectTest.VnetTests.Test02_VnetAddressSpace\"";

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

@ -6,7 +6,7 @@ using NUnit.Framework;
namespace AzureProjectTest; namespace AzureProjectTest;
[GameClass(1)] [GameClass(1), Timeout(Constants.TIMEOUT)]
internal class ResourceGroupTest internal class ResourceGroupTest
{ {
private ArmClient? armClient; private ArmClient? armClient;
@ -26,7 +26,7 @@ internal class ResourceGroupTest
rg = (await subscription.GetResourceGroups()!.GetAsync(Constants.ResourceGroupName)).Value.Data; 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] [Test]
public void Test01_ResourceGroupExist() public void Test01_ResourceGroupExist()
{ {

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

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

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

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

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

@ -6,7 +6,7 @@
"AzureProjectTest.ResourceGroupTest.Test01_ResourceGroupExist", "AzureProjectTest.ResourceGroupTest.Test01_ResourceGroupExist",
"AzureProjectTest.ResourceGroupTest.Test02_ResourceGroupLocation" "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\"", "filter": "test==\"AzureProjectTest.ResourceGroupTest.Test01_ResourceGroupExist\"||test==\"AzureProjectTest.ResourceGroupTest.Test02_ResourceGroupLocation\"",
"timeLimit": 2, "timeLimit": 2,
"reward": 10 "reward": 10

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

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