-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
Copy pathTestSettings.cs
38 lines (34 loc) · 1.21 KB
/
TestSettings.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Globalization;
namespace Microsoft.NET.Build.Containers.IntegrationTests;
internal static class TestSettings
{
private static readonly object _tmpLock = new();
private static string? _testArtifactsDir;
/// <summary>
/// Gets temporary location for test artifacts.
/// </summary>
internal static string TestArtifactsDirectory
{
get
{
if (_testArtifactsDir == null)
{
lock (_tmpLock)
{
if (_testArtifactsDir == null)
{
string tmpDir = Path.Combine(TestContext.Current.TestExecutionDirectory, "ContainersTests", DateTime.Now.ToString("yyyyMMddHHmmssfff", CultureInfo.InvariantCulture));
if (!Directory.Exists(tmpDir))
{
Directory.CreateDirectory(tmpDir);
}
return _testArtifactsDir = tmpDir;
}
}
}
return _testArtifactsDir;
}
}
}