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

Add tests for error page mappings #324

Merged
merged 7 commits into from
Dec 18, 2024
Merged

Add tests for error page mappings #324

merged 7 commits into from
Dec 18, 2024

Conversation

srinjoyray
Copy link
Contributor

Issue - 318

Copy link

@code-review-assist code-review-assist bot left a comment

Choose a reason for hiding this comment

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

Hi @srinjoyray and reviewers,

Gemini is currently reviewing this pull request and will post a full review in a few minutes. In the meantime, here's a quick summary to help everyone get up to speed:

This pull request adds tests for error page mappings. The intent is to improve the robustness and reliability of error handling within the App Engine Java Standard environment. The changes involve the creation of new test files (SendErrorTest.java) and several supporting files containing HTML pages for error responses (404, 500, and unhandled errors) and a servlet to trigger error conditions. The tests cover various scenarios and runtime environments (Jetty 9.4, EE8, EE10) with both HTTP and HTTPS modes. The appengine-web.xml and web.xml files in the testapps directory have been updated to configure the error page mappings for each environment.

All in all, this PR looks to be a solid addition to the test suite, enhancing the overall quality of the App Engine Java Standard environment. I'll provide a more detailed review shortly.

And now, a little haiku to lighten the mood:

Tests run, green light shows,
Errors caught, the code is strong,
Happy users smile.

Thanks,
Gemini

Copy link

@code-review-assist code-review-assist bot left a comment

Choose a reason for hiding this comment

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

This pull request adds tests for error page mappings. It's a good practice to have tests for this functionality to ensure that errors are handled gracefully and users see informative messages. The parameterized tests effectively cover different runtime environments and HTTP modes.

Copy link
Collaborator

@ludoch ludoch left a comment

Choose a reason for hiding this comment

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

Copy link
Collaborator

@lachlan-roberts lachlan-roberts left a comment

Choose a reason for hiding this comment

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

I think Gemini covered a lot of good points which need to be addressed.

Some additional points.

  • You are missing a lot of license headers on various files.
  • You have senderroree10.WEB-INF as a directory name which will not work.
  • Some of the files end with a single space, which will prevent them from being recognized.

The directory tree should look something like this

├── java
│ └── com
│     └── google
│         └── apphosting
│             └── runtime
│                 └── jetty9
│                     └── senderrorapp
│                       ├── SendErrorServletEE10.java
│                       └── SendErrorServletEE8.java
│                    
└── resources
    └── com
        └── google
            └── apphosting
                └── runtime
                    └── jetty9
                        └── senderrorapp
                          ├── ee10
                          │ ├── 404.html
                          │ ├── 500.html
                          │ ├── hello.html
                          │ ├── unhandled-error.html
                          │ └── WEB-INF
                          │     ├── appengine-web.xml
                          │     └── web.xml
                          ├── ee8
                          │ ├── 404.html
                          │ ├── 500.html
                          │ ├── hello.html
                          │ ├── unhandled-error.html
                          │ └── WEB-INF
                          │     ├── appengine-web.xml
                          │     └── web.xml
                          └── jetty94
                              ├── 404.html
                              ├── 500.html
                              ├── hello.html
                              ├── unhandled-error.html
                              └── WEB-INF
                                  ├── appengine-web.xml
                                  └── web.xml

Then in SendErrorTest.java you can reference it in the start() method with

String app = "com/google/apphosting/runtime/jetty9/senderrorapp/" + environment;

@srinjoyray srinjoyray changed the title [Draft] Add tests for error page mappings Add tests for error page mappings Dec 17, 2024
Copy link
Collaborator

@ludoch ludoch left a comment

Choose a reason for hiding this comment

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

Let's see now the extra checks in critique.

Copy link
Collaborator

@ludoch ludoch left a comment

Choose a reason for hiding this comment

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

Still 1 review to resolve to trigger google processes.

Copy link
Collaborator

@lachlan-roberts lachlan-roberts left a comment

Choose a reason for hiding this comment

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

Looks good! Just a few minor changes suggested.

@copybara-service copybara-service bot merged commit 3ad247f into main Dec 18, 2024
10 checks passed
@copybara-service copybara-service bot deleted the error-page-test branch December 18, 2024 16:19
Comment on lines +19 to +24
<runtime>java21</runtime>
<application>senderror</application>
<version>1</version>
<system-properties>
<property name="appengine.use.EE8" value="false"/>
<property name="appengine.use.EE10" value="false"/>
Copy link
Collaborator

@maigovannon maigovannon Dec 19, 2024

Choose a reason for hiding this comment

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

@lachlan-roberts @ludoch Curious: is this a combination which exists now? i.e. Java21 and Jetty9.4? I thought we default to using Jetty 12 (either EE8 or EE10) for Java21 customers:

if (!settingDoneInAppEngineWebXml && (runtimeId != null)) {
switch (runtimeId) {
case "java21": // Force default to EE10.
System.clearProperty("appengine.use.EE8");
System.setProperty("appengine.use.EE10", "true");

Copy link
Collaborator

Choose a reason for hiding this comment

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

@maigovannon this is a combination which exists currently, but they must specifically configure these flags to use Jetty 9.4 on the Java 21 runtime. I believe it defaults to EE10 if none are set.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants