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

Commit 690dec2

Browse files
committed
Fix git installer test
1 parent 79af1d0 commit 690dec2

File tree

6 files changed

+43
-13
lines changed

6 files changed

+43
-13
lines changed

src/GitHub.Api/Installer/GitInstaller.cs

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,16 @@ class GitInstallDetails
1111
public NPath GitExecPath { get; }
1212
public string GitLfsExec { get; }
1313
public NPath GitLfsExecPath { get; }
14+
public UriString GitZipMd5Url { get; set; } = DefaultGitZipMd5Url;
15+
public UriString GitZipUrl { get; set; } = DefaultGitZipUrl;
16+
public UriString GitLfsZipMd5Url { get; set; } = DefaultGitLfsZipMd5Url;
17+
public UriString GitLfsZipUrl { get; set; } = DefaultGitLfsZipUrl;
18+
19+
public const string DefaultGitZipMd5Url = "https://ghfvs-installer.github.com/unity/portable_git/git.zip.MD5.txt";
20+
public const string DefaultGitZipUrl = "https://ghfvs-installer.github.com/unity/portable_git/git.zip";
21+
public const string DefaultGitLfsZipMd5Url = "https://ghfvs-installer.github.com/unity/portable_git/git-lfs.zip.MD5.txt";
22+
public const string DefaultGitLfsZipUrl = "https://ghfvs-installer.github.com/unity/portable_git/git-lfs.zip";
23+
1424

1525
public const string GitExtractedMD5 = "e6cfc0c294a2312042f27f893dfc9c0a";
1626
public const string GitLfsExtractedMD5 = "36e3ae968b69fbf42dff72311040d24a";
@@ -165,25 +175,25 @@ private void ExtractPortableGit(ActionTask<NPath> onSuccess, ITask onFailure)
165175
private ITask CreateDownloadTask()
166176
{
167177
var tempZipPath = NPath.CreateTempDirectory("git_zip_paths");
168-
gitArchiveFilePath = tempZipPath.Combine("git");
169-
gitLfsArchivePath = tempZipPath.Combine("git-lfs");
178+
gitArchiveFilePath = tempZipPath.Combine("git.zip");
179+
gitLfsArchivePath = tempZipPath.Combine("git-lfs.zip");
170180

171181
var downloadGitMd5Task = new DownloadTextTask(TaskManager.Instance.Token,
172182
environment.FileSystem,
173-
"https://ghfvs-installer.github.com/unity/portable_git/git.zip.MD5.txt",
174-
gitArchiveFilePath);
183+
installDetails.GitZipMd5Url,
184+
tempZipPath);
175185

176186
var downloadGitTask = new DownloadTask(TaskManager.Instance.Token, environment.FileSystem,
177-
"https://ghfvs-installer.github.com/unity/portable_git/git.zip",
178-
gitArchiveFilePath, retryCount: 1);
187+
installDetails.GitZipUrl,
188+
tempZipPath);
179189

180190
var downloadGitLfsMd5Task = new DownloadTextTask(TaskManager.Instance.Token, environment.FileSystem,
181-
"https://ghfvs-installer.github.com/unity/portable_git/git-lfs.zip.MD5.txt",
182-
gitLfsArchivePath);
191+
installDetails.GitLfsZipMd5Url,
192+
tempZipPath);
183193

184194
var downloadGitLfsTask = new DownloadTask(TaskManager.Instance.Token, environment.FileSystem,
185-
"https://ghfvs-installer.github.com/unity/portable_git/git-lfs.zip",
186-
gitLfsArchivePath, retryCount: 1);
195+
installDetails.GitLfsZipUrl,
196+
tempZipPath);
187197

188198
return downloadGitMd5Task
189199
.Then((b, s) => {

src/GitHub.Api/Tasks/DownloadTask.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,10 @@ protected virtual string RunDownload(bool success)
141141
return Destination;
142142
}
143143

144+
public override string ToString()
145+
{
146+
return $"{base.ToString()} {Url}";
147+
}
144148

145149
public UriString Url { get; }
146150

src/tests/IntegrationTests/Installer/GitInstallerTests.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public override void TestFixtureSetUp()
2424
base.TestFixtureSetUp();
2525
server = new TestWebServer.HttpServer(SolutionDirectory.Combine("files"));
2626
Task.Factory.StartNew(server.Start);
27-
ApplicationConfiguration.WebTimeout = 5000;
27+
ApplicationConfiguration.WebTimeout = 10000;
2828
}
2929

3030
public override void TestFixtureTearDown()
@@ -39,9 +39,15 @@ public void GitInstallTest()
3939
{
4040
var gitInstallationPath = TestBasePath.Combine("GitInstall").CreateDirectory();
4141

42-
var installDetails = new GitInstallDetails(gitInstallationPath, DefaultEnvironment.OnWindows);
42+
var installDetails = new GitInstallDetails(gitInstallationPath, DefaultEnvironment.OnWindows)
43+
{
44+
GitZipMd5Url = $"http://localhost:{server.Port}/{new UriString(GitInstallDetails.DefaultGitZipMd5Url).Filename}",
45+
GitZipUrl = $"http://localhost:{server.Port}/{new UriString(GitInstallDetails.DefaultGitZipUrl).Filename}",
46+
GitLfsZipMd5Url = $"http://localhost:{server.Port}/{new UriString(GitInstallDetails.DefaultGitLfsZipMd5Url).Filename}",
47+
GitLfsZipUrl = $"http://localhost:{server.Port}/{new UriString(GitInstallDetails.DefaultGitLfsZipUrl).Filename}",
48+
};
4349

44-
//var zipArchivesPath = TestBasePath.Combine("ZipArchives").CreateDirectory();
50+
TestBasePath.Combine("git").CreateDirectory();
4551

4652
//var gitArchivePath = AssemblyResources.ToFile(ResourceType.Platform, "git.zip", zipArchivesPath, Environment);
4753
//var gitLfsArchivePath = AssemblyResources.ToFile(ResourceType.Platform, "git-lfs.zip", zipArchivesPath, Environment);

src/tests/TestWebServer/TestWebServer.csproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,17 @@
4646
<None Include="files\git-lfs.zip">
4747
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
4848
</None>
49+
<None Include="files\git.zip">
50+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
51+
</None>
4952
</ItemGroup>
5053
<ItemGroup>
5154
<Content Include="files\git-lfs.zip.MD5.txt">
5255
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
5356
</Content>
57+
<Content Include="files\git.zip.MD5.txt">
58+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
59+
</Content>
5460
</ItemGroup>
5561
<ItemGroup>
5662
<ProjectReference Include="..\..\GitHub.Logging\GitHub.Logging.csproj">

src/tests/TestWebServer/files/git.zip

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:24864bd6ed4d60a516330107932082ae17ae5b98b0819d6cb6eba4a96b7ae0e4
3+
size 83230267
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
EA5D5A38A6B9E9BC2B10011602C65A0D

0 commit comments

Comments
 (0)