diff --git a/.travis.yml b/.travis.yml index 33e4ce5d..ddd7c9bd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,11 @@ jdk: install: - mvn -version; docker version script: + - if [ $(git grep import | grep '\*' | grep -E -v '(.mvn/|.travis.yml:|README.md|CONTRIBUTING.md)' | wc -l) != 0 ]; then + echo "Wildcard found!"; + git grep import | grep '\*' | grep -E -v '(.mvn/|.travis.yml:|README.md|CONTRIBUTING.md)'; + exit 1; + fi - mvn -B formatter:validate impsort:check - mvn -B verify -DskipTests -Djboss.dist=foo cache: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..d76847a8 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,51 @@ +## Contributing +Standard PR workflow - [link](https://www.atlassian.com/git/tutorials/comparing-workflows/forking-workflow) + +## Structure of the testsuite +Group all tests for given MP spec into single module +* for example to group all tests for MP Metric together +* in case that tests for integration of multiple MP specs are developed and it's not clear to which module they belong then new module can be created. Preferable a name of such module should reflect MP specs. + +Tooling should be in separate module so it is isolated and easily used by other (test) modules. +Try to add tooling to existing module. +If there is no module that reflect tooling purpose you can create new module. +The name **must** include `tooling-` prefix. + +Rather than add new dependency try to extend existing tooling or add new one yet still consider the trade-off. + +Examples of available tooling: +* tooling-cpu-load +* tooling-docker +* tooling-server-configuration + +**In order to configure and manage server you need to use tooling-server-configuration and Creaper core library, see [the module description](tooling-server-configuration/README.md)** + +## Test documentation +For documentation and test plan purposes use following annotations for each test to properly document its purpose, passing criteria and version of EAP since a test is valid from: +``` +/** + * @tpTestDetails __PUT TEST DETAILS__ + * @tpPassCrit __PUT PASSING CRITERIA__ + * @tpSince __VERSION OF WILDFLY/EAP WITH A FEATURE__ +*/ +``` + +## Coding conventions +To enforce common codestyle the testsuite uses formatter plugin which automatically formats a code. To run it manually run `mvn -B formatter:validate impsort:check`. + +## Another best practices +To get arquillian properties such ach server address and so on, use: +``` +ArquillianContainerProperties arqProps = new ArquillianContainerProperties( + ArquillianDescriptorWrapper.getArquillianDescriptor()); +arqProps.getDefaultManagementAddress(); +``` + +To validate server functionality via REST point use restassured library: +* if possible import statically `get()`, `given()`,... method +* use one `baseUri()` with fully-qualified URL instead of +``` +.baseUri(...) +.port(...) +.basePath(...) +``` \ No newline at end of file diff --git a/README.md b/README.md index f744edb6..5685f5e2 100644 --- a/README.md +++ b/README.md @@ -121,3 +121,22 @@ mvn release:prepare release:clean -Darguments=-DskipTests ``` With commands you are able to define a release, a tag and a next development version name in interactive way. + +## Issues found by the testsuite +Any issue found in WildFly/EAP release will be reported into the Red Hat issue tracker: https://issues.redhat.com/ . There are the following Jira projects: +* https://issues.redhat.com/projects/WFWIP - for issues in unreleased WildFly version (like WF dev branches) +* https://issues.redhat.com/projects/WFLY - for released WildFly versions +* https://issues.redhat.com/projects/JBEAP - for released EAP versions + +Every reported issue must contain: +* Title (affected MP spec may be part of the title, proper Component must be set) +* Type: Bug +* Component: related Microprofile component (`mp-health`) +* Affected Version - WildFly/EAP version (for WFLY/JBEAP issues) +* Description of the issue + * provide high-level description of the issue + * information about tested WF/EAP build (or used commit/branch) + * impact on the user + * test scenario (actual and expected result) + * add logs/stacktraces + * automatic reproducer (if possible) \ No newline at end of file diff --git a/microprofile-metrics/src/test/java/org/jboss/eap/qe/microprofile/metrics/ConnectionStressMetricsTest.java b/microprofile-metrics/src/test/java/org/jboss/eap/qe/microprofile/metrics/ConnectionStressMetricsTest.java index 29086cb0..fcdfbb5e 100644 --- a/microprofile-metrics/src/test/java/org/jboss/eap/qe/microprofile/metrics/ConnectionStressMetricsTest.java +++ b/microprofile-metrics/src/test/java/org/jboss/eap/qe/microprofile/metrics/ConnectionStressMetricsTest.java @@ -16,13 +16,14 @@ import org.jboss.arquillian.container.test.api.RunAsClient; import org.jboss.arquillian.junit.Arquillian; import org.jboss.arquillian.test.api.ArquillianResource; -import org.jboss.as.arquillian.api.ContainerResource; -import org.jboss.as.arquillian.container.ManagementClient; import org.jboss.eap.qe.microprofile.metrics.hello.MetricsApp; +import org.jboss.eap.qe.microprofile.tooling.server.configuration.ConfigurationException; +import org.jboss.eap.qe.microprofile.tooling.server.configuration.arquillian.ArquillianContainerProperties; +import org.jboss.eap.qe.microprofile.tooling.server.configuration.arquillian.ArquillianDescriptorWrapper; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.asset.EmptyAsset; import org.jboss.shrinkwrap.api.spec.WebArchive; -import org.junit.Before; +import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; @@ -31,11 +32,9 @@ @RunWith(Arquillian.class) public class ConnectionStressMetricsTest { - @ContainerResource - ManagementClient managementClient; @ArquillianResource private URL deploymentUrl; - private URL metricsURL; + private static URL metricsURL; @Deployment public static WebArchive createDeployment() { @@ -44,9 +43,12 @@ public static WebArchive createDeployment() { .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml"); } - @Before - public void composeHealthEndpointURL() throws MalformedURLException { - metricsURL = new URL("http://" + managementClient.getMgmtAddress() + ":" + managementClient.getMgmtPort() + "/metrics"); + @BeforeClass + public static void composeMetricsEndpointURL() throws MalformedURLException, ConfigurationException { + ArquillianContainerProperties arqProps = new ArquillianContainerProperties( + ArquillianDescriptorWrapper.getArquillianDescriptor()); + metricsURL = new URL("http://" + arqProps.getDefaultManagementAddress() + ":" + arqProps.getDefaultManagementPort() + + "/metrics"); } private HttpURLConnection getHTTPConn(URL url) throws Exception { diff --git a/microprofile-metrics/src/test/java/org/jboss/eap/qe/microprofile/metrics/InvalidMimeTypeMetricsTest.java b/microprofile-metrics/src/test/java/org/jboss/eap/qe/microprofile/metrics/InvalidMimeTypeMetricsTest.java index 66c81ddd..3e38940e 100644 --- a/microprofile-metrics/src/test/java/org/jboss/eap/qe/microprofile/metrics/InvalidMimeTypeMetricsTest.java +++ b/microprofile-metrics/src/test/java/org/jboss/eap/qe/microprofile/metrics/InvalidMimeTypeMetricsTest.java @@ -3,16 +3,18 @@ import static io.restassured.RestAssured.given; import java.io.IOException; +import java.net.MalformedURLException; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.container.test.api.RunAsClient; import org.jboss.arquillian.junit.Arquillian; -import org.jboss.as.arquillian.api.ContainerResource; -import org.jboss.as.arquillian.container.ManagementClient; +import org.jboss.eap.qe.microprofile.tooling.server.configuration.ConfigurationException; +import org.jboss.eap.qe.microprofile.tooling.server.configuration.arquillian.ArquillianContainerProperties; +import org.jboss.eap.qe.microprofile.tooling.server.configuration.arquillian.ArquillianDescriptorWrapper; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.asset.EmptyAsset; import org.jboss.shrinkwrap.api.spec.JavaArchive; -import org.junit.Before; +import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; @@ -28,17 +30,15 @@ public static JavaArchive createDeployment() { .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml"); } - @ContainerResource - ManagementClient managementClient; + private static RequestSpecification metricsRequest; - private RequestSpecification metricsRequest; - - @Before - public void prepare() { - metricsRequest = given() - .baseUri("http://" + managementClient.getMgmtAddress()) - .port(managementClient.getMgmtPort()) - .basePath("metrics"); + @BeforeClass + public static void composeMetricsEndpointURL() throws MalformedURLException, ConfigurationException { + ArquillianContainerProperties arqProps = new ArquillianContainerProperties( + ArquillianDescriptorWrapper.getArquillianDescriptor()); + String metricsURL = "http://" + arqProps.getDefaultManagementAddress() + ":" + arqProps.getDefaultManagementPort() + + "/metrics"; + metricsRequest = given().baseUri(metricsURL); } /** diff --git a/microprofile-metrics/src/test/java/org/jboss/eap/qe/microprofile/metrics/MetricsTest.java b/microprofile-metrics/src/test/java/org/jboss/eap/qe/microprofile/metrics/MetricsTest.java index 48089a19..77ba77f2 100644 --- a/microprofile-metrics/src/test/java/org/jboss/eap/qe/microprofile/metrics/MetricsTest.java +++ b/microprofile-metrics/src/test/java/org/jboss/eap/qe/microprofile/metrics/MetricsTest.java @@ -21,13 +21,14 @@ import org.jboss.arquillian.container.test.api.RunAsClient; import org.jboss.arquillian.junit.Arquillian; import org.jboss.arquillian.test.api.ArquillianResource; -import org.jboss.as.arquillian.api.ContainerResource; -import org.jboss.as.arquillian.container.ManagementClient; import org.jboss.eap.qe.microprofile.metrics.hello.MetricsApp; +import org.jboss.eap.qe.microprofile.tooling.server.configuration.ConfigurationException; +import org.jboss.eap.qe.microprofile.tooling.server.configuration.arquillian.ArquillianContainerProperties; +import org.jboss.eap.qe.microprofile.tooling.server.configuration.arquillian.ArquillianDescriptorWrapper; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.asset.EmptyAsset; import org.jboss.shrinkwrap.api.spec.WebArchive; -import org.junit.Before; +import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; @@ -40,11 +41,8 @@ public class MetricsTest { @ArquillianResource URL deploymentUrl; - @ContainerResource - ManagementClient managementClient; - - private RequestSpecification jsonMetricsRequest; - private RequestSpecification textMetricsRequest; + private static RequestSpecification jsonMetricsRequest; + private static RequestSpecification textMetricsRequest; @Deployment public static WebArchive createDeployment() { @@ -53,9 +51,12 @@ public static WebArchive createDeployment() { .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml"); } - @Before - public void prepare() { - String metricsURL = "http://" + managementClient.getMgmtAddress() + ":" + managementClient.getMgmtPort() + "/metrics"; + @BeforeClass + public static void composeMetricsEndpointURL() throws ConfigurationException { + ArquillianContainerProperties arqProps = new ArquillianContainerProperties( + ArquillianDescriptorWrapper.getArquillianDescriptor()); + String metricsURL = "http://" + arqProps.getDefaultManagementAddress() + ":" + arqProps.getDefaultManagementPort() + + "/metrics"; jsonMetricsRequest = given() .baseUri(metricsURL) .accept(ContentType.JSON); diff --git a/tooling-server-configuration/README.md b/tooling-server-configuration/README.md new file mode 100644 index 00000000..529e32ed --- /dev/null +++ b/tooling-server-configuration/README.md @@ -0,0 +1,22 @@ +# Module description +Module contains classes for configuring and managing server. + +## Creaper + +Creaper core library [link](https://github.com/wildfly-extras/creaper) is meant to be used to configure and manage server. +To get `OnlineManagementClient` you can use `ManagementClientProvider` class. +The class reads Arquillian configuration autimatically. + +## Configure server + +To achieve desired configuration of server you can implement `MicroProfileServerSetupTask` that extends `ServerSetupTask` interface and annotate testclass with `@ServerSetup` annotation. +The setup task in invoked after Arquillian observers and before a deployment is deployed. +The interface provides two methods: +* setup(): implement desired changes +* teardown(): restore and rollback changes + +If you need to configure a server see [Creaper section](#Creaper) to get a instance of `OnlineManagementClient` + +## Logging + +Module also contains tooling for checking server log files - `ModelNodeLogChecker`. \ No newline at end of file