-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
HIVE-28194: Regenerate HS2 thrift port in TestRetryingThriftCLIServiceClient #5205
base: master
Are you sure you want to change the base?
Conversation
service/src/test/org/apache/hive/service/cli/TestRetryingThriftCLIServiceClient.java
Outdated
Show resolved
Hide resolved
service/src/test/org/apache/hive/service/cli/TestRetryingThriftCLIServiceClient.java
Outdated
Show resolved
Hide resolved
private static String metastorePasswd = "61ecbc41cdae3e6b32712a06c73606fa"; //random md5 | ||
private static Integer webUIPort = null; | ||
private static String apiBaseURL = null; | ||
|
||
|
||
@BeforeClass | ||
public static void beforeTests() throws Exception { | ||
webUIPort = MetaStoreTestUtils.findFreePortExcepting( | ||
ThriftCLITestUtils.setUpBeforeClass(); |
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.
why do you need to call this explicitly, it has @BeforeClass annotation?
|
||
@BeforeClass | ||
public static void setUpBeforeClass() throws Exception{ | ||
ThriftCLITestUtils.setUpBeforeClass(); |
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.
why to override it? it's same as parent
@@ -78,7 +78,7 @@ | |||
* classes instead of jdbc. | |||
*/ | |||
|
|||
public class TestThriftHttpCLIServiceFeatures { | |||
public class TestThriftHttpCLIServiceFeatures extends ThriftCLITestUtils { |
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.
nit: space
@@ -138,16 +138,15 @@ public boolean hasCookieHeader() { | |||
@BeforeClass | |||
public static void setUpBeforeClass() throws Exception { | |||
// Set up the base class | |||
ThriftCLIServiceTest.setUpBeforeClass(); | |||
ThriftCLITestUtils.setUpBeforeClass(); |
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.
doesn't parent method gets invoked before that?
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.
For this particular class, we will have to do an explicit call to initialise hs2, and other members as the current setUpBeforeClass() method overrides it's parent method.
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.
it's static, it can't override the parent.
why do you annotate @BeforeClass setUpBeforeClass
in ThriftCLITestUtils
then? Maybe you should remove this and don't extend from ThriftCLITestUtils
class, use it as Util
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.
see how the same is done in ITestDbTxnManager
.setupDb that extends DbTxnManagerEndToEndTestBase
port = MetaStoreTestUtils.findFreePort(); | ||
hiveServer2 = new HiveServer2(); | ||
hiveConf = new HiveConf(); | ||
ThriftCLITestUtils.setUpBeforeClass(); |
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.
same thing, why to override?
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.
in general LGTM, some questions on parent setUpBeforeClass() usage. I would expect next order:
- ThriftCLIServiceTest.setUpBeforeClass()
- Test Class .setUpBeforeClass()
no need for explicit calls
if (!hs2Started) { | ||
throw (hs2Exception); | ||
} | ||
startHiveServer2WithConf(hiveConf); |
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.
are we starting 2 HS2s here? one in base class setup and 1 here?
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.
We are initialising hs2, port, and hiveconf in base class. hs2 is started only in testclasses. Hence it is not started twice
|
||
import org.junit.BeforeClass; | ||
|
||
public abstract class ThriftCLITestUtils { |
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 am not sure if we should extend from it or just use it as Utils class
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 have made the setup base class as static. Keeping this class as abstract as ThriftCLIServiceTest class followed by other test classes inherit the variables declared here. And the code was getting pretty cluttered on doing so.
I have also removed the explicit calls of member variables.
hiveConf = new HiveConf(); | ||
} | ||
|
||
protected static void startHiveServer2WithConf(HiveConf hiveConf) throws Exception { |
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.
what is that 'protected static'? you can't override static methods
Quality Gate passedIssues Measures |
@deniskuzZ I have made the required changes, I hope you could review the PR when possible! |
What changes were proposed in this pull request?
Hive thrift port was hardcoded to 15000, hence port regeneration code was added here
Why are the changes needed?
Testcase can fail if the port is occupied by another test in testsplit pipeline
Does this PR introduce any user-facing change?
No
Is the change a dependency upgrade?
No
How was this patch tested?
Local machine