Skip to content

Commit e32f86d

Browse files
committed
wip8
1 parent 464032f commit e32f86d

File tree

4 files changed

+144
-28
lines changed

4 files changed

+144
-28
lines changed

.github/ci-console-config.properties

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
cws_ldap_url_default=ldap://ldapsearch:389
2+
ldap_identity_plugin_class=org.camunda.bpm.identity.impl.ldap.plugin.LdapIdentityProviderPlugin
3+
ldap_security_filter_class=jpl.cws.core.web.CwsLdapSecurityFilter
4+
camunda_security_filter_class=jpl.cws.core.web.CwsCamundaSecurityFilter
5+
auto_accept_config=y
6+
hostname=cws-console
7+
install_type=2
8+
database_type=mariadb
9+
database_host=db
10+
database_port=3306
11+
database_name=cws
12+
database_username=root
13+
database_password=test
14+
admin_user=admin
15+
admin_firstname=Admin
16+
admin_lastname=User
17+
18+
cws_web_port=38080
19+
cws_ssl_port=38443
20+
cws_ajp_port=38009
21+
cws_shutdown_port=38005
22+
cws_console_host=cws-console
23+
cws_console_ssl_port=38443
24+
amq_host=cws-console
25+
amq_port=31616
26+
cws_amq_jmx_port=37099
27+
cws_jmx_port=31099
28+
identity_plugin_type=LDAP
29+
cws_ldap_url=ldap://ldapsearch:389
30+
elasticsearch_protocol=http
31+
elasticsearch_host=es
32+
elasticsearch_index_prefix=cws
33+
elasticsearch_port=9200
34+
elasticsearch_use_auth=n
35+
history_level=full
36+
history_days_to_live=30
37+
worker_abandoned_days=1
38+
worker_max_num_running_procs=16
39+
cws_token_expiration_hours=24

.github/ci-test-config.properties

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# CWS test configuration with real services
2+
cws_console_host=cws-console
3+
cws_console_port=38443
4+
db_host=db
5+
db_port=3306
6+
db_user=root
7+
db_password=test
8+
elasticsearch_host=es
9+
elasticsearch_port=9200

.github/ci-worker-config.properties

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
cws_ldap_url_default=ldap://ldapsearch:389
2+
ldap_identity_plugin_class=org.camunda.bpm.identity.impl.ldap.plugin.LdapIdentityProviderPlugin
3+
ldap_security_filter_class=jpl.cws.core.web.CwsLdapSecurityFilter
4+
camunda_security_filter_class=jpl.cws.core.web.CwsCamundaSecurityFilter
5+
auto_accept_config=y
6+
hostname=cws-worker1
7+
install_type=3
8+
database_type=mariadb
9+
database_host=db
10+
database_port=3306
11+
database_name=cws
12+
database_username=root
13+
database_password=test
14+
admin_user=admin
15+
admin_firstname=Admin
16+
admin_lastname=User
17+
18+
cws_web_port=38080
19+
cws_ssl_port=38443
20+
cws_ajp_port=38009
21+
cws_shutdown_port=38005
22+
cws_console_host=cws-console
23+
cws_console_ssl_port=38443
24+
amq_host=cws-console
25+
amq_port=31616
26+
cws_amq_jmx_port=37099
27+
cws_jmx_port=31099
28+
identity_plugin_type=LDAP
29+
cws_ldap_url=ldap://ldapsearch:389
30+
elasticsearch_protocol=http
31+
elasticsearch_host=es
32+
elasticsearch_index_prefix=cws
33+
elasticsearch_port=9200
34+
elasticsearch_use_auth=n
35+
history_level=full
36+
history_days_to_live=30
37+
worker_abandoned_days=1
38+
worker_max_num_running_procs=16
39+
cws_token_expiration_hours=24

.github/workflows/docker-build.yml

