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

Fix #525 FlushBufferTest #680

Merged
merged 2 commits into from
Aug 1, 2024

Conversation

gregw
Copy link
Contributor

@gregw gregw commented Jul 16, 2024

Replace the disputed test (that tests poorly defined behaviour of a bad servlet) with two tests that check the accepted behaviour of a well written servlet.

Once there is an accepted interpretation of the behaviour for the bad servlet, additional tests can be added to check that.

Replace the disputed test (that tests poorly defined behaviour of a bad servlet) with two tests that check the accepted behaviour of a well written servlet.

Once there is an accepted interpretation of the behaviour for the bad servlet, additional tests can be added to check that.
@gregw gregw linked an issue Jul 16, 2024 that may be closed by this pull request
@gregw gregw marked this pull request as ready for review July 17, 2024 06:06

try {
out.write(fill);
throw new IllegalStateException("write did not fail");
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this sufficient to trigger a test failure?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It should be as the requirement is that the proceeding write closes the output stream. Wiring to a closed output stream should be an exception regardless of buffering.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could add an out.flush if you are really concerned, but I don't see it as necessary

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, should have been clearer. I'm not doubting the exception will be thrown. My question is whether the client will see any effects of the exception which will in turn triggered a test failure. Or to put it another way, will the client see the completed response and think all is well regardless of whether the exception is thrown on the server.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In this test, the write a line 59 will complete the response and close the stream. The client will see that response as a 200. The subsequent write will throw an exception.... ah I see the problem, the client will not see the exception either way. Let me ponder a better approach.... hard in this test environment as everything is sent via the response.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@olamy Can you test the latest version please

Copy link
Contributor

Choose a reason for hiding this comment

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

@gregw all good with jetty 12.1.x

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@markt-asf How's this version? It does every test request twice with any bad behaviour after response completion of the first request stored in the session to be seen by the second request.

Copy link
Contributor

Choose a reason for hiding this comment

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

Neat solution. LGTM.

Replace the disputed test (that tests poorly defined behaviour of a bad servlet) with two tests that check the accepted behaviour of a well written servlet.

Once there is an accepted interpretation of the behaviour for the bad servlet, additional tests can be added to check that.
@gregw
Copy link
Contributor Author

gregw commented Jul 22, 2024

OK for me to merge this? I've no idea what release it will end up in... but happy enough it will end up in some release some time.

@olamy
Copy link
Contributor

olamy commented Jul 23, 2024

@gregw, go for it. I can then cherry-pick the 6.1.x branch to be used for a release.

@olamy olamy merged commit 64e0cee into jakartaee:master Aug 1, 2024
2 checks passed
olamy pushed a commit that referenced this pull request Aug 1, 2024
* Fix #525 FlushBufferTest

Replace the disputed test (that tests poorly defined behaviour of a bad servlet) with two tests that check the accepted behaviour of a well written servlet.

Once there is an accepted interpretation of the behaviour for the bad servlet, additional tests can be added to check that.
@olamy olamy deleted the fix-525-flushBufferTest branch August 1, 2024 10:30
pmd1nh added a commit that referenced this pull request Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[TCK Challenge] attempting to writing more than content-length bytes
3 participants