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

8291226: Create Test Cases to cover scenarios for JDK-8278067 #9958

Closed
wants to merge 18 commits into from

Conversation

rgangadhar
Copy link
Member

@rgangadhar rgangadhar commented Aug 22, 2022

There are total 160 scenarios written with combination of client properties (Client Scenarios) and Server Response (Server Scenarios).

In tabular format, Client and Server scenarios along with expected output are documented here:Permalink

This Program Should be run mandatorily in othervm mode itself since it has system property changes so can't be clubbed with other scenarios. so each scenario should be run in individual JVM.

For each and every scenario, ServerSocket is created and waits for clients to connect to it.
isProxySet and serverReady are shared variables between server thread and client thread(main) and it should be set and reset to false for each and every scenario.

isProxySet and serverReady variables should be set by server thread before proceeding to client thread(main).

if isProxySet variable is set to true then client set the proxy value to url.openConnection(Proxy)

if (isProxySet) {
httpUrlConnection = (sun.net.www.protocol.http.HttpURLConnection) url .openConnection(new Proxy(Type.HTTP, new InetSocketAddress("localhost", SERVER_PORT))); }
else {
httpUrlConnection = (sun.net.www.protocol.http.HttpURLConnection) url.openConnection();
}

Program tries to fetch the Value of <Key, Value> Pairs of HashMap KeepAliveCache where Key is KeepAliveKey and Value is ClientVector KeepAliveTimeout is stored in Value ClientVector of HashMap KeepAliveCache.

if connection is cached then KeepAliveTimeout is stored in ClientVector. KeepAliveTimeout stored in Value(ClientVector) of HashMap KeepAliveCache is compared with Expected Value.

if connection is not cached then connection is terminated immediately.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8291226: Create Test Cases to cover scenarios for JDK-8278067

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/9958/head:pull/9958
$ git checkout pull/9958

Update a local copy of the PR:
$ git checkout pull/9958
$ git pull https://git.openjdk.org/jdk pull/9958/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 9958

View PR using the GUI difftool:
$ git pr show -t 9958

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/9958.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Aug 22, 2022

👋 Welcome back rgangadhar! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the rfr Pull request is ready for review label Aug 22, 2022
@openjdk
Copy link

openjdk bot commented Aug 22, 2022

@rgangadhar The following label will be automatically applied to this pull request:

  • net

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the net net-dev@openjdk.org label Aug 22, 2022
@rgangadhar
Copy link
Member Author

Hi Michael, Daniel, JaiKiran Pai

@Michael-Mc-Mahon
@jaikiran
@dfuch

Could you please review this changeset ?

@mlbridge
Copy link

mlbridge bot commented Aug 22, 2022

@dfuch
Copy link
Member

dfuch commented Aug 22, 2022

Hi Ramesh, thanks for taking this one on. Would it be possible to first improve formatting a bit more, to make this easier to review? For instance - indentation in java code overall the whole oprnjdk code base is 4 spaces, not 2. Also it might be more concise to use List & loops to construct the various arrays, rather than copy/pasting the same line over and over (more specifically things line the serverScenarios and clientScenarios arrays look like they could be initialized with one or two imbricated loops). This might also give you the opportunity to add a bit more comments to explain what each loop/line represents.

I also wonder about representing things as strings that get parsed and split later on. Wouldn't using structure records make it easier to understand?

Also I wonder if having 150 @run lines will scale. It might be better to split this one big tests into several smaller one.

Copy link
Member

@dfuch dfuch left a comment

Choose a reason for hiding this comment

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

This file is a java file and should have a .java extension.

1. Increased space from 2 to 4.
2. skipped test scenarios from 113 to 128 && 145 to 160
@rgangadhar
Copy link
Member Author

This file is a java file and should have a .java extension.

My Bad . Yes thank you @dfuch . done this change

@rgangadhar
Copy link
Member Author

Hi Ramesh, thanks for taking this one on. Would it be possible to first improve formatting a bit more, to make this easier to review? For instance - indentation in java code overall the whole oprnjdk code base is 4 spaces, not 2.

This is done @dfuch thanks @dfuch

test/jdk/sun/net/www/http/HttpClient/KeepAliveTest.java Outdated Show resolved Hide resolved
test/jdk/sun/net/www/http/HttpClient/KeepAliveTest.java Outdated Show resolved Hide resolved
test/jdk/sun/net/www/http/HttpClient/KeepAliveTest.java Outdated Show resolved Hide resolved
test/jdk/sun/net/www/http/HttpClient/KeepAliveTest.java Outdated Show resolved Hide resolved
test/jdk/sun/net/www/http/HttpClient/KeepAliveTest.java Outdated Show resolved Hide resolved
test/jdk/sun/net/www/http/HttpClient/KeepAliveTest.java Outdated Show resolved Hide resolved
test/jdk/sun/net/www/http/HttpClient/KeepAliveTest.java Outdated Show resolved Hide resolved
test/jdk/sun/net/www/http/HttpClient/KeepAliveTest.java Outdated Show resolved Hide resolved
test/jdk/sun/net/www/http/HttpClient/KeepAliveTest.java Outdated Show resolved Hide resolved
test/jdk/sun/net/www/http/HttpClient/KeepAliveTest.java Outdated Show resolved Hide resolved
Renamed Methods like startScenario, runClient, startServer, connectToServerURL
added final to constants
Changed clientScenarios array
Changed serverScenarios array
added IllegalArgumentException
Replaced TIMEOUT with CountDownLatch
Added Comments
@openjdk openjdk bot removed the rfr Pull request is ready for review label Aug 22, 2022
Removed White Spaces
@openjdk openjdk bot added the rfr Pull request is ready for review label Aug 22, 2022
@rgangadhar
Copy link
Member Author

Also it might be more concise to use List & loops to construct the various arrays, rather than copy/pasting the same line over and over (more specifically things line the serverScenarios and clientScenarios arrays look like they could be initialized with one or two imbricated loops).

avoided repetation of serverScenarios and clientScenarios array @dfuch thanks

@rgangadhar
Copy link
Member Author

Also I wonder if having 150 @run lines will scale. It might be better to split this one big tests into several smaller one.

@dfuch : does it really required if we split scenarios into various test files ? how does it affect running ? could you pls explain.

Added scenarios documentation and removed white spaces
@openjdk openjdk bot removed the rfr Pull request is ready for review label Aug 26, 2022
Removed Whitespaces
@openjdk openjdk bot added the rfr Pull request is ready for review label Sep 19, 2022
@rgangadhar
Copy link
Member Author

@dfuch @Michael-Mc-Mahon : could you pls check latest changeset once ?

@rgangadhar rgangadhar requested review from Michael-Mc-Mahon and dfuch and removed request for Michael-Mc-Mahon and dfuch October 11, 2022 05:42
Copy link
Member

@dfuch dfuch left a comment

Choose a reason for hiding this comment

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

Overall I believe this is OK to integrate. I will run some tests before approving. Please obtain Michael's approval too before integrating.

Copy link
Member

@Michael-Mc-Mahon Michael-Mc-Mahon left a comment

Choose a reason for hiding this comment

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

This looks fine. I'll publish a PR soon to address JDK-8291638 which means I'll re-enable the disabled tests here.

@openjdk
Copy link

openjdk bot commented Oct 11, 2022

@rgangadhar This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8291226: Create Test Cases to cover scenarios for JDK-8278067

Reviewed-by: dfuchs, michaelm

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 603 new commits pushed to the master branch:

  • bdb4ed0: 8294580: frame::interpreter_frame_print_on() crashes if free BasicObjectLock exists in frame
  • 461d903: 8294841: G1: Refactor predict_base_elapsed_time_ms
  • 392f35d: 8295033: hsdis configure error when cross-compiling with --with-binutils-src
  • 16e0c59: 8294950: print_sys_devices_cpu_info doesn't use the provided buffer
  • 5ad126f: 8295012: Arena should not derive from CHeapObj
  • ab8c136: 8292898: [vectorapi] Unify vector mask cast operation
  • 2ceb80c: 8288043: Optimize FP to word/sub-word integral type conversion on X86 AVX2 platforms
  • 703a6ef: 8283699: Improve the peephole mechanism of hotspot
  • 94a9b04: 8295013: OopStorage should derive from CHeapObjBase
  • 3a980b9: 8295168: Remove superfluous period in @throws tag description
  • ... and 593 more: https://git.openjdk.org/jdk/compare/a85a72341bd840b2c7b66ce32c8bbca920e519c8...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@dfuch, @Michael-Mc-Mahon) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Oct 11, 2022
@dfuch
Copy link
Member

dfuch commented Oct 12, 2022

My tests have all come back green so this good to go! If you need a sponsor then please drop a note here after integrating.

@rgangadhar
Copy link
Member Author

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Oct 12, 2022
@openjdk
Copy link

openjdk bot commented Oct 12, 2022

@rgangadhar
Your change (at version a51a82f) is now ready to be sponsored by a Committer.

@rgangadhar
Copy link
Member Author

@dfuch : could you pls sponsor this integration ?

@Michael-Mc-Mahon
Copy link
Member

/sponsor

@openjdk
Copy link

openjdk bot commented Oct 12, 2022

Going to push as commit 86ec158.
Since your change was applied there have been 604 commits pushed to the master branch:

  • 94ec729: 8263044: jdk/jfr/jvm/TestDumpOnCrash.java timed out
  • bdb4ed0: 8294580: frame::interpreter_frame_print_on() crashes if free BasicObjectLock exists in frame
  • 461d903: 8294841: G1: Refactor predict_base_elapsed_time_ms
  • 392f35d: 8295033: hsdis configure error when cross-compiling with --with-binutils-src
  • 16e0c59: 8294950: print_sys_devices_cpu_info doesn't use the provided buffer
  • 5ad126f: 8295012: Arena should not derive from CHeapObj
  • ab8c136: 8292898: [vectorapi] Unify vector mask cast operation
  • 2ceb80c: 8288043: Optimize FP to word/sub-word integral type conversion on X86 AVX2 platforms
  • 703a6ef: 8283699: Improve the peephole mechanism of hotspot
  • 94a9b04: 8295013: OopStorage should derive from CHeapObjBase
  • ... and 594 more: https://git.openjdk.org/jdk/compare/a85a72341bd840b2c7b66ce32c8bbca920e519c8...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Oct 12, 2022
@openjdk openjdk bot closed this Oct 12, 2022
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review sponsor Pull request is ready to be sponsored labels Oct 12, 2022
@openjdk
Copy link

openjdk bot commented Oct 12, 2022

@Michael-Mc-Mahon @rgangadhar Pushed as commit 86ec158.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrated Pull request has been integrated net net-dev@openjdk.org
Development

Successfully merging this pull request may close these issues.

3 participants