+57-28
Original file line numberDiff line numberDiff line change
@@ -102,58 +102,87 @@ jobs:
102102
echo "Using image: ${IMAGE_TAG}"
103103
docker pull ${IMAGE_TAG}
104104
105-
- name: Run tests in container
105+
- name: Set up Docker Compose environment
106106
run: |
107+
# Create a docker network
108+
docker network create cws-network
109+
110+
# Copy the docker-compose file
111+
cp install/docker/console-db-es-ls-kibana/docker-compose.yml docker-compose.test.yml
112+
113+
# Copy config files from the repository
114+
cp .github/ci-console-config.properties config.properties
115+
cp .github/ci-worker-config.properties worker-config.properties
116+
117+
# Create creds directory if it doesn't exist
118+
mkdir -p ~/.cws/creds
119+
120+
# Edit the docker-compose.test.yml to use the built image
107121
IMAGE_TAG="${{ needs.build.outputs.image_digest }}"
122+
sed -i "s|nasa-ammos/common-workflow-service:2.6.0|${IMAGE_TAG}|g" docker-compose.test.yml
123+
124+
- name: Start containers with Docker Compose
125+
run: |
126+
# Start services
127+
docker-compose -f docker-compose.test.yml up -d db es ldapsearch
128+
129+
# Wait for DB to be ready
130+
echo "Waiting for database to be ready..."
131+
timeout 60s bash -c 'until docker exec cws-db mysqladmin -uroot -ptest ping -h localhost; do sleep 2; done'
132+
133+
# Wait for ElasticSearch to be ready
134+
echo "Waiting for Elasticsearch to be ready..."
135+
timeout 90s bash -c 'until curl -s http://localhost:9200/_cluster/health | grep -q "status.*[green|yellow]"; do sleep 3; echo "Still waiting for ES..."; done'
136+
137+
# Start CWS console
138+
docker-compose -f docker-compose.test.yml up -d cws
139+
140+
# Wait for console to be ready
141+
echo "Waiting for CWS console to be ready..."
142+
timeout 120s bash -c 'until curl -k -s https://localhost:38443/cws-ui/login > /dev/null; do sleep 5; echo "Still waiting for console..."; done'
108143
109-
# Create a Docker volume for test results
110-
docker volume create cws-test-results
144+
# Start worker
145+
docker-compose -f docker-compose.test.yml up -d cws-worker
111146
112-
# Run the container with test environment and mount the repository
147+
- name: Create test container
148+
run: |
149+
IMAGE_TAG="${{ needs.build.outputs.image_digest }}"
150+
151+
# Create a test container that's connected to the same network
113152
docker run --name cws-test -d \
114-
-e DB_HOST=mock-db \
115-
-e DB_USER=mockuser \
116-
-e DB_PW=mockpw \
117-
-e ES_PROTOCOL=http \
118-
-e ES_HOST=mock-es \
119-
-e ES_PORT=9200 \
153+
--network cws-network \
120154
-e JAVA_HOME=/usr/lib/jvm/java-openjdk \
121155
-v ${PWD}:/workspace \
122156
-w /workspace \
123157
--entrypoint /bin/bash \
124158
${IMAGE_TAG} -c "tail -f /dev/null"
125159
126-
# Check if container is running
127-
docker ps
128-
129160
# Verify Java setup in the container
130161
docker exec cws-test java -version
131-
docker exec cws-test echo "JAVA_HOME=$JAVA_HOME"
132162
133-
# Install Maven and ensure we have the correct Java version
163+
# Install Maven
134164
docker exec cws-test yum install -y maven
135165
136-
# Verify Java version
137-
docker exec cws-test java -version
138-
139-
# Run simple tests directly in the container
140-
docker exec cws-test bash -c "echo 'Running Java version check'"
141-
docker exec cws-test java -version
142-
143-
# Run Maven tests directly with explicit Java settings
144-
docker exec -w /workspace cws-test bash -c "export JAVA_HOME=/usr/lib/jvm/java-17-openjdk && export PATH=\$JAVA_HOME/bin:\$PATH && mvn -version"
166+
- name: Run tests in test container
167+
run: |
168+
# Copy test configuration file with real service endpoints
169+
cp .github/ci-test-config.properties cws-test/src/test/resources/configuration.properties
145170
146-
# Run unit tests
171+
# Run unit tests
147172
docker exec -w /workspace cws-test bash -c "export JAVA_HOME=/usr/lib/jvm/java-17-openjdk && export PATH=\$JAVA_HOME/bin:\$PATH && mvn -Dmaven.compiler.release=17 -Dmaven.compiler.source=17 -Dmaven.compiler.target=17 clean test jacoco:report-aggregate"
148173
149-
# Run integration tests
150-
docker exec -w /workspace cws-test bash -c "export JAVA_HOME=/usr/lib/jvm/java-17-openjdk && export PATH=\$JAVA_HOME/bin:\$PATH && mvn -Dmaven.compiler.release=17 -Dmaven.compiler.source=17 -Dmaven.compiler.target=17 integration-test verify -DskipTests"
174+
# Run integration tests (without skipping!)
175+
docker exec -w /workspace cws-test bash -c "export JAVA_HOME=/usr/lib/jvm/java-17-openjdk && export PATH=\$JAVA_HOME/bin:\$PATH && mvn -Dmaven.compiler.release=17 -Dmaven.compiler.source=17 -Dmaven.compiler.target=17 integration-test verify"
151176
152177
# Show summary of test results
153178
docker exec -w /workspace cws-test bash -c "find . -name 'surefire-reports' -type d | xargs -I{} cat {}/*.txt 2>/dev/null || echo 'No test reports found'" || true
179+
docker exec -w /workspace cws-test bash -c "find . -name 'failsafe-reports' -type d | xargs -I{} cat {}/*.txt 2>/dev/null || echo 'No test reports found'" || true
154180
155181
- name: Clean up
156182
if: always()
157183
run: |
184+
# Stop and remove all containers
185+
docker-compose -f docker-compose.test.yml down -v
158186
docker stop cws-test || true
159-
docker rm cws-test || true
187+
docker rm cws-test || true
188+
docker network rm cws-network || true

0 commit comments

Comments
 (0)