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

APP-7007: implement DisableAuthService CLI command #4686

Merged
merged 15 commits into from
Jan 9, 2025

Conversation

gloriacai01
Copy link
Member

@gloriacai01 gloriacai01 commented Jan 7, 2025

Ticket:
Screenshot 2025-01-07 at 2 31 14 PM
Manual testing:
abort option
Screenshot 2025-01-08 at 1 30 34 PM
disable option (didn't have an org with auth service enabled yet, but the rpc response is expected)
Screenshot 2025-01-08 at 6 06 38 PM

@viambot viambot added the safe to test This pull request is marked safe to test from a trusted zone label Jan 7, 2025
@gloriacai01 gloriacai01 marked this pull request as ready for review January 7, 2025 17:07
@gloriacai01 gloriacai01 requested a review from a team as a code owner January 7, 2025 17:07
cli/client.go Outdated Show resolved Hide resolved
cli/client.go Outdated Show resolved Hide resolved
printf(c.App.Writer, yellow, fmt.Sprintf("You are trying to disable auth service for organization ID %s. "+
"Once disabled, this will remove and permanently delete all white-labeled login flows for any applications "+
"associated with your organization ID\n", args.OrgID))
printf(c.App.Writer, yellow, "If you wish to continue, please type \"disable\":")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Great

cli/client.go Outdated Show resolved Hide resolved
cli/client.go Outdated Show resolved Hide resolved
@@ -371,6 +371,25 @@ func TestEnableAuthServiceAction(t *testing.T) {
test.That(t, out.messages[0], test.ShouldContainSubstring, "enabled auth")
}

func TestDisableAuthServiceAction(t *testing.T) {
disableAuthServiceFunc := func(ctx context.Context, in *apppb.DisableAuthServiceRequest, opts ...grpc.CallOption) (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any way to validate

  1. the empty org ID
  2. the valid org ID followed by an abort
  3. the valid org ID followed by a DISABLE

? If not easy lmk - but would hope to assert that stuff in code in addition to our manual tests

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i dont know if there is an easy way to cases 2 and 3 here, @purplenicole730 do u know how i could test this? but i did add a test case for the empty org ID case

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not too sure, since I'm not too familiar with the Before capability (which I'm assuming is what DISABLE is from). My best guess is to see how the other functions that have Before capabilities are tested.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you can't figure it out after searching on the internet/our code, then at least include this test in the description so that we know you manually tested it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't find any existing tests for the Before action , but I added my manual testing in the description!

},
},
{
Name: "auth-service",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this deleting the existing "auth-service"? Ideally wouldn't remove here - we have a separate ticket in the epic for unwinding / removing the existing stuff.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. Otherwise, this becomes a breaking change

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, this was a mistake i made when merging the enable auth service ticket earlier, i accidentally ended up having 2 "auth-service" subcommands (from this epic), so im fixing this and putting it in the right spot here. the existing "auth-service" stuff is still in this file.

Copy link
Member

@maxhorowitz maxhorowitz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly nits (sorry!) - one Q about testing coverage - and one Q about removal of auth-service

@purplenicole730
Copy link
Member

purplenicole730 commented Jan 7, 2025

Mostly nits (sorry!) - one Q about testing coverage - and one Q about removal of auth-service

@maxhorowitz If you don't mind, can you add all these comments into one review so that it's easier to follow, and it doesn't spam others' emails 😅 ?

gloriacai01 and others added 2 commits January 7, 2025 12:44
Co-authored-by: Max Horowitz <[email protected]>
Co-authored-by: Max Horowitz <[email protected]>
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Jan 7, 2025
},
},
{
Name: "auth-service",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. Otherwise, this becomes a breaking change

cli/client.go Outdated
Comment on lines 207 to 208
"Once disabled, all custom auth views and emails will be removed from your organization's (%s) " + "
"OAuth applications and permanently deleted.\n", args.OrgID))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The image in the PR description doesn't seem to match this text. Please update. I'd like to see it since I'm not sure what the second %s value is.

@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Jan 7, 2025
gloriacai01 and others added 2 commits January 7, 2025 14:17
Co-authored-by: Max Horowitz <[email protected]>
Co-authored-by: Max Horowitz <[email protected]>
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Jan 7, 2025
Co-authored-by: Max Horowitz <[email protected]>
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Jan 7, 2025
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Jan 7, 2025
cli/app.go Outdated
{
Name: "disable",
Usage: "disable auth-service for OAuth applications",
UsageText: createUsageText("disable", []string{generalFlagOrgID}, true),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just realized, why is otheroptions marked as true? The only option is the required one, so this should be set to false.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch

Copy link
Member

@maxhorowitz maxhorowitz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action items before merge:

  1. Address Nicole's comment about otheroptions
  2. Add comment describing manual test if not unit testable

Otherwise, great work!

cli/app.go Outdated
{
Name: "disable",
Usage: "disable auth-service for OAuth applications",
UsageText: createUsageText("disable", []string{generalFlagOrgID}, true),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch

@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Jan 8, 2025
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Jan 8, 2025
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Jan 8, 2025
@gloriacai01 gloriacai01 merged commit 38c8eb0 into viamrobotics:main Jan 9, 2025
16 checks passed
@gloriacai01 gloriacai01 deleted the app-7007 branch January 9, 2025 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
safe to test This pull request is marked safe to test from a trusted zone
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants