-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Improve and test jetty.sh
behaviors
#10753
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
45d37c4
Issue #10696 - Addressing start-stop-daemon behaviors in jetty.sh
joakime fb97bd9
Issue #10696 - Restoring pid in jetty.conf
joakime ca08242
Issue #10696 - disable internal pid-file management of start-stop-daemon
joakime 17c8b4d
Issue #10696 - Do not test for file system permissions if user is roo…
joakime 1c87984
Issue #10696 - Fixing bad UID / JETTY_USER condition
joakime 4e1316b
Issue #10696 - Avoid FS test with setuid use as well
joakime 60e3d0b
Issue #10696 - Correcting JETTY_USER test
joakime 7a203cd
Issue #10696 - Fixing stop behavior
joakime 2dc878c
WIP for jetty.sh docker testing
joakime a2c7348
make this working :)
olamy 0c0a3c2
WIP for jetty.sh docker testing
joakime 0f704b9
WIP for jetty.sh docker testing
joakime 707e703
Working jetty.sh docker testing
joakime f60b9ac
Cleanup test implementation
joakime 8be8ff5
Correct javadoc
joakime 270728c
Cleaner testing
joakime 10d5dad
Adding AmazonCorretto OS testing
joakime c8424bd
Better descriptions of OS purposes
joakime 2357c88
Adding `jetty.sh stop` testing
joakime 8a15525
Updates per review
joakime File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
...distribution/src/test/java/org/eclipse/jetty/tests/distribution/jettysh/ImageFromDSL.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// | ||
// ======================================================================== | ||
// Copyright (c) 1995 Mort Bay Consulting Pty Ltd and others. | ||
// | ||
// This program and the accompanying materials are made available under the | ||
// terms of the Eclipse Public License v. 2.0 which is available at | ||
// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 | ||
// which is available at https://www.apache.org/licenses/LICENSE-2.0. | ||
// | ||
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 | ||
// ======================================================================== | ||
// | ||
|
||
package org.eclipse.jetty.tests.distribution.jettysh; | ||
|
||
import java.util.function.Consumer; | ||
|
||
import org.testcontainers.images.builder.ImageFromDockerfile; | ||
import org.testcontainers.images.builder.dockerfile.DockerfileBuilder; | ||
|
||
/** | ||
* Simplify the use of {@link ImageFromDockerfile} to get some sanity in naming convention | ||
* and {@link #toString()} behaviors so that Test execution makes sense. | ||
*/ | ||
public class ImageFromDSL extends ImageFromDockerfile | ||
{ | ||
private ImageFromDSL parentImage; | ||
|
||
public ImageFromDSL(ImageFromDSL baseImage, String suffix, Consumer<DockerfileBuilder> builderConsumer) | ||
{ | ||
this(baseImage.getDockerImageName() + "-" + suffix, builderConsumer); | ||
this.parentImage = baseImage; | ||
} | ||
|
||
public ImageFromDSL(String name, Consumer<DockerfileBuilder> builderConsumer) | ||
{ | ||
super(name, false); | ||
withDockerfileFromBuilder(builderConsumer); | ||
} | ||
|
||
public ImageFromDSL getParentImage() | ||
{ | ||
return parentImage; | ||
} | ||
|
||
@Override | ||
public String toString() | ||
{ | ||
return getDockerImageName(); | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
...test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/jettysh/ImageOS.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// | ||
// ======================================================================== | ||
// Copyright (c) 1995 Mort Bay Consulting Pty Ltd and others. | ||
// | ||
// This program and the accompanying materials are made available under the | ||
// terms of the Eclipse Public License v. 2.0 which is available at | ||
// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 | ||
// which is available at https://www.apache.org/licenses/LICENSE-2.0. | ||
// | ||
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 | ||
// ======================================================================== | ||
// | ||
|
||
package org.eclipse.jetty.tests.distribution.jettysh; | ||
|
||
import java.io.File; | ||
import java.nio.file.Path; | ||
import java.util.function.Consumer; | ||
|
||
import org.eclipse.jetty.tests.hometester.JettyHomeTester; | ||
import org.testcontainers.images.builder.dockerfile.DockerfileBuilder; | ||
|
||
public abstract class ImageOS extends ImageFromDSL | ||
{ | ||
public static final String REGISTRY = "registry.jetty.org"; | ||
public static final String REPOSITORY = REGISTRY + "/jetty-sh"; | ||
|
||
private Path jettyHomePath; | ||
|
||
public ImageOS(String osid, Consumer<DockerfileBuilder> builderConsumer) | ||
{ | ||
super(REPOSITORY + ":" + osid, builderConsumer); | ||
} | ||
|
||
protected File getJettyHomeDir() | ||
{ | ||
if (jettyHomePath == null) | ||
{ | ||
String jettyVersion = System.getProperty("jettyVersion"); | ||
try | ||
{ | ||
JettyHomeTester homeTester = JettyHomeTester.Builder.newInstance() | ||
.jettyVersion(jettyVersion) | ||
.mavenLocalRepository(System.getProperty("mavenRepoPath")) | ||
.build(); | ||
jettyHomePath = homeTester.getJettyHome(); | ||
} | ||
catch (Exception e) | ||
{ | ||
throw new RuntimeException("Unable to get unpacked JETTY_HOME dir", e); | ||
} | ||
} | ||
return jettyHomePath.toFile(); | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
...n/src/test/java/org/eclipse/jetty/tests/distribution/jettysh/ImageOSAmazonCorretto11.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// | ||
// ======================================================================== | ||
// Copyright (c) 1995 Mort Bay Consulting Pty Ltd and others. | ||
// | ||
// This program and the accompanying materials are made available under the | ||
// terms of the Eclipse Public License v. 2.0 which is available at | ||
// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 | ||
// which is available at https://www.apache.org/licenses/LICENSE-2.0. | ||
// | ||
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 | ||
// ======================================================================== | ||
// | ||
|
||
package org.eclipse.jetty.tests.distribution.jettysh; | ||
|
||
/** | ||
* An OS Image of linux specific for running on Amazon AWS. | ||
* This is based on Amazon Linux 2 (which is based on Alpine 3). | ||
* Amazon Corretto JDK 11 is installed. | ||
* This image does NOT come with start-stop-daemon installed. | ||
* Instead of apt, it uses yum (the redhat package manager) | ||
*/ | ||
public class ImageOSAmazonCorretto11 extends ImageOS | ||
{ | ||
public ImageOSAmazonCorretto11() | ||
{ | ||
super("amazoncorretto-jdk11", | ||
builder -> | ||
builder | ||
.from("amazoncorretto:11.0.20") | ||
.run("yum update -y ; " + | ||
"yum install -y curl tar gzip vim shadow-utils net-tools") | ||
.env("TEST_DIR", "/var/test") | ||
.env("JETTY_HOME", "$TEST_DIR/jetty-home") | ||
.env("JETTY_BASE", "$TEST_DIR/jetty-base") | ||
.env("PATH", "$PATH:${JETTY_HOME}/bin/") | ||
.user("root") | ||
// Configure /etc/default/jetty | ||
.run("echo \"JETTY_HOME=${JETTY_HOME}\" > /etc/default/jetty ; " + | ||
"echo \"JETTY_BASE=${JETTY_BASE}\" >> /etc/default/jetty ; " + | ||
"echo \"JETTY_RUN=${JETTY_BASE}\" >> /etc/default/jetty ") | ||
// setup Jetty Home | ||
.copy("/opt/jetty/", "${JETTY_HOME}/") | ||
.env("PATH", "$PATH:${JETTY_HOME}/bin/") | ||
.run("chmod ugo+x ${JETTY_HOME}/bin/jetty.sh") | ||
.build() | ||
); | ||
withFileFromFile("/opt/jetty/", getJettyHomeDir()); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 think we still need the double quotes
I did the following test:
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.
Oh!!!! It works because it is a single variable:
This is sooooo subtle! bash is getting more perl like!