|
| 1 | +using System.Threading.Tasks; |
| 2 | +using Xunit; |
| 3 | +using Xunit.Abstractions; |
| 4 | + |
| 5 | +namespace OctoshiftCLI.IntegrationTests |
| 6 | +{ |
| 7 | + [Collection("Integration Tests")] |
| 8 | + public class AdoServerToGithub : AdoToGithub |
| 9 | + { |
| 10 | + private const string ADO_SERVER_URL = "http://octoshift-ado-server-2022.eastus.cloudapp.azure.com/"; |
| 11 | + |
| 12 | + public AdoServerToGithub(ITestOutputHelper output) : base(output, ADO_SERVER_URL, "ADO_SERVER_PAT") |
| 13 | + { |
| 14 | + } |
| 15 | + |
| 16 | + [Fact] |
| 17 | + public async Task Basic() |
| 18 | + { |
| 19 | + var adoOrg = $"gei-e2e-testing-basic-{TestHelper.GetOsName()}"; |
| 20 | + var githubOrg = $"e2e-testing-ado-server-{TestHelper.GetOsName()}"; |
| 21 | + var teamProject1 = "gei-e2e-1"; |
| 22 | + var teamProject2 = "gei-e2e-2"; |
| 23 | + var adoRepo1 = teamProject1; |
| 24 | + var adoRepo2 = teamProject2; |
| 25 | + var pipeline1 = "pipeline1"; |
| 26 | + var pipeline2 = "pipeline2"; |
| 27 | + |
| 28 | + var retryPolicy = new RetryPolicy(null); |
| 29 | + |
| 30 | + await retryPolicy.Retry(async () => |
| 31 | + { |
| 32 | + await Helper.ResetAdoTestEnvironment(adoOrg, ADO_SERVER_URL); |
| 33 | + await Helper.ResetGithubTestEnvironment(githubOrg); |
| 34 | + |
| 35 | + await Helper.CreateTeamProject(adoOrg, teamProject1, ADO_SERVER_URL); |
| 36 | + var commitId = await Helper.InitializeAdoRepo(adoOrg, teamProject1, adoRepo1, ADO_SERVER_URL); |
| 37 | + await Helper.CreatePipeline(adoOrg, teamProject1, adoRepo1, pipeline1, commitId, ADO_SERVER_URL); |
| 38 | + |
| 39 | + await Helper.CreateTeamProject(adoOrg, teamProject2, ADO_SERVER_URL); |
| 40 | + commitId = await Helper.InitializeAdoRepo(adoOrg, teamProject2, adoRepo2, ADO_SERVER_URL); |
| 41 | + await Helper.CreatePipeline(adoOrg, teamProject2, adoRepo2, pipeline2, commitId, ADO_SERVER_URL); |
| 42 | + }); |
| 43 | + |
| 44 | + await Helper.RunAdoToGithubCliMigration($"generate-script --github-org {githubOrg} --ado-org {adoOrg} --ado-server-url {ADO_SERVER_URL} --download-migration-logs --create-teams --link-idp-groups", Tokens); |
| 45 | + |
| 46 | + Helper.AssertNoErrorInLogs(StartTime); |
| 47 | + |
| 48 | + await Helper.AssertGithubRepoExists(githubOrg, $"{teamProject1}-{teamProject1}"); |
| 49 | + await Helper.AssertGithubRepoExists(githubOrg, $"{teamProject2}-{teamProject2}"); |
| 50 | + await Helper.AssertGithubRepoInitialized(githubOrg, $"{teamProject1}-{teamProject1}"); |
| 51 | + await Helper.AssertGithubRepoInitialized(githubOrg, $"{teamProject2}-{teamProject2}"); |
| 52 | + await Helper.AssertGithubTeamCreated(githubOrg, $"{teamProject1}-Maintainers"); |
| 53 | + await Helper.AssertGithubTeamCreated(githubOrg, $"{teamProject1}-Admins"); |
| 54 | + await Helper.AssertGithubTeamCreated(githubOrg, $"{teamProject2}-Maintainers"); |
| 55 | + await Helper.AssertGithubTeamCreated(githubOrg, $"{teamProject2}-Admins"); |
| 56 | + await Helper.AssertGithubTeamIdpLinked(githubOrg, $"{teamProject1}-Maintainers", $"{teamProject1}-Maintainers"); |
| 57 | + await Helper.AssertGithubTeamIdpLinked(githubOrg, $"{teamProject1}-Admins", $"{teamProject1}-Admins"); |
| 58 | + await Helper.AssertGithubTeamIdpLinked(githubOrg, $"{teamProject2}-Maintainers", $"{teamProject2}-Maintainers"); |
| 59 | + await Helper.AssertGithubTeamIdpLinked(githubOrg, $"{teamProject2}-Admins", $"{teamProject2}-Admins"); |
| 60 | + await Helper.AssertGithubTeamHasRepoRole(githubOrg, $"{teamProject1}-Maintainers", $"{teamProject1}-{teamProject1}", "maintain"); |
| 61 | + await Helper.AssertGithubTeamHasRepoRole(githubOrg, $"{teamProject1}-Admins", $"{teamProject1}-{teamProject1}", "admin"); |
| 62 | + await Helper.AssertGithubTeamHasRepoRole(githubOrg, $"{teamProject2}-Maintainers", $"{teamProject2}-{teamProject2}", "maintain"); |
| 63 | + await Helper.AssertGithubTeamHasRepoRole(githubOrg, $"{teamProject2}-Admins", $"{teamProject2}-{teamProject2}", "admin"); |
| 64 | + Helper.AssertMigrationLogFileExists(githubOrg, $"{teamProject1}-{teamProject1}"); |
| 65 | + Helper.AssertMigrationLogFileExists(githubOrg, $"{teamProject2}-{teamProject2}"); |
| 66 | + } |
| 67 | + } |
| 68 | +} |
0 commit comments