Skip to content

Commit

Permalink
Merge aa65844 into 3389a91
Browse files Browse the repository at this point in the history
  • Loading branch information
LeoNerdoG authored Mar 4, 2021
2 parents 3389a91 + aa65844 commit e53f248
Show file tree
Hide file tree
Showing 406 changed files with 949 additions and 1,268 deletions.
36 changes: 18 additions & 18 deletions .github/workflows/github-actions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
timeout_minutes: 30
retry_on: error
max_attempts: 3
command: ./ci-output.sh mvn -B ${BUILD_OPTS} ${CONFIG_OVERRIDES} -Dgroups='!org.eclipse.kapua.qa.markers.junit.JUnitTests' -Dcucumber.options="--tags @brokerAcl" verify
command: ./ci-output.sh mvn -B ${BUILD_OPTS} ${CONFIG_OVERRIDES} -Dgroups='!org.eclipse.kapua.qa.markers.Categories$junitTests' -Dcucumber.options="--tags @brokerAcl" verify
- run: bash <(curl -s https://codecov.io/bash)
test-tag:
needs: build-kapua
Expand All @@ -65,7 +65,7 @@ jobs:
timeout_minutes: 30
retry_on: error
max_attempts: 3
command: ./ci-output.sh mvn -B ${BUILD_OPTS} ${CONFIG_OVERRIDES} -Dgroups='!org.eclipse.kapua.qa.markers.junit.JUnitTests' -Dcucumber.options="--tags @tag" verify
command: ./ci-output.sh mvn -B ${BUILD_OPTS} ${CONFIG_OVERRIDES} -Dgroups='!org.eclipse.kapua.qa.markers.Categories$junitTests' -Dcucumber.options="--tags @tag" verify
- run: bash <(curl -s https://codecov.io/bash)
test-broker:
needs: build-kapua
Expand All @@ -86,7 +86,7 @@ jobs:
timeout_minutes: 30
retry_on: error
max_attempts: 3
command: ./ci-output.sh mvn -B ${BUILD_OPTS} ${CONFIG_OVERRIDES} -Dgroups='!org.eclipse.kapua.qa.markers.junit.JUnitTests' -Dcucumber.options="--tags @broker" verify
command: ./ci-output.sh mvn -B ${BUILD_OPTS} ${CONFIG_OVERRIDES} -Dgroups='!org.eclipse.kapua.qa.markers.Categories$junitTests' -Dcucumber.options="--tags @broker" verify
- run: bash <(curl -s https://codecov.io/bash)
test-device:
needs: build-kapua
Expand All @@ -107,7 +107,7 @@ jobs:
timeout_minutes: 30
retry_on: error
max_attempts: 3
command: ./ci-output.sh mvn -B ${BUILD_OPTS} ${CONFIG_OVERRIDES} -Dgroups='!org.eclipse.kapua.qa.markers.junit.JUnitTests' -Dcucumber.options="--tags @device" verify
command: ./ci-output.sh mvn -B ${BUILD_OPTS} ${CONFIG_OVERRIDES} -Dgroups='!org.eclipse.kapua.qa.markers.Categories$junitTests' -Dcucumber.options="--tags @device" verify
- run: bash <(curl -s https://codecov.io/bash)
test-connection:
needs: build-kapua
Expand All @@ -128,7 +128,7 @@ jobs:
timeout_minutes: 30
retry_on: error
max_attempts: 3
command: ./ci-output.sh mvn -B ${BUILD_OPTS} ${CONFIG_OVERRIDES} -Dgroups='!org.eclipse.kapua.qa.markers.junit.JUnitTests' -Dcucumber.options="--tags @connection" verify
command: ./ci-output.sh mvn -B ${BUILD_OPTS} ${CONFIG_OVERRIDES} -Dgroups='!org.eclipse.kapua.qa.markers.Categories$junitTests' -Dcucumber.options="--tags @connection" verify
- run: bash <(curl -s https://codecov.io/bash)
test-datastore:
needs: build-kapua
Expand All @@ -149,7 +149,7 @@ jobs:
timeout_minutes: 30
retry_on: error
max_attempts: 3
command: ./ci-output.sh mvn -B ${BUILD_OPTS} ${CONFIG_OVERRIDES} -Dgroups='!org.eclipse.kapua.qa.markers.junit.JUnitTests' -Dcucumber.options="--tags @datastore" verify
command: ./ci-output.sh mvn -B ${BUILD_OPTS} ${CONFIG_OVERRIDES} -Dgroups='!org.eclipse.kapua.qa.markers.Categories$junitTests' -Dcucumber.options="--tags @datastore" verify
- run: bash <(curl -s https://codecov.io/bash)
test-user:
needs: build-kapua
Expand All @@ -170,7 +170,7 @@ jobs:
timeout_minutes: 30
retry_on: error
max_attempts: 3
command: ./ci-output.sh mvn -B ${BUILD_OPTS} ${CONFIG_OVERRIDES} -Dgroups='!org.eclipse.kapua.qa.markers.junit.JUnitTests' -Dcucumber.options="--tags @user" verify
command: ./ci-output.sh mvn -B ${BUILD_OPTS} ${CONFIG_OVERRIDES} -Dgroups='!org.eclipse.kapua.qa.markers.Categories$junitTests' -Dcucumber.options="--tags @user" verify
- run: bash <(curl -s https://codecov.io/bash)
test-security:
needs: build-kapua
Expand All @@ -191,7 +191,7 @@ jobs:
timeout_minutes: 30
retry_on: error
max_attempts: 3
command: ./ci-output.sh mvn -B ${BUILD_OPTS} ${CONFIG_OVERRIDES} -Dgroups='!org.eclipse.kapua.qa.markers.junit.JUnitTests' -Dcucumber.options="--tags @security" verify
command: ./ci-output.sh mvn -B ${BUILD_OPTS} ${CONFIG_OVERRIDES} -Dgroups='!org.eclipse.kapua.qa.markers.Categories$junitTests' -Dcucumber.options="--tags @security" verify
- run: bash <(curl -s https://codecov.io/bash)
test-jobs:
needs: build-kapua
Expand All @@ -212,7 +212,7 @@ jobs:
timeout_minutes: 30
retry_on: error
max_attempts: 3
command: ./ci-output.sh mvn -B ${BUILD_OPTS} ${CONFIG_OVERRIDES} -Dgroups='!org.eclipse.kapua.qa.markers.junit.JUnitTests' -Dcucumber.options="--tags @jobs" verify
command: ./ci-output.sh mvn -B ${BUILD_OPTS} ${CONFIG_OVERRIDES} -Dgroups='!org.eclipse.kapua.qa.markers.Categories$junitTests' -Dcucumber.options="--tags @jobs" verify
- run: bash <(curl -s https://codecov.io/bash)
test-triggerService:
needs: build-kapua
Expand All @@ -233,7 +233,7 @@ jobs:
timeout_minutes: 30
retry_on: error
max_attempts: 3
command: ./ci-output.sh mvn -B ${BUILD_OPTS} ${CONFIG_OVERRIDES} -Dgroups='!org.eclipse.kapua.qa.markers.junit.JUnitTests' -Dcucumber.options="--tags @triggerService" verify
command: ./ci-output.sh mvn -B ${BUILD_OPTS} ${CONFIG_OVERRIDES} -Dgroups='!org.eclipse.kapua.qa.markers.Categories$junitTests' -Dcucumber.options="--tags @triggerService" verify
- run: bash <(curl -s https://codecov.io/bash)
test-account:
needs: build-kapua
Expand All @@ -254,7 +254,7 @@ jobs:
timeout_minutes: 30
retry_on: error
max_attempts: 3
command: ./ci-output.sh mvn -B ${BUILD_OPTS} ${CONFIG_OVERRIDES} -Dgroups='!org.eclipse.kapua.qa.markers.junit.JUnitTests' -Dcucumber.options="--tags @account" verify
command: ./ci-output.sh mvn -B ${BUILD_OPTS} ${CONFIG_OVERRIDES} -Dgroups='!org.eclipse.kapua.qa.markers.Categories$junitTests' -Dcucumber.options="--tags @account" verify
- run: bash <(curl -s https://codecov.io/bash)
test-jobEngineStartOfflineDevice:
needs: build-kapua
Expand All @@ -275,7 +275,7 @@ jobs:
timeout_minutes: 30
retry_on: error
max_attempts: 3
command: ./ci-output.sh mvn -B ${BUILD_OPTS} ${CONFIG_OVERRIDES} -Dgroups='!org.eclipse.kapua.qa.markers.junit.JUnitTests' -Dcucumber.options="--tags @jobEngineStartOfflineDevice" verify
command: ./ci-output.sh mvn -B ${BUILD_OPTS} ${CONFIG_OVERRIDES} -Dgroups='!org.eclipse.kapua.qa.markers.Categories$junitTests' -Dcucumber.options="--tags @jobEngineStartOfflineDevice" verify
- run: bash <(curl -s https://codecov.io/bash)
test-jobEngineStartOnlineDevice:
needs: build-kapua
Expand All @@ -296,7 +296,7 @@ jobs:
timeout_minutes: 30
retry_on: error
max_attempts: 3
command: ./ci-output.sh mvn -B ${BUILD_OPTS} ${CONFIG_OVERRIDES} -Dgroups='!org.eclipse.kapua.qa.markers.junit.JUnitTests' -Dcucumber.options="--tags @jobEngineStartOnlineDevice" verify
command: ./ci-output.sh mvn -B ${BUILD_OPTS} ${CONFIG_OVERRIDES} -Dgroups='!org.eclipse.kapua.qa.markers.Categories$junitTests' -Dcucumber.options="--tags @jobEngineStartOnlineDevice" verify
- run: bash <(curl -s https://codecov.io/bash)
test-jobEngineRestartOfflineDevice:
needs: build-kapua
Expand All @@ -317,7 +317,7 @@ jobs:
timeout_minutes: 30
retry_on: error
max_attempts: 3
command: ./ci-output.sh mvn -B ${BUILD_OPTS} ${CONFIG_OVERRIDES} -Dgroups='!org.eclipse.kapua.qa.markers.junit.JUnitTests' -Dcucumber.options="--tags @jobEngineRestartOfflineDevice" verify
command: ./ci-output.sh mvn -B ${BUILD_OPTS} ${CONFIG_OVERRIDES} -Dgroups='!org.eclipse.kapua.qa.markers.Categories$junitTests' -Dcucumber.options="--tags @jobEngineRestartOfflineDevice" verify
- run: bash <(curl -s https://codecov.io/bash)
test-jobEngineRestartOnlineDevice:
needs: build-kapua
Expand All @@ -338,7 +338,7 @@ jobs:
timeout_minutes: 30
retry_on: error
max_attempts: 3
command: ./ci-output.sh mvn -B ${BUILD_OPTS} ${CONFIG_OVERRIDES} -Dgroups='!org.eclipse.kapua.qa.markers.junit.JUnitTests' -Dcucumber.options="--tags @jobEngineRestartOnlineDevice" verify
command: ./ci-output.sh mvn -B ${BUILD_OPTS} ${CONFIG_OVERRIDES} -Dgroups='!org.eclipse.kapua.qa.markers.Categories$junitTests' -Dcucumber.options="--tags @jobEngineRestartOnlineDevice" verify
- run: bash <(curl -s https://codecov.io/bash)
test-jobEngineRestartOnlineDeviceSecondPart:
needs: build-kapua
Expand All @@ -359,7 +359,7 @@ jobs:
timeout_minutes: 30
retry_on: error
max_attempts: 3
command: ./ci-output.sh mvn -B ${BUILD_OPTS} ${CONFIG_OVERRIDES} -Dgroups='!org.eclipse.kapua.qa.markers.junit.JUnitTests' -Dcucumber.options="--tags @jobEngineRestartOnlineDeviceSecondPart" verify
command: ./ci-output.sh mvn -B ${BUILD_OPTS} ${CONFIG_OVERRIDES} -Dgroups='!org.eclipse.kapua.qa.markers.Categories$junitTests' -Dcucumber.options="--tags @jobEngineRestartOnlineDeviceSecondPart" verify
- run: bash <(curl -s https://codecov.io/bash)
test-jobEngineServiceStop:
needs: build-kapua
Expand All @@ -380,7 +380,7 @@ jobs:
timeout_minutes: 30
retry_on: error
max_attempts: 3
command: ./ci-output.sh mvn -B ${BUILD_OPTS} ${CONFIG_OVERRIDES} -Dgroups='!org.eclipse.kapua.qa.markers.junit.JUnitTests' -Dcucumber.options="--tags @jobEngineServiceStop" verify
command: ./ci-output.sh mvn -B ${BUILD_OPTS} ${CONFIG_OVERRIDES} -Dgroups='!org.eclipse.kapua.qa.markers.Categories$junitTests' -Dcucumber.options="--tags @jobEngineServiceStop" verify
- run: bash <(curl -s https://codecov.io/bash)
junit-tests:
needs: build-kapua
Expand All @@ -401,7 +401,7 @@ jobs:
timeout_minutes: 30
retry_on: error
max_attempts: 3
command: ./ci-output.sh mvn -B ${BUILD_OPTS} ${CONFIG_OVERRIDES} -Dgroups='org.eclipse.kapua.qa.markers.junit.JUnitTests' verify
command: ./ci-output.sh mvn -B ${BUILD_OPTS} ${CONFIG_OVERRIDES} -Dgroups='org.eclipse.kapua.qa.markers.Categories$junitTests' verify
- run: bash <(curl -s https://codecov.io/bash)
build-javadoc:
needs: build-kapua
Expand Down
42 changes: 24 additions & 18 deletions RunTests.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
# How to execute Kapua tests
# How to Execute Kapua Tests

There are couple of ways to run tests, either pure unit tests, component tests or integration tests.
There are a couple of ways to run tests, either pure unit tests, component tests or integration tests.
Integration tests can be run:

- using embedded servers
- using dockerized servers
- using embedded servers

## With dockerized Kapua
## With Dockerized Kapua
With fabric8 plugin usage tests can now be run without explicitly running dockerized environment.
Docker containers providing Kapua infrastructure are started with maven itself.
But to run these integration tests, you have to switch to qa folder and run following command
Nevertheless, in order to run these integration tests, you first have to build project from root with command:

mvn clean install -DskipTests -Pdocker

and afterwards switch to qa folder and run the following command:

mvn test -PI9nTests
This will run integration tests only, those are tests written in gherkin and being annotated with

This will run integration tests only, those are tests written in Gherkin and being annotated with
``@integration``

If tests fail and dockers are still running use this command:
If tests fail and Docker containers are still running, use this command:

mvn docker:stop -PI9nTests

Expand All @@ -25,16 +29,16 @@ Example response with time:
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 18:11 min
[INFO] Finished at: 2019-03-04T14:16:32+01:00
[INFO] Final Memory: 48M/728M
[INFO] Total time: 53:15 min
[INFO] Finished at: 2020-11-05T22:10:15+01:00
[INFO] Final Memory: 177M/728M
[INFO] ------------------------------------------------------------------------

##Without dockerized Kapua
By default tests are run with embedded servers providing kapua infrastructure services, such as
database, event-broker, message broker, elaticsearch.
## Using Embedded Servers
By default, tests are run with embedded servers providing Kapua infrastructure services, such as
database, event-broker, message broker, ElasticSearch.

So to run those use default profile and run:
To run those use default profile and run:

mvn clean install
or
Expand All @@ -43,27 +47,29 @@ So to run those use default profile and run:
Those two commands will use following defaults:

cucumber.options="--tags ~@rest"
groups='!org.eclipse.kapua.test.junit.JUnitTests'
groups='!org.eclipse.kapua.qa.markers.Categories$junitTests'
commons.settings.hotswap=true
commons.db.schema.update=true
commons.db.schema=kapuadb
broker.host=localhost

Example response with time:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 31:14 min
[INFO] Finished at: 2019-03-04T14:51:24+01:00
[INFO] Final Memory: 244M/1761M
[INFO] ------------------------------------------------------------------------

## Run pure junit tests
## Running Pure JUnit Tests

mvn test -Dgroups='org.eclipse.kapua.test.junit.JUnitTests'
mvn test -PjunitTests

Example response with time:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 05:26 min
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
*******************************************************************************/
package org.eclipse.kapua.broker;

import org.eclipse.kapua.qa.markers.junit.JUnitTests;
import org.eclipse.kapua.qa.markers.Categories;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.categories.Category;

@Category(JUnitTests.class)
@Category(Categories.junitTests.class)
public class BrokerDomainTest extends Assert {

BrokerDomain brokerDomain;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
*******************************************************************************/
package org.eclipse.kapua.broker;

import org.eclipse.kapua.qa.markers.junit.JUnitTests;
import org.eclipse.kapua.qa.markers.Categories;
import org.junit.Assert;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import java.lang.reflect.Constructor;
import java.lang.reflect.Modifier;

@Category(JUnitTests.class)
@Category(Categories.junitTests.class)
public class BrokerDomainsTest extends Assert {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
package org.eclipse.kapua.broker.core;

import org.eclipse.kapua.KapuaException;
import org.eclipse.kapua.qa.markers.junit.JUnitTests;
import org.eclipse.kapua.qa.markers.Categories;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import javax.xml.bind.JAXBContext;

@Category(JUnitTests.class)
@Category(Categories.junitTests.class)
public class BrokerJAXBContextProviderTest extends Assert {

BrokerJAXBContextProvider brokerJAXBContextProvider;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
package org.eclipse.kapua.broker.core;

import org.apache.activemq.broker.Broker;
import org.eclipse.kapua.qa.markers.junit.JUnitTests;
import org.eclipse.kapua.qa.markers.Categories;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.mockito.Mockito;

@Category(JUnitTests.class)
@Category(Categories.junitTests.class)
public class KapuaBrokerApplicationPluginTest extends Assert {

KapuaBrokerApplicationPlugin kapuaBrokerApplicationPlugin;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
*******************************************************************************/
package org.eclipse.kapua.broker.core;

import org.eclipse.kapua.qa.markers.junit.JUnitTests;
import org.eclipse.kapua.qa.markers.Categories;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.categories.Category;

@Category(JUnitTests.class)
@Category(Categories.junitTests.class)
public class KapuaBrokerJAXBContextLoaderTest extends Assert {

KapuaBrokerJAXBContextLoader kapuaBrokerJAXBContextLoader;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
*******************************************************************************/
package org.eclipse.kapua.broker.core;

import org.eclipse.kapua.qa.markers.junit.JUnitTests;
import org.eclipse.kapua.qa.markers.Categories;
import org.junit.Assert;
import org.junit.Test;
import org.junit.experimental.categories.Category;

@Category(JUnitTests.class)
@Category(Categories.junitTests.class)
public class KapuaDatabaseCheckUpdateTest extends Assert {

@Test
Expand All @@ -41,11 +41,4 @@ public void kapuaDatabaseCheckUpdateTrueTest() {
fail("Exception not expected.");
}
}

@Test(expected = SecurityException.class)
public void kapuaDatabaseCheckUpdateExceptionTest() {
System.setProperty("commons.db.schema.update", "true");
System.setProperty("LIQUIBASE_ENABLED","true");
new KapuaDatabaseCheckUpdate();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import org.eclipse.kapua.broker.core.plugin.ConnectorDescriptorProviders;
import org.eclipse.kapua.message.KapuaMessage;
import org.eclipse.kapua.model.id.KapuaId;
import org.eclipse.kapua.qa.markers.junit.JUnitTests;
import org.eclipse.kapua.qa.markers.Categories;
import org.eclipse.kapua.translator.Translator;
import org.eclipse.kapua.translator.cache.TranslatorCache;
import org.eclipse.kapua.transport.message.jms.JmsPayload;
Expand All @@ -42,7 +42,7 @@
import java.util.Base64;
import java.util.Date;

@Category(JUnitTests.class)
@Category(Categories.junitTests.class)
public class AbstractKapuaConverterTest extends Assert {

private class AbstractKapuaConverterImpl extends AbstractKapuaConverter {
Expand Down
Loading

0 comments on commit e53f248

Please sign in to comment.