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

[#6136] refactor: move check for enable and disable within validate (CLI) #6163

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

VigneshSK17
Copy link
Contributor

What changes were proposed in this pull request?

The check for enable and disable was within GravitinoCommandLine.java, not inside the validate() logic as it should be.

Why are the changes needed?

To keep consistency within the codebase and making sure the validate() method for a command is being used effectively

Fix: #6136

Does this PR introduce any user-facing change?

No

How was this patch tested?

Updated tests and ran local test suite successfully.

@VigneshSK17
Copy link
Contributor Author

@justinmclean Is this what you envisioned when creating the issue? I was a bit confused by the wording.

@VigneshSK17
Copy link
Contributor Author

Had to modify to support the newly-refactored commands, but now should be ready for review @justinmclean

@VigneshSK17
Copy link
Contributor Author

@justinmclean Sorry for pinging you a lot but do things look good now?

@justinmclean
Copy link
Member

Sorry for the conflicting files again, let me sort this out for you.

@justinmclean justinmclean changed the title [#6136] refactor: move check for enable and disable within validate [#6136] refactor: move check for enable and disable within validate (CLI) Jan 14, 2025
@VigneshSK17
Copy link
Contributor Author

No worries, it was a fairly quick fix on my end and shouldn't be a problem anymore given it seems like the refactoring that affects my files directly is done.

false)
.validate());
String errOutput = new String(errContent.toByteArray(), StandardCharsets.UTF_8).trim();
Assertions.assertEquals(ErrorMessages.INVALID_ENABLE_DISABLE, errOutput);
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 sure why you have changed this test in this way. Can you explain the changes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My understanding is that I should detect if there's a RuntimeException when trying to enable and disable a catalog at the same time and then check if the error message is INVALID_ENABLE_DISABLE.

Is there an alternative to simplify this test or is am I misunderstanding the intent of these tests?

Copy link
Member

Choose a reason for hiding this comment

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

So why change existing working tests that are needed? Did you mean to add a new test instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh I see what you mean.

The reason why is because to check if both flags are true, I pass the disable flag's result into EnableCatalogCommand as a required parameter.

Is this the proper standard or not? Apologies for dragging this on for so long.

GravitinoCommandLine.DEFAULT_URL, false, "metalake_demo", true, false)
.validate());
String errOutput = new String(errContent.toByteArray(), StandardCharsets.UTF_8).trim();
Assertions.assertEquals(ErrorMessages.INVALID_ENABLE_DISABLE, errOutput);
Copy link
Member

Choose a reason for hiding this comment

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

Same here, I'm not sure these changes are required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Improvement] Move check for enable and disable command in Gravitino CLI to command
2 participants