Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Commit b1d005d

Browse files
committed
Add spaces to pahts in tests so we can catch potential problems
1 parent 870ed3b commit b1d005d

File tree

4 files changed

+17
-19
lines changed

4 files changed

+17
-19
lines changed

src/GitHub.Api/Application/ApplicationInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ namespace GitHub.Unity
44
static partial class ApplicationInfo
55
{
66
#if DEBUG
7-
public const string ApplicationName = "GitHubUnityDebug";
7+
public const string ApplicationName = "GitHub for Unity Debug";
88
public const string ApplicationProvider = "GitHub";
99
#else
1010
public const string ApplicationName = "GitHubUnity";

src/tests/IntegrationTests/BaseIntegrationTest.cs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -158,13 +158,16 @@ protected void SetupGit(NPath pathToSetupGitInto, string testName)
158158
Exception ex = null;
159159

160160
var setupTask = gitInstaller.SetupGitIfNeeded();
161-
setupTask.OnEnd += (thisTask, path, success, exception) => {
162-
result = path;
163-
ex = exception;
164-
autoResetEvent.Set();
161+
setupTask.OnEnd += (thisTask, _, __, ___) => {
162+
((ITask<NPath>)thisTask.GetEndOfChain()).OnEnd += (t, path, success, exception) =>
163+
{
164+
result = path;
165+
ex = exception;
166+
autoResetEvent.Set();
167+
};
165168
};
166-
167-
if (!autoResetEvent.WaitOne(TimeSpan.FromMinutes(1)))
169+
setupTask.Start();
170+
if (!autoResetEvent.WaitOne(TimeSpan.FromMinutes(5)))
168171
throw new TimeoutException($"Test setup unzipping {zipArchivesPath} to {pathToSetupGitInto} timed out");
169172

170173
if (result == null)
@@ -197,7 +200,7 @@ public virtual void TestFixtureTearDown()
197200
[SetUp]
198201
public virtual void OnSetup()
199202
{
200-
TestBasePath = NPath.CreateTempDirectory("integration-tests");
203+
TestBasePath = NPath.CreateTempDirectory("integration tests");
201204
NPath.FileSystem.SetCurrentDirectory(TestBasePath);
202205
TestRepoMasterCleanUnsynchronized = TestBasePath.Combine("IOTestsRepo", "IOTestsRepo_master_clean_unsync");
203206
TestRepoMasterCleanUnsynchronizedRussianLanguage = TestBasePath.Combine("IOTestsRepo", "IOTestsRepo_master_clean_sync_with_russian_language");

src/tests/IntegrationTests/IntegrationTestEnvironment.cs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ class IntegrationTestEnvironment : IEnvironment
1212
private static readonly ILogging logger = LogHelper.GetLogger<IntegrationTestEnvironment>();
1313
private readonly bool enableTrace;
1414

15-
private readonly NPath integrationTestEnvironmentPath;
16-
1715
private DefaultEnvironment defaultEnvironment;
1816

1917
public IntegrationTestEnvironment(ICacheContainer cacheContainer,
@@ -26,13 +24,10 @@ public IntegrationTestEnvironment(ICacheContainer cacheContainer,
2624
defaultEnvironment = new DefaultEnvironment(cacheContainer);
2725
defaultEnvironment.FileSystem.SetCurrentDirectory(repoPath);
2826
environmentPath = environmentPath ??
29-
defaultEnvironment.GetSpecialFolder(Environment.SpecialFolder.LocalApplicationData)
30-
.ToNPath()
31-
.EnsureDirectoryExists(ApplicationInfo.ApplicationName + "-IntegrationTests");
27+
defaultEnvironment.UserCachePath.EnsureDirectoryExists("IntegrationTests");
3228

33-
integrationTestEnvironmentPath = environmentPath.Value;
34-
UserCachePath = integrationTestEnvironmentPath.Combine("User");
35-
SystemCachePath = integrationTestEnvironmentPath.Combine("System");
29+
UserCachePath = environmentPath.Value.Combine("User");
30+
SystemCachePath = environmentPath.Value.Combine("System");
3631

3732
var installPath = solutionDirectory.Parent.Parent.Combine("src", "GitHub.Api");
3833

@@ -76,7 +71,7 @@ public string GetEnvironmentVariable(string v)
7671

7772
public string GetSpecialFolder(Environment.SpecialFolder folder)
7873
{
79-
var ensureDirectoryExists = integrationTestEnvironmentPath.EnsureDirectoryExists(folder.ToString());
74+
var ensureDirectoryExists = UserCachePath.Parent.EnsureDirectoryExists(folder.ToString());
8075
var specialFolderPath = ensureDirectoryExists.ToString();
8176

8277
if (enableTrace)
@@ -87,7 +82,7 @@ public string GetSpecialFolder(Environment.SpecialFolder folder)
8782
return specialFolderPath;
8883
}
8984

90-
public string UserProfilePath => integrationTestEnvironmentPath.CreateDirectory("user-profile-path");
85+
public string UserProfilePath => UserCachePath.Parent.CreateDirectory("user profile path");
9186

9287
public NPath Path => Environment.GetEnvironmentVariable("PATH").ToNPath();
9388
public string NewLine => Environment.NewLine;

src/tests/TaskSystemIntegrationTests/Tests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public void OneTimeSetup()
4343
TaskManager.UIScheduler = new SynchronizationContextTaskScheduler(syncContext);
4444

4545
var env = new DefaultEnvironment();
46-
TestBasePath = NPath.CreateTempDirectory("integration-tests");
46+
TestBasePath = NPath.CreateTempDirectory("integration tests");
4747
env.FileSystem.SetCurrentDirectory(TestBasePath);
4848

4949
var repo = Substitute.For<IRepository>();

0 commit comments

Comments
 (0)