-
Notifications
You must be signed in to change notification settings - Fork 319
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
[#4890] improvement(IT): Add the Integration Tests for getFileLocation
interface
#4920
Changes from 4 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,6 +52,7 @@ | |
import org.apache.gravitino.lock.LockType; | ||
import org.apache.gravitino.lock.TreeLockUtils; | ||
import org.apache.gravitino.metrics.MetricNames; | ||
import org.apache.gravitino.rest.RESTUtils; | ||
import org.apache.gravitino.server.web.Utils; | ||
import org.apache.gravitino.utils.NameIdentifierUtil; | ||
import org.apache.gravitino.utils.NamespaceUtil; | ||
|
@@ -268,7 +269,7 @@ public Response getFileLocation( | |
catalog, | ||
schema, | ||
fileset, | ||
subPath); | ||
RESTUtils.decodeString(subPath)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you please add the test to cover the scenario that path should be encoded and decoded? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make the server-side encode/decode unit test more complete. In addition, the current integration test also covers the normal situation of encode/decode, otherwise the |
||
try { | ||
return Utils.doAs( | ||
httpRequest, | ||
|
@@ -283,7 +284,9 @@ public Response getFileLocation( | |
} | ||
String actualFileLocation = | ||
TreeLockUtils.doWithTreeLock( | ||
ident, LockType.READ, () -> dispatcher.getFileLocation(ident, subPath)); | ||
ident, | ||
LockType.READ, | ||
() -> dispatcher.getFileLocation(ident, RESTUtils.decodeString(subPath))); | ||
return Utils.ok(new FileLocationResponse(actualFileLocation)); | ||
}); | ||
} catch (Exception e) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see you verify the
CallerContext
in the server side, can you please add some tests about this?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a test case in the server-side unit test.