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

Getting CLI working again #1267

Merged
merged 25 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from 10 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
20 changes: 11 additions & 9 deletions src/OctoshiftCLI.IntegrationTests/BbsToGithub.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,11 @@ public BbsToGithub(ITestOutputHelper output)
public async Task Basic(string bbsServer, bool useSshForArchiveDownload, bool useAzureForArchiveUpload)
{
var bbsProjectKey = $"E2E-{TestHelper.GetOsName().ToUpper()}";
var githubTargetOrg = $"e2e-testing-bbs-{TestHelper.GetOsName()}";
var githubTargetOrg = $"e2e-testing-bbs-{TestHelper.GetOsName()}-2";
var repo1 = $"{bbsProjectKey}-repo-1";
var repo2 = $"{bbsProjectKey}-repo-2";
var targetRepo1 = $"{bbsProjectKey}-e2e-{TestHelper.GetOsName().ToLower()}-repo-1";
var targetRepo2 = $"{bbsProjectKey}-e2e-{TestHelper.GetOsName().ToLower()}-repo-2";

var sourceBbsApi = new BbsApi(_sourceBbsClient, bbsServer, _logger);
var sourceHelper = new TestHelper(_output, sourceBbsApi, _sourceBbsClient, bbsServer);
Expand All @@ -87,10 +89,10 @@ await retryPolicy.Retry(async () =>
await _targetHelper.ResetGithubTestEnvironment(githubTargetOrg);

await sourceHelper.CreateBbsProject(bbsProjectKey);
await sourceHelper.CreateBbsRepo(bbsProjectKey, "repo-1");
await sourceHelper.InitializeBbsRepo(bbsProjectKey, "repo-1");
await sourceHelper.CreateBbsRepo(bbsProjectKey, "repo-2");
await sourceHelper.InitializeBbsRepo(bbsProjectKey, "repo-2");
await sourceHelper.CreateBbsRepo(bbsProjectKey, repo1);
await sourceHelper.InitializeBbsRepo(bbsProjectKey, repo1);
await sourceHelper.CreateBbsRepo(bbsProjectKey, repo2);
await sourceHelper.InitializeBbsRepo(bbsProjectKey, repo2);
ArinGhazarian marked this conversation as resolved.
Show resolved Hide resolved
});

var archiveDownloadOptions = $" --ssh-user octoshift --ssh-private-key {SSH_KEY_FILE}";
Expand Down Expand Up @@ -123,10 +125,10 @@ await _targetHelper.RunBbsCliMigration(

_targetHelper.AssertNoErrorInLogs(_startTime);

await _targetHelper.AssertGithubRepoExists(githubTargetOrg, repo1);
await _targetHelper.AssertGithubRepoExists(githubTargetOrg, repo2);
await _targetHelper.AssertGithubRepoInitialized(githubTargetOrg, repo1);
await _targetHelper.AssertGithubRepoInitialized(githubTargetOrg, repo2);
await _targetHelper.AssertGithubRepoExists(githubTargetOrg, targetRepo1);
await _targetHelper.AssertGithubRepoExists(githubTargetOrg, targetRepo2);
await _targetHelper.AssertGithubRepoInitialized(githubTargetOrg, targetRepo1);
await _targetHelper.AssertGithubRepoInitialized(githubTargetOrg, targetRepo2);

// TODO: Assert migration logs are downloaded
}
Expand Down
4 changes: 3 additions & 1 deletion src/OctoshiftCLI.IntegrationTests/TestHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -487,8 +487,10 @@ private async Task CreateRepo(string org, string repo, bool isPrivate, bool isIn

private async Task<IEnumerable<string>> GetRepoCommitShas(string org, string repo)
{
var retryPolicy = new RetryPolicy(null);

var url = $"{GithubApiBaseUrl}/repos/{org}/{repo}/commits";
var commits = await _githubClient.GetAllAsync(url).ToListAsync();
var commits = await retryPolicy.Retry(async () => await _githubClient.GetAllAsync(url).ToListAsync());
return commits.Select(x => (string)x["sha"]).ToList();
}

Expand Down
Loading