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
KNOX-1996: Adding changes to remove extra / while generating backedn … #142
Conversation
gateway-server/src/main/java/org/apache/knox/gateway/websockets/GatewayWebsocketHandler.java
Show resolved
Hide resolved
* | ||
* @since 0.10 | ||
*/ | ||
public class WebsocketEcho1Test { |
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.
Do we need a whole other test class here? Can't the new test case just be added to the existing WebsocketEchoTest?
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.
Please try add the test to existing class, testing WS is expensive.
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.
@moresandeep Need some help here on how this can be done. In the new test case class, all I have changed the backendServerUri to 'http' instead of 'ws' (line 198). This will generate service role with protocol as 'http'. How can I merge this with existing WebsocketEchoTest ? Service role definition are different 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.
@goelrajat I think at minimum should be a base test class and then specify the prefix to use for the tests in the actual test class? That would avoid copying all the tests. I didn't look too closely but might also be possible to do something similar with randomizing http vs ws. Or use JUnit parameterized test.
gateway-server/src/main/java/org/apache/knox/gateway/websockets/GatewayWebsocketHandler.java
Show resolved
Hide resolved
gateway-server/src/main/java/org/apache/knox/gateway/websockets/GatewayWebsocketHandler.java
Show resolved
Hide resolved
gateway-server/src/main/java/org/apache/knox/gateway/websockets/GatewayWebsocketHandler.java
Outdated
Show resolved
Hide resolved
gateway-server/src/main/java/org/apache/knox/gateway/websockets/GatewayWebsocketHandler.java
Show resolved
Hide resolved
gateway-server/src/main/java/org/apache/knox/gateway/websockets/GatewayWebsocketHandler.java
Outdated
Show resolved
Hide resolved
gateway-server/src/main/java/org/apache/knox/gateway/websockets/GatewayWebsocketHandler.java
Outdated
Show resolved
Hide resolved
gateway-server/src/main/java/org/apache/knox/gateway/websockets/GatewayWebsocketHandler.java
Outdated
Show resolved
Hide resolved
gateway-server/src/main/java/org/apache/knox/gateway/websockets/GatewayWebsocketHandler.java
Outdated
Show resolved
Hide resolved
* | ||
* @since 0.10 | ||
*/ | ||
public class WebsocketEcho1Test { |
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.
Please try add the test to existing class, testing WS is expensive.
Any update on whether this PR can be merged or something additional needs to be done. |
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.
Changes look a lot better - only thing that I think needs a second look is the duplicated test. Left a specific comment on that.
* | ||
* @since 0.10 | ||
*/ | ||
public class WebsocketEcho1Test { |
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.
@goelrajat I think at minimum should be a base test class and then specify the prefix to use for the tests in the actual test class? That would avoid copying all the tests. I didn't look too closely but might also be possible to do something similar with randomizing http vs ws. Or use JUnit parameterized test.
Thanks @risdenk for the comments. I have refactored the code with a Base test class. I had a quick look at how to implement Junit Parameterized test. In my case, I need to parameterize setting up of Gateway config role and starting of Gateway Server which would be done repeatedly for both the test cases so not much performance gain in terms of test case execution. Please check. |
2b15f84
to
cb8b8ef
Compare
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.
Looks good to me. @moresandeep any other thoughts?
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.
@goelrajat thank you for your patience and apologies for the delay. The changes look good, I am requesting couple of changes on the UnitTest, one of them is basically a test for the case where addition /
is getting added when the service does not end with /ws
Thanks again !
gateway-server/src/test/java/org/apache/knox/gateway/websockets/WebsocketEcho1Test.java
Outdated
Show resolved
Hide resolved
gateway-server/src/test/java/org/apache/knox/gateway/websockets/WebsocketEcho1Test.java
Outdated
Show resolved
Hide resolved
…url. Additionally, proxy messages to websocket even if service uri has http/https protocol
…cho and WebsocketEcho1 tests
… case for backedn url validation
1f7a433
to
5a96153
Compare
Test case changes have been done. Please check and merge. |
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.
Thanks for the quick turnaround. Looks like you are missing teardown() in one of the tests.
KNOX-1996: Adding changes to remove extra / while generating backend url. Additionally, proxy messages to websocket even if service uri has http/https protocol