Fixing the test environmnet so it doesn't keep reinstalling git for every test

This commit is contained in:
Andreia Gaita 2019-07-17 16:41:14 +02:00
Родитель 6615a001c1
Коммит ff71099f09
38 изменённых файлов: 40 добавлений и 1578 удалений

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

@ -60,7 +60,7 @@ namespace Unity.VersionControl.Git
var manifest = path.ReadAllText().FromJson<DugiteReleaseManifest>(true, false);
var (zipAsset, shaAsset) = manifest.GetAsset(environment);
var shaAssetPath = environment.UserCachePath.Combine("downloads", shaAsset.Name);
if (!shaAssetPath.FileExists())
if (!shaAssetPath.FileExists())
{
var downloader = new Downloader();
downloader.QueueDownload(shaAsset.Url, shaAssetPath.Parent, shaAssetPath.FileName);

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

@ -9,6 +9,6 @@ namespace Unity.VersionControl.Git
void Set<T>(string key, T value);
void Unset(string key);
void Rename(string oldKey, string newKey);
NPath SettingsPath { get; set; }
NPath SettingsPath { get; }
}
}
}

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

@ -16,9 +16,7 @@ namespace Unity.VersionControl.Git
public abstract void Rename(string oldKey, string newKey);
public abstract void Set<T>(string key, T value);
public abstract void Unset(string key);
public NPath SettingsPath { get; set; }
protected virtual string SettingsFileName { get; set; }
public NPath SettingsPath { get; protected set; }
}
public class JsonBackedSettings : BaseSettings
@ -46,7 +44,7 @@ namespace Unity.VersionControl.Git
public override void Initialize()
{
cachePath = SettingsPath.Combine(SettingsFileName);
cachePath = SettingsPath;
LoadFromCache(cachePath);
}
@ -232,10 +230,8 @@ namespace Unity.VersionControl.Git
public LocalSettings(IEnvironment environment)
{
SettingsPath = environment.UnityProjectPath.Combine(RelativeSettingsPath);
SettingsPath = environment.UnityProjectPath.Combine(RelativeSettingsPath, settingsFileName);
}
protected override string SettingsFileName { get { return settingsFileName; } }
}
public class UserSettings : JsonBackedSettings
@ -245,12 +241,12 @@ namespace Unity.VersionControl.Git
public UserSettings(IEnvironment environment)
{
SettingsPath = environment.UserCachePath;
SettingsPath = environment.UserCachePath.Combine(settingsFileName);
}
public override void Initialize()
{
var cachePath = SettingsPath.Combine(settingsFileName);
var cachePath = SettingsPath;
if (!cachePath.FileExists())
{
var oldSettings = SettingsPath.Combine(oldSettingsFileName);
@ -259,8 +255,6 @@ namespace Unity.VersionControl.Git
}
base.Initialize();
}
protected override string SettingsFileName { get { return settingsFileName; } }
}
public class SystemSettings : JsonBackedSettings
@ -270,12 +264,12 @@ namespace Unity.VersionControl.Git
public SystemSettings(IEnvironment environment)
{
SettingsPath = environment.SystemCachePath;
SettingsPath = environment.SystemCachePath.Combine(settingsFileName);
}
public override void Initialize()
{
var cachePath = SettingsPath.Combine(settingsFileName);
var cachePath = SettingsPath;
if (!cachePath.FileExists())
{
var oldSettings = SettingsPath.Combine(oldSettingsFileName);
@ -284,7 +278,5 @@ namespace Unity.VersionControl.Git
}
base.Initialize();
}
protected override string SettingsFileName { get { return settingsFileName; } }
}
}

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

@ -108,7 +108,7 @@ namespace Unity.VersionControl.Git
if (expectingResume && httpStatusCode == HttpStatusCode.RequestedRangeNotSatisfiable)
{
webResponse.Dispose();
webResponse.Close();
return DownloadInternal(logger, url, destinationStream, onProgress, true);
}

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

@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Boo.Lang;
namespace Unity.VersionControl.Git
{
@ -32,7 +32,7 @@ namespace Unity.VersionControl.Git
inner = inner.InnerException;
}
var message = string.Join(Environment.NewLine, exceptions.Select(x => x.Message));
var message = string.Join(Environment.NewLine, exceptions.Select(x => x.Message).ToArray());
message += Environment.NewLine + exceptions.Last().StackTrace;
return message;
}
@ -47,7 +47,7 @@ namespace Unity.VersionControl.Git
inner = inner.InnerException;
}
var message = string.Join(Environment.NewLine, exceptions.Select(x => x.Message));
var message = string.Join(Environment.NewLine, exceptions.Select(x => x.Message).ToArray());
return message;
}
}

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

