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

BREAKING CHANGE: Drop support for deprecated --wait option in migrate-repo and migrate-org #1083

Merged
merged 5 commits into from
Aug 2, 2023
Merged
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
3 changes: 2 additions & 1 deletion RELEASENOTES.md
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
- Fix target repo existence check in GitHub Enterprise Server migrations so it doesn't error if the target repo used to exist, but has been renamed
- __BREAKING CHANGE__: Drop deprecated `--wait` option for `migrate-repo` and `migrate-org` commands
- Fix target repo existence check in GitHub Enterprise Server migrations so it doesn't error if the target repo used to exist, but has been renamed

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@ public async Task Happy_Path_With_Wait()
AdoRepo = ADO_REPO,
GithubOrg = GITHUB_ORG,
GithubRepo = GITHUB_REPO,
Wait = true,
};
await _handler.Handle(args);

Expand Down Expand Up @@ -241,7 +240,6 @@ await _handler.Invoking(async x => await x.Handle(new MigrateRepoCommandArgs
AdoRepo = ADO_REPO,
GithubOrg = GITHUB_ORG,
GithubRepo = GITHUB_REPO,
Wait = true,
}))
.Should()
.ThrowAsync<OctoshiftCliException>()
Expand All @@ -268,7 +266,6 @@ public async Task It_Falls_Back_To_Ado_And_Github_Pats_From_Environment_When_Not
AdoRepo = ADO_REPO,
GithubOrg = GITHUB_ORG,
GithubRepo = GITHUB_REPO,
Wait = true,
};

await _handler.Handle(args);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,14 @@ public void Should_Have_Options()
{
_command.Should().NotBeNull();
_command.Name.Should().Be("migrate-repo");
_command.Options.Count.Should().Be(12);
_command.Options.Count.Should().Be(11);

TestHelpers.VerifyCommandOption(_command.Options, "ado-org", true);
TestHelpers.VerifyCommandOption(_command.Options, "ado-team-project", true);
TestHelpers.VerifyCommandOption(_command.Options, "ado-repo", true);
TestHelpers.VerifyCommandOption(_command.Options, "github-org", true);
TestHelpers.VerifyCommandOption(_command.Options, "github-repo", true);
TestHelpers.VerifyCommandOption(_command.Options, "ado-server-url", false, true);
TestHelpers.VerifyCommandOption(_command.Options, "wait", false, true);
TestHelpers.VerifyCommandOption(_command.Options, "queue-only", false);
TestHelpers.VerifyCommandOption(_command.Options, "target-repo-visibility", false);
TestHelpers.VerifyCommandOption(_command.Options, "ado-pat", false);
Expand All @@ -62,7 +61,6 @@ public void It_Uses_Github_Pat_When_Provided()
AdoRepo = "some-repo",
GithubOrg = "gh-org",
GithubRepo = "gh-repo",
Wait = true,
AdoPat = adoPat,
GithubPat = githubPat,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,70 +344,6 @@ public void It_Throws_If_Archive_Url_Is_Provided_But_Github_Repo_Is_Not()
.WithMessage("*--github-repo*");
}

[Fact]
public void Validates_Wait_And_QueueOnly_Not_Passed_Together()
{
var args = new MigrateRepoCommandArgs
{
BbsProject = BBS_PROJECT,
BbsRepo = BBS_REPO,
BbsServerUrl = BBS_SERVER_URL,
BbsUsername = BBS_USERNAME,
BbsPassword = BBS_PASSWORD,
AzureStorageConnectionString = AZURE_STORAGE_CONNECTION_STRING,
GithubOrg = GITHUB_ORG,
GithubRepo = GITHUB_REPO,
Wait = true,
QueueOnly = true,
};

args.Invoking(x => x.Validate(_mockOctoLogger.Object))
.Should()
.ThrowExactly<OctoshiftCliException>()
.WithMessage("*wait*");
}

[Fact]
public void Wait_Flag_Shows_Warning()
{
var args = new MigrateRepoCommandArgs
{
BbsProject = BBS_PROJECT,
BbsRepo = BBS_REPO,
BbsServerUrl = BBS_SERVER_URL,
BbsUsername = BBS_USERNAME,
BbsPassword = BBS_PASSWORD,
AzureStorageConnectionString = AZURE_STORAGE_CONNECTION_STRING,
GithubOrg = GITHUB_ORG,
GithubRepo = GITHUB_REPO,
Wait = true,
};

args.Validate(_mockOctoLogger.Object);

_mockOctoLogger.Verify(x => x.LogWarning(It.Is<string>(x => x.ToLower().Contains("wait"))));
}

[Fact]
public void No_Wait_And_No_Queue_Only_Flags_Shows_Warning()
{
var args = new MigrateRepoCommandArgs
{
BbsProject = BBS_PROJECT,
BbsRepo = BBS_REPO,
BbsServerUrl = BBS_SERVER_URL,
BbsUsername = BBS_USERNAME,
BbsPassword = BBS_PASSWORD,
AzureStorageConnectionString = AZURE_STORAGE_CONNECTION_STRING,
GithubOrg = GITHUB_ORG,
GithubRepo = GITHUB_REPO,
};

args.Validate(_mockOctoLogger.Object);

_mockOctoLogger.Verify(x => x.LogWarning(It.Is<string>(x => x.ToLower().Contains("wait"))));
}

