Skip to content

Commit

Permalink
FAI-658: new E2E maven module - PoC
Browse files Browse the repository at this point in the history
  • Loading branch information
Sona Mala committed Dec 6, 2021
1 parent b7a8473 commit dfaa965
Show file tree
Hide file tree
Showing 8 changed files with 289 additions and 52 deletions.
15 changes: 0 additions & 15 deletions .github/workflows/kogito-apps-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,6 @@ jobs:
with:
annotations-prefix: ${{ runner.os }}-${{ matrix.java-version }}/${{ matrix.maven-version }}
github-token: "${{ secrets.GITHUB_TOKEN }}"
#I assume that yarn was installed by the maven build in UI packages module
# TODO: find a way how perform `docker-compose down`
- name: E2E tests ${{ matrix.java-version }}
id: e2e
if: ${{ always() }}
shell: bash
run: |
echo "Run E2E Integration test suite"
pushd .
cd kogito_apps/ui-packages/packages/trusty/it-tests/docker-compose
ls -l
cd ../../../../../kogito-apps
ls -l
yarn run test:e2e
popd
- name: Surefire Report
uses: kiegroup/kogito-pipelines/.ci/actions/surefire-report@main
if: ${{ always() }}
Expand Down
167 changes: 167 additions & 0 deletions apps-integration-tests/integration-tests-trusty-audit/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.kie.kogito</groupId>
<artifactId>apps-integration-tests</artifactId>
<version>2.0.0-SNAPSHOT</version>
</parent>

<artifactId>integration-tests-trusty-audit</artifactId>
<name>Kogito Apps :: Integration Tests :: Trusty Audit UI</name>
<packaging>pom</packaging>

<properties>
<container.image.kogito-service>to-be-changed-in-submodules</container.image.kogito-service>
</properties>

<dependencies>
<!-- ensure dependent modules were built, but not added in the classpath -->
<dependency>
<groupId>org.kie.kogito</groupId>
<artifactId>explainability-service-messaging</artifactId>
<version>${project.version}</version>
<type>pom</type>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.kie.kogito</groupId>
<artifactId>integration-tests-trusty-service-quarkus</artifactId>
<version>${project.version}</version>
<type>pom</type>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.kie.kogito</groupId>
<artifactId>trusty-service-infinispan</artifactId>
<version>${project.version}</version>
<type>pom</type>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.kie.kogito</groupId>
<artifactId>trusty-ui</artifactId>
<version>${project.version}</version>
<type>pom</type>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>

