[ZEPPELIN-6484] Deduplicate IdHashes and add unit tests - #5379
Open
big-cir wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is this PR for?
IdHashesexisted twice with identical behaviour —org.apache.zeppelin.utilinzeppelin-interpreterandorg.apache.zeppelin.notebook.utilityinzeppelin-server— and neither copy had any tests.The ticket left the scope open between "tests only" and "dedupe plus tests". This PR takes the dedupe path:
notebook.utilityheld nothing but that one file, andNote.javawas the only thing importing it, so removing it is a file deletion and an import switch. Splitting that into a second ticket would cost more than it saves.org.apache.zeppelin.util.IdHashesis kept as the canonical copy, matching the module dependency direction —zeppelin-serveralready depends onzeppelin-interpreter, not the other way round.The new
IdHashesTestpins whatgenerateId()guarantees: the character set (digits 1-9 and A-Z without I, L and O, left out so IDs stay unambiguous when read by a person), non-emptiness, and uniqueness.encode()is private, so all three go throughgenerateId(). The expected character set is spelled out in the test rather than read back fromIdHashes, so a change to the dictionary shows up as a failure instead of being silently followed.Note IDs are unaffected:
IdHashesonly mints IDs and never parses them, and the two copies produced identical output, so existing notes keep reading their stored IDs as before.What type of PR is it?
Improvement
Todos
IdHashesTestagainst the canonicalorg.apache.zeppelin.util.IdHasheszeppelin-servernotebook.utilitycopy and switchNote.javato the canonical importzeppelin-serverstill buildsWhat is the Jira issue?
How should this be tested?
New tests:
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0Dedupe, per the ticket's verification note — rebuild the shaded chain, then build
zeppelin-server:Both succeed.
NoteTest(8 tests) covers the switched import directly, since theNoteconstructor is what callsIdHashes.generateId();InterpreterSettingTest(12 tests) covers the canonical copy's other caller.apache-ratreports no unapproved licenses.Screenshots (if appropriate)
N/A
Questions: