Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add integration tests for Multipart uploads #1298

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions src/OctoshiftCLI.IntegrationTests/BbsToGithub.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,31 @@ await _targetHelper.RunBbsCliMigration(
// TODO: Assert migration logs are downloaded
}

[Fact]
public async Task MigrateRepo_MultipartUpload()
{
var archiveFilePath = "./Fixtures/bbs_archive_100.tar";
var githubTargetOrg = $"octoshift-e2e-bbs-{TestHelper.GetOsName()}";
var bbsProjectKey = $"E2E-{TestHelper.GetOsName().ToUpper()}";
var bbsServer = "http://e2e-bbs-8-5-0-linux-2204.eastus.cloudapp.azure.com:7990";
var targetRepo = $"{bbsProjectKey}-e2e-{Guid.NewGuid()}";

var retryPolicy = new RetryPolicy(null);
await retryPolicy.Retry(async () =>
{
await _targetHelper.ResetGithubTestEnvironment(githubTargetOrg);
});

var migrateRepoCommand = $"migrate-repo --github-org {githubTargetOrg} --bbs-server-url {bbsServer} --bbs-project {bbsProjectKey} --archive-path \"{archiveFilePath}\" --use-github-storage";

await _targetHelper.RunBbsMigrateRepoCommand(migrateRepoCommand, _tokens);

_targetHelper.AssertNoErrorInLogs(_startTime);

await _targetHelper.AssertGithubRepoExists(githubTargetOrg, targetRepo);
await _targetHelper.AssertGithubRepoInitialized(githubTargetOrg, targetRepo);
}

private string GetSshKeyName(string bbsServer)
{
var bbsVersion = Regex.Match(bbsServer, @"e2e-bbs-(\d{1,2}-\d{1,2}-\d{1,2})").Groups[1].Value.Replace('-', '_');
Expand Down
1 change: 1 addition & 0 deletions src/OctoshiftCLI.IntegrationTests/Fixtures/bbs_archive.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Blah
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@
</PackageReference>
</ItemGroup>

<ItemGroup>
<None Update="Fixtures\bbs_archive_100.tar">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Octoshift\Octoshift.csproj" />
</ItemGroup>
Expand Down
3 changes: 3 additions & 0 deletions src/OctoshiftCLI.IntegrationTests/TestHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,9 @@ public async Task RunPowershellScript(string script, IDictionary<string, string>
public async Task RunCliCommand(string command, string cliName, IDictionary<string, string> tokens) =>
await RunShellCommand(command, cliName, GetOsDistPath(), tokens);

public async Task RunBbsMigrateRepoCommand(string migrateRepoCommand, IDictionary<string, string> tokens) =>
await RunCliMigration(migrateRepoCommand, "bbs2gh", tokens);

private async Task RunShellCommand(string command, string fileName, string workingDirectory = null, IDictionary<string, string> environmentVariables = null)
{
var startInfo = new ProcessStartInfo
Expand Down
Loading