<build>
<plugins>
<!--
mvn resources plugin
It seems that docker-maven-plugin can not read .ENV file
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<phase>test</phase>
<configuration>
<target><echo file="src/test/docker-compose/.env">VERSION=${project.version}</echo> </target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
-->
<!-- frontend related plugins-->
<!--
Installs node and yarn in the webapp's node and node_modules folders.
Run 'mvn package':
* the first time you have checked out the source.
* whenever the dependencies have been changed in package.json (delete the webapp's node_modules folder first!)
If you want to skip installation of the packages, turn the profile off by setting property `-Dskip.ui.deps`.
-->
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<configuration>
<workingDirectory>/home/sjamboro/Documents/Repository/kogito-apps/ui-packages</workingDirectory>
</configuration>
<executions>
<!--
It works only if docker contains images from previous build.
This was just verification that this way is imposible.
In case that docker images are empty than the build fails.
For example: org.kie.kogito/integration-tests-trusty-service-quarkus:2.0.0-SNAPSHOT is missing
TODO: parametrize base url to localhost:1337
-->
<execution>
<id>yarn e2e test</id>
<goals>
<goal>yarn</goal>
</goals>
<phase>integration-test</phase>
<configuration>
<skip>${skip.ui.build}</skip>
<npmRegistryURL>${env.NPM_REGISTRY_URL}</npmRegistryURL>
<arguments>run test:e2e</arguments>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<configuration>
<images>
<image>
<alias>webapp</alias>
<name>fabric8/compose-demo:latest</name>

<external>
<type>compose</type>
<basedir>src/test/docker-compose</basedir>
<composeFile>docker-compose.yml</composeFile>
</external>
</image>
</images>
</configuration>
<executions>
<execution>
<id>start</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>stop</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
version: '2'

services:
zookeeper:
image: wurstmeister/zookeeper:3.4.6
ports:
- "2181:2181"
environment:
LOG_DIR: "/tmp/logs"

kafka:
image: wurstmeister/kafka:2.12-2.2.1
depends_on:
- zookeeper
ports:
- "9092:9092"
expose:
- "9093"
environment:
KAFKA_ADVERTISED_LISTENERS: INSIDE://kafka:9093,OUTSIDE://localhost:9092
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INSIDE:PLAINTEXT,OUTSIDE:PLAINTEXT
KAFKA_LISTENERS: INSIDE://0.0.0.0:9093,OUTSIDE://0.0.0.0:9092
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
KAFKA_INTER_BROKER_LISTENER_NAME: INSIDE
LOG_DIR: "/tmp/logs"

kafdrop:
image: obsidiandynamics/kafdrop
depends_on:
- kafka
ports:
- "9000:9000"
environment:
KAFKA_BROKERCONNECT: "kafka:9093"
JVM_OPTS: "-Xms32M -Xmx64M"
SERVER_SERVLET_CONTEXTPATH: "/"

infinispan:
image: infinispan/server:11.0.4.Final
container_name: infinispan
ports:
- 11222:11222
command: "/opt/infinispan/bin/server.sh -c infinispan-demo.xml"
volumes:
- ./infinispan/infinispan.xml:/opt/infinispan/server/conf/infinispan-demo.xml:z

#dependency in integration-tests-trusty-audit
kogito-app:
image: "org.kie.kogito/integration-tests-trusty-service-quarkus:2.0.0-SNAPSHOT"
ports:
- 8080:8080
environment:
KAFKA_BOOTSTRAP_SERVERS: kafka:9093
KOGITO_SERVICE_URL: http://kogito-app:8080
depends_on:
- kafka

#dependency in integration-tests-trusty-audit
explainability:
image: "org.kie.kogito/explainability-service-messaging:2.0.0-SNAPSHOT"
depends_on:
- kafka
- kogito-app
environment:
KAFKA_BOOTSTRAP_SERVERS: kafka:9093
ports:
- 1336:8080

#dependency in integration-tests-trusty-audit
trusty:
image: "org.kie.kogito/trusty-service-infinispan:2.0.0-SNAPSHOT"
depends_on:
- kafka
- infinispan
environment:
KAFKA_BOOTSTRAP_SERVERS: kafka:9093
QUARKUS_INFINISPAN_CLIENT_SERVER_LIST: infinispan:11222
QUARKUS_INFINISPAN_CLIENT_USE_AUTH: "false"
TRUSTY_EXPLAINABILITY_ENABLED: "true"
ports:
- 1337:8080

#dependency in integration-tests-trusty-audit
trusty-ui:
image: "org.kie.kogito/trusty-ui:2.0.0-SNAPSHOT"
depends_on:
- kafka
environment:
KOGITO_TRUSTY_HTTP_URL: http://localhost:1337
ports:
- 1338:8080
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<infinispan xmlns='urn:infinispan:config:10.0' xsi:schemaLocation='urn:infinispan:config:10.0 http://www.infinispan.org/schemas/infinispan-config-10.0.xsd urn:infinispan:server:10.0 http://www.infinispan.org/schemas/infinispan-server-10.0.xsd' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
<cache-container name="default"/>
<server xmlns='urn:infinispan:server:10.0'>
<interfaces>
<interface name='public'>
<inet-address value='${infinispan.bind.address:0.0.0.0}'/>
</interface>
</interfaces>
<socket-bindings default-interface='public' port-offset='0'>
<socket-binding name='default' port='11222'/>
</socket-bindings>
<security>
<security-realms>
<security-realm name='default'>
<properties-realm groups-attribute='Roles'>
<user-properties path='users.properties' relative-to='infinispan.server.config.path'/>
<group-properties path='groups.properties' relative-to='infinispan.server.config.path'/>
</properties-realm>
</security-realm>
</security-realms>
</security>
<endpoints socket-binding='default' security-realm='default'>
<hotrod-connector name="hotrod"/>
<rest-connector name="rest"/>
</endpoints>
</server>
</infinispan>
1 change: 1 addition & 0 deletions apps-integration-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

<modules>
<module>integration-tests-jobs-service</module>
<module>integration-tests-trusty-audit</module>
<module>integration-tests-trusty-service</module>
<module>integration-tests-data-index-service</module>
<module>integration-tests-task-assigning-service</module>
Expand Down
4 changes: 2 additions & 2 deletions ui-packages/packages/trusty/it-tests/e2e/TrafficViolation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
let reqId;
let auditDetailsUrl;

describe('Traffic Violation', () => {
describe.skip('Traffic Violation', () => {
before(() => {
cy.request({
method: 'POST',
Expand Down Expand Up @@ -95,7 +95,7 @@ describe('Traffic Violation', () => {
expect($items.eq(2)).have.text('Input data');
expect($items.eq(3)).have.text('Model lookup');
/*
* TODO: FAI-665
* TODO: FAI-665
*/
expect($items.eq(4)).to.contain('Counterfactual analysis');
});
Expand Down
2 changes: 1 addition & 1 deletion ui-packages/packages/trusty/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"cypress:open:e2e": "yarn run cypress open --project it-tests --config-file cypress.e2e.json",
"cypress:run:e2e": "yarn run cypress run -b chrome --project it-tests --config-file cypress.e2e.json",
"test:it": "start-server-and-test 'yarn start:it' http://0.0.0.0:9000 'yarn cypress:run:it' && echo",
"test:e2e": "start-server-and-test start:e2e http://0.0.0.0:1338 cypress:run:e2e"
"test:e2e": "yarn cypress:run:e2e"
},
"devDependencies": {
"faker": "^4.1.0",
Expand Down
34 changes: 0 additions & 34 deletions ui-packages/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -102,21 +102,6 @@
</filesets>
</configuration>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<phase>test</phase>
<configuration>
<target><echo file="packages/trusty/it-tests/docker-compose/.env">VERSION=${project.version}</echo> </target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- frontend related plugins-->
<!--
Installs node and yarn in the webapp's node and node_modules folders.
Expand Down Expand Up @@ -222,25 +207,6 @@
<arguments>run test:it</arguments>
</configuration>
</execution>
<!--
It works only if docker contains images from previous build.
This was just verification that this way is imposible.
In case that docker images are empty than the build fails.
For example: org.kie.kogito/integration-tests-trusty-service-quarkus:2.0.0-SNAPSHOT is missing
<execution>
<id>yarn e2e test</id>
<goals>
<goal>yarn</goal>
</goals>
<phase>test</phase>
<configuration>
<skip>${skip.ui.build}</skip>
<npmRegistryURL>${env.NPM_REGISTRY_URL}</npmRegistryURL>
<arguments>run test:e2e</arguments>
</configuration>
</execution>
-->
</executions>
</plugin>
</plugins>
Expand Down

0 comments on commit dfaa965

Please sign in to comment.