[Fact]
public void Invoke_With_Bbs_Server_Url_Throws_When_Both_Ssh_User_And_Smb_User_Are_Provided()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,6 @@ public async Task Throws_An_Error_If_Export_Fails()
BbsPassword = BBS_PASSWORD,
BbsProject = BBS_PROJECT,
BbsRepo = BBS_REPO,
Wait = true
};

// Assert
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void Should_Have_Options()
var command = new MigrateRepoCommand();
command.Should().NotBeNull();
command.Name.Should().Be("migrate-repo");
command.Options.Count.Should().Be(31);
command.Options.Count.Should().Be(30);

TestHelpers.VerifyCommandOption(command.Options, "bbs-server-url", true);
TestHelpers.VerifyCommandOption(command.Options, "bbs-project", true);
Expand All @@ -79,7 +79,6 @@ public void Should_Have_Options()
TestHelpers.VerifyCommandOption(command.Options, "smb-user", false);
TestHelpers.VerifyCommandOption(command.Options, "smb-password", false);
TestHelpers.VerifyCommandOption(command.Options, "smb-domain", false);
TestHelpers.VerifyCommandOption(command.Options, "wait", false, true);
TestHelpers.VerifyCommandOption(command.Options, "queue-only", false);
TestHelpers.VerifyCommandOption(command.Options, "target-repo-visibility", false);
TestHelpers.VerifyCommandOption(command.Options, "kerberos", false, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,67 +13,8 @@ public class MigrateOrgCommandArgsTests
private const string TARGET_ENTERPRISE = "foo-target-ent";
private const string SOURCE_ORG = "foo-source-org";
private const string TARGET_ORG = "foo-target-org";
private const string SOURCE_PAT = "foo-source-pat";
private const string TARGET_PAT = "foo-target-pat";

[Fact]
public void Validates_Wait_And_QueueOnly_Not_Passed_Together()
{
// Act
var args = new MigrateOrgCommandArgs
{
GithubSourceOrg = SOURCE_ORG,
GithubSourcePat = SOURCE_PAT,
GithubTargetOrg = TARGET_ORG,
GithubTargetEnterprise = TARGET_ENTERPRISE,
GithubTargetPat = TARGET_PAT,
Wait = true,
QueueOnly = true,
};

FluentActions.Invoking(() => args.Validate(_mockOctoLogger.Object))
.Should()
.ThrowExactly<OctoshiftCliException>()
.WithMessage("*wait*");
}

[Fact]
public void Wait_Flag_Shows_Warning()
{
var args = new MigrateOrgCommandArgs
{
GithubSourceOrg = SOURCE_ORG,
GithubSourcePat = SOURCE_PAT,
GithubTargetOrg = TARGET_ORG,
GithubTargetEnterprise = TARGET_ENTERPRISE,
GithubTargetPat = TARGET_PAT,
Wait = true,
};

args.Validate(_mockOctoLogger.Object);

_mockOctoLogger.Verify(x => x.LogWarning(It.Is<string>(x => x.ToLower().Contains("wait"))));
}

[Fact]
public void No_Wait_And_No_Queue_Only_Flags_Shows_Warning()
{
var args = new MigrateOrgCommandArgs
{
GithubSourceOrg = SOURCE_ORG,
GithubSourcePat = SOURCE_PAT,
GithubTargetOrg = TARGET_ORG,
GithubTargetEnterprise = TARGET_ENTERPRISE,
GithubTargetPat = TARGET_PAT,
Wait = false,
QueueOnly = false,
};

args.Validate(_mockOctoLogger.Object);

_mockOctoLogger.Verify(x => x.LogWarning(It.Is<string>(x => x.ToLower().Contains("wait"))));
}

[Fact]
public void Source_Pat_Defaults_To_Target_Pat()
{
Expand All @@ -83,7 +24,6 @@ public void Source_Pat_Defaults_To_Target_Pat()
GithubTargetOrg = TARGET_ORG,
GithubTargetEnterprise = TARGET_ENTERPRISE,
GithubTargetPat = TARGET_PAT,
Wait = true,
};

args.Validate(_mockOctoLogger.Object);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ public async Task Happy_Path()
GithubTargetOrg = TARGET_ORG,
GithubTargetEnterprise = TARGET_ENTERPRISE,
GithubTargetPat = TARGET_PAT,
Wait = true,
};
await _handler.Handle(args);

Expand Down Expand Up @@ -120,7 +119,6 @@ public async Task Happy_Path_PAT_In_Env()
GithubSourceOrg = SOURCE_ORG,
GithubTargetOrg = TARGET_ORG,
GithubTargetEnterprise = TARGET_ENTERPRISE,
Wait = true,
};
await _handler.Handle(args);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@ public void Should_Have_Options()
var command = new MigrateOrgCommand();
command.Should().NotBeNull();
command.Name.Should().Be("migrate-org");
command.Options.Count.Should().Be(8);
command.Options.Count.Should().Be(7);

TestHelpers.VerifyCommandOption(command.Options, "github-source-org", true);
TestHelpers.VerifyCommandOption(command.Options, "github-target-org", true);
TestHelpers.VerifyCommandOption(command.Options, "github-target-enterprise", true);
TestHelpers.VerifyCommandOption(command.Options, "wait", false, true);
TestHelpers.VerifyCommandOption(command.Options, "queue-only", false);
TestHelpers.VerifyCommandOption(command.Options, "github-source-pat", false);
TestHelpers.VerifyCommandOption(command.Options, "github-target-pat", false);
Expand Down
Loading
Loading