@ -99,7 +99,7 @@ namespace IntegrationTests
{
InitializeEnvironment(repoPath, enableEnvironmentTrace, true);
InitializePlatform(repoPath, enableEnvironmentTrace: enableEnvironmentTrace, testName: testName);
SetupGit(Environment.LocalAppData, testName);
SetupGit(Environment.UserCachePath, testName);
DotGitPath = repoPath.Combine(".git");

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

@ -42,46 +42,10 @@
</None>
</ItemGroup>
<ItemGroup>
<None Update="Resources\downloads\dugite-native-v2.21.0-954b7fe-macOS.tar.gz">
<None Update="Resources\**">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Resources\downloads\dugite-native-v2.21.0-954b7fe-macOS.tar.gz.sha256">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Resources\downloads\dugite-native-v2.21.0-954b7fe-ubuntu.tar.gz">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Resources\downloads\dugite-native-v2.21.0-954b7fe-ubuntu.tar.gz.sha256">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Resources\downloads\dugite-native-v2.21.0-954b7fe-windows-x64.tar.gz">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Resources\downloads\dugite-native-v2.21.0-954b7fe-windows-x64.tar.gz.sha256">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Resources\downloads\dugite-native-v2.21.0-954b7fe-windows-x86.tar.gz">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Resources\downloads\dugite-native-v2.21.0-954b7fe-windows-x86.tar.gz.sha256">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Resources\dugite-native-v2.21.0-954b7fe-windows-x86.tar.gz">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Resources\dugite-native-v2.21.0-954b7fe-windows-x86.tar.gz.sha256">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Resources\embedded-git.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="UnzipTestResources\testfile.tar.gz">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="UnzipTestResources\testfile.tgz">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="UnzipTestResources\testfile.zip">
<None Update="UnzipTestResources\**">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

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

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:507a543a390045a6be1c372cf1b23eec1384d9f4f1db7337c39cd1cf638c1e2e
size 15370335

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

@ -1 +0,0 @@
507a543a390045a6be1c372cf1b23eec1384d9f4f1db7337c39cd1cf638c1e2e

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

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:662436cf45a343a5181a4784af5a8b2c6999bac4be4729b6b87c913d151e89ff
size 17322873

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

@ -1 +0,0 @@
662436cf45a343a5181a4784af5a8b2c6999bac4be4729b6b87c913d151e89ff

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

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ca4f201bbaef0936d3f5aabbcf44dd3b42afd50c1362a5f2e543bfd2501a1e8a
size 25695466

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

@ -1 +0,0 @@
ca4f201bbaef0936d3f5aabbcf44dd3b42afd50c1362a5f2e543bfd2501a1e8a

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

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:79183f337de97ff01cfaff5f12bbe6201a08ba63802c01f74c524128eeca7a4f
size 25674260

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

@ -1 +0,0 @@
79183f337de97ff01cfaff5f12bbe6201a08ba63802c01f74c524128eeca7a4f

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

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

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ca4f201bbaef0936d3f5aabbcf44dd3b42afd50c1362a5f2e543bfd2501a1e8a
size 25695466

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

@ -1 +0,0 @@
ca4f201bbaef0936d3f5aabbcf44dd3b42afd50c1362a5f2e543bfd2501a1e8a

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

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:79183f337de97ff01cfaff5f12bbe6201a08ba63802c01f74c524128eeca7a4f
size 25674260

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

@ -1 +0,0 @@
79183f337de97ff01cfaff5f12bbe6201a08ba63802c01f74c524128eeca7a4f

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

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:717a5d215331875e1ad0a44d1f9c2187c44b7a5aaa258dbb6cc16feffd5f3f3d
size 15372751

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

@ -0,0 +1 @@
717a5d215331875e1ad0a44d1f9c2187c44b7a5aaa258dbb6cc16feffd5f3f3d

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

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:489bea48266fe3bc0df2cd27d92a5658c1d1e048c3f3a65efb753c2348fcceef
size 17413099

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

@ -0,0 +1 @@
489bea48266fe3bc0df2cd27d92a5658c1d1e048c3f3a65efb753c2348fcceef

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

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8f40038f43b726d57632e70a93bafeaa13ef50c4e18179186168ce8e1eff70a7
size 25735952

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

@ -0,0 +1 @@
8f40038f43b726d57632e70a93bafeaa13ef50c4e18179186168ce8e1eff70a7

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

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0bcde5a24ce070c929ff3c7ee43dfd011ecf85512977ff369821757abb8e7677
size 25705621

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

@ -0,0 +1 @@
0bcde5a24ce070c929ff3c7ee43dfd011ecf85512977ff369821757abb8e7677

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

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

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:15269ac992592484612ddcb760363294c1978fd79807f75b8536818db7c6f9e7
size 2681983

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

@ -1,18 +0,0 @@
[core]
symlinks = false
autocrlf = true
[color]
diff = auto
status = auto
branch = auto
interactive = true
[pack]
packSizeLimit = 2g
[help]
format = html
[http]
sslCAinfo = /ssl/certs/ca-bundle.crt
[diff "astextplain"]
textconv = astextplain
[rebase]
autosquash = true

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

@ -1 +0,0 @@
{"md5":"e2941215f99afa99f002e96c0ae70966","url":"http://localhost:50000/unity/git/mac/git-lfs.zip","releaseNotes":null,"releaseNotesUrl":null,"message":null,"version":"2.4.0"}

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

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:4e1ea7c1c6b78c05293039c634426760dfc36cedd6a8a8e92ab26809abcf829a
size 2936128

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

@ -1,18 +0,0 @@
[core]
symlinks = false
autocrlf = true
[color]
diff = auto
status = auto
branch = auto
interactive = true
[pack]
packSizeLimit = 2g
[help]
format = html
[http]
sslCAinfo = /ssl/certs/ca-bundle.crt
[diff "astextplain"]
textconv = astextplain
[rebase]
autosquash = true

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

@ -1 +0,0 @@
{"md5":"78ff68661485e1c09f7b8d82c4317ab5","url":"http://localhost:50000/unity/git/windows/git-lfs.zip","releaseNotes":null,"releaseNotesUrl":null,"message":null,"version":"2.4.0"}

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

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:886979483c46838de1b0a6a4399c2c6e5ff03c6306c17cf46fee595d04dcfe1b
size 30251695

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

@ -1 +0,0 @@
{"md5":"75c42f674b9ff32ebe338ff204f907cf","url":"http://localhost:50000/unity/git/windows/git.zip","releaseNotes":null,"releaseNotesUrl":null,"message":null,"version":"2.17.0.windows.0"}

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

@ -306,14 +306,14 @@ namespace UnitTests
new GitStatusEntry(@"Assets/Assets.Test.dll", TestRootPath + @"\Assets/Assets.Test.dll", null, GitFileStatus.Untracked, GitFileStatus.Untracked),
new GitStatusEntry(@"Assets/Assets.Test.dll.meta", TestRootPath + @"\Assets/Assets.Test.dll.meta", null, GitFileStatus.Untracked, GitFileStatus.Untracked),
new GitStatusEntry(@"blah.txt", TestRootPath + @"\blah.txt", null, GitFileStatus.Untracked, GitFileStatus.Untracked),
new GitStatusEntry(@"Plugins/Unity.VersionControl.Git.dll", TestRootPath + @"\Plugins/Unity.VersionControl.Git.dll", null, GitFileStatus.Untracked, GitFileStatus.Untracked),
new GitStatusEntry(@"Plugins/Unity.VersionControl.Git.dll.meta", TestRootPath + @"\Plugins/Unity.VersionControl.Git.dll.meta", null, GitFileStatus.Untracked, GitFileStatus.Untracked),
new GitStatusEntry(@"Plugins/Unity.VersionControl.Git.dll.mdb", TestRootPath + @"\Plugins/Unity.VersionControl.Git.dll.mdb", null, GitFileStatus.Untracked, GitFileStatus.Untracked),
new GitStatusEntry(@"Plugins/Unity.VersionControl.Git.dll.mdb.meta", TestRootPath + @"\Plugins/Unity.VersionControl.Git.dll.mdb.meta", null, GitFileStatus.Untracked, GitFileStatus.Untracked),
new GitStatusEntry(@"Plugins/Unity.Git2.dll", TestRootPath + @"\Plugins/Unity.Git2.dll", null, GitFileStatus.Untracked, GitFileStatus.Untracked),
new GitStatusEntry(@"Plugins/Unity.Git2.dll.meta", TestRootPath + @"\Plugins/Unity.Git2.dll.meta", null, GitFileStatus.Untracked, GitFileStatus.Untracked),
new GitStatusEntry(@"Plugins/Unity.Git2.dll.mdb", TestRootPath + @"\Plugins/Unity.Git2.dll.mdb", null, GitFileStatus.Untracked, GitFileStatus.Untracked),
new GitStatusEntry(@"Plugins/Unity.Git2.dll.mdb.meta", TestRootPath + @"\Plugins/Unity.Git2.dll.mdb.meta", null, GitFileStatus.Untracked, GitFileStatus.Untracked),
new GitStatusEntry(@"Plugins/Unity.VersionControl.Git.dll", TestRootPath + @"\Plugins/Unity.VersionControl.Git.dll", null, GitFileStatus.Untracked, GitFileStatus.Untracked),
new GitStatusEntry(@"Plugins/Unity.VersionControl.Git.dll.meta", TestRootPath + @"\Plugins/Unity.VersionControl.Git.dll.meta", null, GitFileStatus.Untracked, GitFileStatus.Untracked),
new GitStatusEntry(@"Plugins/Unity.VersionControl.Git.dll.mdb", TestRootPath + @"\Plugins/Unity.VersionControl.Git.dll.mdb", null, GitFileStatus.Untracked, GitFileStatus.Untracked),
new GitStatusEntry(@"Plugins/Unity.VersionControl.Git.dll.mdb.meta", TestRootPath + @"\Plugins/Unity.VersionControl.Git.dll.mdb.meta", null, GitFileStatus.Untracked, GitFileStatus.Untracked),
}
});
}
@ -324,7 +324,7 @@ namespace UnitTests
GitStatus? result = null;
var outputProcessor = new GitStatusOutputProcessor(gitObjectFactory);
outputProcessor.OnEntry += status => { result = status; };
outputProcessor.OnEntry += status => result = status;
foreach (var line in lines)
{