Skip to content

Commit dd489da

Browse files
chore(ZMSKVR): update unit tests to run in local web container instead of detecting podman or docker environment (#1710)
* chore(ZMSKVR): simplify test scripts * chore(ZMSKVR): update documentation * clean(ZMSKVR-1124): Add validation for required environment variables in test scripts * clean(ZMSKVR-1124): Use environment variable for MySQL root password instead of hardcoded credential * docs(ZMSKVR-1124): Clarify PHPUnit filter matches against full namespace path * clean(ZMSKVR-1124): Update terminology from 'container caches' to 'caches' * clean(ZMSKVR-1124): Add CACHE_DIR to required environment variable validation * clean(ZMSKVR-1124): Add warning when fixture copy fails instead of silent suppression * clean(ZMSKVR-1124): Remove redundant auto_prepend_file directive from importTestData calls * feat(ZMSKVR-1124): Add rainbow section colors to test scripts * clean(ZMSKVR-1124): Refactor zmsapiautomation-test to run natively in devcontainer - Install Java 17 (Temurin), Maven 3.9.6, and Flyway 9.22.3 directly in Containerfile - Remove podman/docker detection and external container execution from test script - Add git safe directory configuration to postStartCommand - Simplify test script from ~690 lines to ~274 lines * clean(ZMSKVR-1124): Add Java, Maven, and Flyway to DDEV web container - Create web-build/Dockerfile with Temurin JDK 17, Maven 3.9.6, Flyway 9.22.3 - Add git safe directory configuration to post-start hooks - Enables zmsapiautomation-test to run natively in DDEV environment * clean(ZMSKVR-1124): timezone consistency and vendor/bin permissions - Add OS-level timezone (TZ=Europe/Berlin) to DDEV web-build/Dockerfile - Add TZ environment variable to DDEV config.yaml - Fix vendor/bin permissions after composer install in cli script - Update Maven to 3.9.9 in dev container (fixes 404 on old version) * clean(ZMSKVR-1124): make DB_HOST configurable via MYSQL_HOST env var - Use MYSQL_HOST environment variable with 'db' fallback - Keeps DB_HOST and DB_NAME properly separated - Addresses CodeRabbit suggestion for consistency * chore(ZMSKVR-1124): upgrade to Java 21 LTS and add checksum verification - Upgrade Java 17 → 21 (current LTS, supported until 2031) - Add SHA512 checksum verification for Maven downloads - Add SHA1 checksum verification for Flyway downloads - Update pom.xml compiler target to Java 21 * fix(ZMSKVR-1124): update GitHub Actions to use Java 21 Maven image - Change maven:3.9-eclipse-temurin-17 → maven:3.9-eclipse-temurin-21 - Matches pom.xml target version after Java 21 upgrade * fix(ZMSKVR-1124): remove unused MAVEN_SHA512 ARG - The ARG was never used; actual verification downloads .sha512 from Apache - Removes confusing placeholder checksum that CodeRabbit flagged * docs(ZMSKVR-1124): update zmsapiautomation-test documentation - Clarify that script must be run from inside container - Update environment configuration for native container execution - Simplify Maven direct execution examples * chore(ZMSKVR): upgrade maven and flyway version * chore(ZMSKVR): upgrade maven and flyway version * chore(ZMSKVR): upgrade maven and flyway version * docs(ZMSKVR-1124): add MYSQL_PORT format documentation in test scripts - Add inline comment explaining MYSQL_PORT format (tcp://host:port or port) - Clarifies the parameter expansion ${MYSQL_PORT##*:} usage * docs(ZMSKVR): update test docs --------- Co-authored-by: ThomasAFink <thomas.fink@muenchen.de>
1 parent 6802208 commit dd489da

File tree

11 files changed

+406
-1053
lines changed

11 files changed

+406
-1053
lines changed

.ddev/config.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ database:
1111
version: "10.4"
1212
use_dns_when_possible: true
1313
composer_version: "2"
14-
web_environment: []
14+
web_environment:
15+
- TZ=Europe/Berlin
1516
nodejs_version: "18"
1617
hooks:
1718
pre-start:
@@ -20,6 +21,7 @@ hooks:
2021
- exec: "sed -i 's/^pm\\.max_children.*/pm.max_children = 30/' /etc/php/*/fpm/pool.d/www.conf && supervisorctl restart php-fpm"
2122
- exec: "curl -sSL -o zmsadmin/changelog_build.md https://raw.githubusercontent.com/it-at-m/eappointment/main/CHANGELOG.md"
2223
- exec: "curl -sSL -o zmsstatistic/changelog_build.md https://raw.githubusercontent.com/it-at-m/eappointment/main/CHANGELOG.md"
24+
- exec: "git config --global --add safe.directory /var/www/html"
2325

2426
timezone: Europe/Berlin
2527

.ddev/web-build/Dockerfile

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Custom Dockerfile additions for DDEV web container
2+
# Installs Java 21, Maven, and Flyway for zmsapiautomation tests
3+
4+
# Set timezone at OS level (matches dev container)
5+
ENV TZ=Europe/Berlin
6+
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
7+
8+
# Install Java 21 (Eclipse Temurin LTS)
9+
RUN wget -O - https://packages.adoptium.net/artifactory/api/gpg/key/public | gpg --dearmor | tee /etc/apt/trusted.gpg.d/adoptium.gpg > /dev/null \
10+
&& echo "deb [signed-by=/etc/apt/trusted.gpg.d/adoptium.gpg] https://packages.adoptium.net/artifactory/deb $(awk -F= '/^VERSION_CODENAME/{print $2}' /etc/os-release) main" | tee /etc/apt/sources.list.d/adoptium.list \
11+
&& apt-get update && apt-get install -y temurin-21-jdk \
12+
&& apt-get clean && rm -rf /var/lib/apt/lists/*
13+
14+
# Configure JAVA_HOME and PATH for all shells
15+
RUN echo "export JAVA_HOME=/usr/lib/jvm/temurin-21-jdk-$(dpkg --print-architecture)" > /etc/profile.d/java.sh \
16+
&& echo "export PATH=\"\${JAVA_HOME}/bin:\${PATH}\"" >> /etc/profile.d/java.sh \
17+
&& chmod +x /etc/profile.d/java.sh
18+
19+
# Create symlinks for java and javac in /usr/local/bin
20+
RUN JAVA_HOME="/usr/lib/jvm/temurin-21-jdk-$(dpkg --print-architecture)" \
21+
&& update-alternatives --install /usr/bin/java java "${JAVA_HOME}/bin/java" 1 \
22+
&& update-alternatives --install /usr/bin/javac javac "${JAVA_HOME}/bin/javac" 1
23+
24+
# Install Maven with checksum verification
25+
ARG MAVEN_VERSION=3.9.12
26+
RUN wget -q https://archive.apache.org/dist/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz -P /tmp \
27+
&& wget -q https://archive.apache.org/dist/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz.sha512 -P /tmp \
28+
&& echo "$(cat /tmp/apache-maven-${MAVEN_VERSION}-bin.tar.gz.sha512) /tmp/apache-maven-${MAVEN_VERSION}-bin.tar.gz" | sha512sum -c - \
29+
&& tar xf /tmp/apache-maven-${MAVEN_VERSION}-bin.tar.gz -C /opt \
30+
&& mv /opt/apache-maven-${MAVEN_VERSION} /opt/maven \
31+
&& rm /tmp/apache-maven-${MAVEN_VERSION}-bin.tar.gz /tmp/apache-maven-${MAVEN_VERSION}-bin.tar.gz.sha512 \
32+
&& ln -s /opt/maven/bin/mvn /usr/local/bin/mvn
33+
34+
# Install Flyway CLI with checksum verification
35+
ARG FLYWAY_VERSION=11.1.1
36+
RUN wget -q -O /tmp/flyway.tar.gz https://repo1.maven.org/maven2/org/flywaydb/flyway-commandline/${FLYWAY_VERSION}/flyway-commandline-${FLYWAY_VERSION}-linux-x64.tar.gz \
37+
&& wget -q -O /tmp/flyway.tar.gz.sha1 https://repo1.maven.org/maven2/org/flywaydb/flyway-commandline/${FLYWAY_VERSION}/flyway-commandline-${FLYWAY_VERSION}-linux-x64.tar.gz.sha1 \
38+
&& echo "$(cat /tmp/flyway.tar.gz.sha1) /tmp/flyway.tar.gz" | sha1sum -c - \
39+
&& tar xzf /tmp/flyway.tar.gz -C /opt \
40+
&& mv /opt/flyway-${FLYWAY_VERSION} /opt/flyway \
41+
&& rm /tmp/flyway.tar.gz /tmp/flyway.tar.gz.sha1 \
42+
&& ln -s /opt/flyway/flyway /usr/local/bin/flyway
43+

.devcontainer/Containerfile

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,49 @@ RUN curl -sS https://getcomposer.org/installer | php \
5858
&& mv composer.phar /usr/local/bin/composer
5959

6060
# —————————————————————————————————————————
61-
# 8. Set working directory & permissions
61+
# 8. Install Java 21 (Eclipse Temurin LTS) & Maven
62+
# —————————————————————————————————————————
63+
RUN apt-get update && apt-get install -y gnupg \
64+
&& curl -fsSL https://packages.adoptium.net/artifactory/api/gpg/key/public | gpg --dearmor -o /usr/share/keyrings/adoptium.gpg \
65+
&& echo "deb [signed-by=/usr/share/keyrings/adoptium.gpg] https://packages.adoptium.net/artifactory/deb $(. /etc/os-release && echo $VERSION_CODENAME) main" \
66+
> /etc/apt/sources.list.d/adoptium.list \
67+
&& apt-get update && apt-get install -y temurin-21-jdk \
68+
&& apt-get clean \
69+
&& echo "export JAVA_HOME=/usr/lib/jvm/temurin-21-jdk-$(dpkg --print-architecture)" >> /etc/profile.d/java.sh \
70+
&& echo 'export PATH="$JAVA_HOME/bin:$PATH"' >> /etc/profile.d/java.sh \
71+
&& ln -sf /usr/lib/jvm/temurin-21-jdk-$(dpkg --print-architecture)/bin/java /usr/local/bin/java \
72+
&& ln -sf /usr/lib/jvm/temurin-21-jdk-$(dpkg --print-architecture)/bin/javac /usr/local/bin/javac
73+
74+
# Install Maven with checksum verification (downloads .sha512 from Apache)
75+
ARG MAVEN_VERSION=3.9.12
76+
RUN curl -fsSL -o /tmp/maven.tar.gz https://archive.apache.org/dist/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz \
77+
&& curl -fsSL -o /tmp/maven.tar.gz.sha512 https://archive.apache.org/dist/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz.sha512 \
78+
&& echo "$(cat /tmp/maven.tar.gz.sha512) /tmp/maven.tar.gz" | sha512sum -c - \
79+
&& tar -xzf /tmp/maven.tar.gz -C /opt \
80+
&& ln -s /opt/apache-maven-${MAVEN_VERSION}/bin/mvn /usr/local/bin/mvn \
81+
&& rm -f /tmp/maven.tar.gz /tmp/maven.tar.gz.sha512
82+
83+
# —————————————————————————————————————————
84+
# 9. Install Flyway CLI with checksum verification
85+
# —————————————————————————————————————————
86+
ARG FLYWAY_VERSION=11.1.1
87+
RUN curl -fsSL -o /tmp/flyway.tar.gz https://repo1.maven.org/maven2/org/flywaydb/flyway-commandline/${FLYWAY_VERSION}/flyway-commandline-${FLYWAY_VERSION}-linux-x64.tar.gz \
88+
&& curl -fsSL -o /tmp/flyway.tar.gz.sha1 https://repo1.maven.org/maven2/org/flywaydb/flyway-commandline/${FLYWAY_VERSION}/flyway-commandline-${FLYWAY_VERSION}-linux-x64.tar.gz.sha1 \
89+
&& echo "$(cat /tmp/flyway.tar.gz.sha1) /tmp/flyway.tar.gz" | sha1sum -c - \
90+
&& tar -xzf /tmp/flyway.tar.gz -C /opt \
91+
&& ln -s /opt/flyway-${FLYWAY_VERSION}/flyway /usr/local/bin/flyway \
92+
&& rm -f /tmp/flyway.tar.gz /tmp/flyway.tar.gz.sha1
93+
94+
# —————————————————————————————————————————
95+
# 10. Set working directory & permissions
6296
# —————————————————————————————————————————
6397
WORKDIR /var/www/html
6498

6599
RUN chown -R www-data:www-data /var/www/html \
66100
&& chmod -R 755 /var/www/html
67101

68102
# —————————————————————————————————————————
69-
# 9. Expose
103+
# 11. Expose
70104
# —————————————————————————————————————————
71105
EXPOSE 80
72106

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"postStartCommand": [
2020
// "bash", "-c", "curl -sSL -o zmsadmin/changelog_build.md https://raw.githubusercontent.com/it-at-m/eappointment/main/CHANGELOG.md",
2121
// "bash", "-c", "curl -sSL -o zmsstatistic/changelog_build.md https://raw.githubusercontent.com/it-at-m/eappointment/main/CHANGELOG.md",
22-
"bash", "-c", "for dir in zmsadmin zmsapi zmscalldisplay zmscitizenapi zmsstatistic zmsticketprinter; do mkdir -p /var/www/html/$dir/cache && chmod 777 /var/www/html/$dir/cache; done"
22+
"bash", "-c", "git config --global --add safe.directory '*' && for dir in zmsadmin zmsapi zmscalldisplay zmscitizenapi zmsstatistic zmsticketprinter; do mkdir -p /var/www/html/$dir/cache && chmod 777 /var/www/html/$dir/cache; done"
2323
],
2424
"runServices": ["web", "db", "phpmyadmin", "refarch-gateway", "keycloak", "init-keycloak"]
2525
}

.github/workflows/zmsautomation-tests.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ jobs:
241241
uses: actions/cache@v4
242242
with:
243243
path: /tmp/maven-image.tar
244-
key: ${{ runner.os }}-maven-image-3.9-eclipse-temurin-17
244+
key: ${{ runner.os }}-maven-image-3.9-eclipse-temurin-21
245245

246246
- name: Load or pull Maven Docker image
247247
run: |
@@ -250,9 +250,9 @@ jobs:
250250
docker load -i /tmp/maven-image.tar
251251
else
252252
echo "Pulling Maven Docker image..."
253-
docker pull maven:3.9-eclipse-temurin-17
253+
docker pull maven:3.9-eclipse-temurin-21
254254
echo "Saving Maven Docker image for future runs..."
255-
docker save maven:3.9-eclipse-temurin-17 -o /tmp/maven-image.tar
255+
docker save maven:3.9-eclipse-temurin-21 -o /tmp/maven-image.tar
256256
fi
257257
258258
- name: Cache Maven dependencies
@@ -271,7 +271,7 @@ jobs:
271271
-v "$PWD:/workspace" \
272272
-v "$HOME/.m2:/root/.m2" \
273273
-w /workspace/zmsapiautomation \
274-
maven:3.9-eclipse-temurin-17 mvn spotless:check
274+
maven:3.9-eclipse-temurin-21 mvn spotless:check
275275
276276
- name: Run REST-assured tests
277277
run: |
@@ -283,7 +283,7 @@ jobs:
283283
-v "$PWD:/workspace" \
284284
-v "$HOME/.m2:/root/.m2" \
285285
-w /workspace/zmsapiautomation \
286-
maven:3.9-eclipse-temurin-17 mvn -B -DtrimStackTrace=false test
286+
maven:3.9-eclipse-temurin-21 mvn -B -DtrimStackTrace=false test
287287
288288
- name: Upload surefire reports
289289
if: always()

README.md

Lines changed: 57 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -362,90 +362,85 @@ bin/importTestData --commit
362362
```
363363

364364
#### Containerized Testing (Recommended - isolated environment)
365-
To run isolated, repeatable tests without touching your local database, use Docker Compose:
366365

367-
**Smart Testing Scripts (Recommended):**
366+
Run your tests in clean, disposable containers to ensure they don’t affect your local system or database:
367+
368368
```bash
369-
# For zmsdb
370-
cd zmsdb
371-
./zmsdb-test # Run all tests
372-
./zmsdb-test --filter="StatusTest::testBasic" # Run specific test
373-
./zmsdb-test --reset # Reset all containers and volumes
369+
# Enter your web container
370+
podman exec -it zms-web bash # Podman
371+
ddev ssh # DDEV
374372

375-
# For zmsapi
376-
cd zmsapi
377-
./zmsapi-test # Run all tests
378-
./zmsapi-test --filter="StatusGetTest::testRendering" # Run specific test
379-
./zmsapi-test --reset # Reset all containers and volumes
373+
# Run zmsdb tests
374+
./zmsdb/zmsdb-test # Run all tests
375+
./zmsdb/zmsdb-test --filter="StatusTest::testBasic" # Run specific test
376+
377+
# Run zmsapi tests
378+
./zmsapi/zmsapi-test # Run all tests
379+
./zmsapi/zmsapi-test --filter="StatusGetTest::testRendering" # Run specific test
380380
```
381381

382382
**Available PHPUnit Flags:**
383+
383384
```bash
384-
# Test Selection
385-
--filter="TestClass::testMethod" # Run specific test method
386-
--filter="TestClass" # Run all tests in a class
387-
--filter="testMethod" # Run all tests with matching method name
388-
--filter="pattern" # Run tests matching regex pattern
385+
# Test Selection (filter is a regex matching against "Namespace\TestClass::testMethod")
386+
--filter="TestClass::testMethod" # Run specific test method
387+
--filter="TestClass" # Run all tests in a class
388+
--filter="testMethod" # Run all tests with matching method name
389+
--filter="pattern" # Run tests matching regex pattern
389390

390391
# Output & Verbosity
391-
--verbose # More detailed output
392-
--debug # Debug information
393-
--stop-on-failure # Stop on first failure
394-
--stop-on-error # Stop on first error
395-
--stop-on-warning # Stop on first warning
392+
--verbose # More detailed output
393+
--debug # Debug information
394+
--stop-on-failure # Stop on first failure
395+
--stop-on-error # Stop on first error
396+
--stop-on-warning # Stop on first warning
396397

397398
# Coverage & Reports
398-
--coverage-text # Text coverage report
399+
--coverage-text # Text coverage report
399400
--coverage-html=dir # HTML coverage report
400401
--coverage-clover=file.xml # XML coverage report
401402

402403
# Test Execution
403-
--group="groupName" # Run tests in specific group
404-
--exclude-group="groupName" # Exclude tests in group
405-
--testsuite="suiteName" # Run specific test suite
404+
--group="groupName" # Run tests in specific group
405+
--exclude-group="groupName" # Exclude tests in group
406+
--testsuite="suiteName" # Run specific test suite
406407
```
407408

408409
**Examples:**
410+
409411
```bash
410412
# Run specific test with verbose output
411-
./zmsdb-test --filter="StatusTest::testBasic" --verbose
413+
bash zmsdb-test --filter="StatusTest::testBasic" --verbose
412414

413415
# Run all tests in a class and stop on first failure
414-
./zmsapi-test --filter="StatusGetTest" --stop-on-failure
416+
bash zmsapi-test --filter="StatusGetTest" --stop-on-failure
415417

416418
# Run tests with coverage report
417-
./zmsdb-test --coverage-text
419+
bash zmsdb-test --coverage-text
418420

419421
# Run tests excluding a specific group
420-
./zmsapi-test --exclude-group="slow"
422+
bash zmsapi-test --exclude-group="slow"
421423
```
422424

423-
**How the Scripts Work:**
424-
* **First run**: Automatically detects and does full setup (builds containers, installs dependencies)
425-
* **Subsequent runs**: Reuses existing setup for fast test execution
426-
* **Filter support**: Accepts all PHPUnit arguments for flexible test execution
427-
* **DB startup**: Automatically starts MariaDB; if the host port is in use, adjust the compose ports mapping.
428-
429-
**Reset Functionality:**
430-
* **`--reset`**: Completely removes all containers, volumes, and networks for a fresh start
431-
* **Use when**: You want to clear all cached dependencies and start completely fresh
432-
* **What it does**: Runs `docker-compose down -v` to remove everything
433-
* **After reset**: Next run will be treated as a "first run" with full setup
434-
435425
### API Testing (zmsapiautomation)
436426

437427
**zmsapiautomation** provides Java REST-assured based API tests for ZMS APIs. These tests validate the REST API endpoints directly.
438428

439429
**Using the test runner script (Recommended):**
440430

441-
The `zmsapiautomation-test` script automatically handles database setup, migrations, and test execution:
431+
The `zmsapiautomation-test` script must be run from inside the container. It automatically handles database setup, migrations, and test execution:
442432

443433
```bash
434+
# Enter your web container first
435+
podman exec -it zms-web bash # Podman
436+
ddev ssh # DDEV
437+
438+
# Run zmsapiautomation tests
444439
cd zmsapiautomation
445-
./zmsapiautomation-test # Run all tests
446-
./zmsapiautomation-test -Dtest=StatusEndpointTest # Run specific test class
447-
./zmsapiautomation-test -Dtest=StatusEndpointTest#statusEndpointShouldBeOk # Run specific test method
448-
./zmsapiautomation-test -Dtest=*EndpointTest # Run all tests matching pattern
440+
bash zmsapiautomation-test # Run all tests
441+
bash zmsapiautomation-test -Dtest=StatusEndpointTest # Run specific test class
442+
bash zmsapiautomation-test -Dtest=StatusEndpointTest#statusEndpointShouldBeOk # Run specific test method
443+
bash zmsapiautomation-test -Dtest=*EndpointTest # Run all tests matching pattern
449444
```
450445

451446
**Maven Test Filtering:**
@@ -454,33 +449,33 @@ The script supports Maven Surefire test filtering using the `-Dtest` parameter:
454449

455450
```bash
456451
# Run a specific test class
457-
./zmsapiautomation-test -Dtest=StatusEndpointTest
452+
bash zmsapiautomation-test -Dtest=StatusEndpointTest
458453

459454
# Run a specific test method
460-
./zmsapiautomation-test -Dtest=StatusEndpointTest#statusEndpointShouldBeOk
455+
bash zmsapiautomation-test -Dtest=StatusEndpointTest#statusEndpointShouldBeOk
461456

462457
# Run multiple test classes
463-
./zmsapiautomation-test -Dtest=StatusEndpointTest,OfficesAndServicesEndpointTest
458+
bash zmsapiautomation-test -Dtest=StatusEndpointTest,OfficesAndServicesEndpointTest
464459

465460
# Run tests matching a pattern
466-
./zmsapiautomation-test -Dtest=*EndpointTest
461+
bash zmsapiautomation-test -Dtest=*EndpointTest
467462

468463
# Run tests with additional Maven options
469-
./zmsapiautomation-test -Dtest=StatusEndpointTest -Dmaven.test.failure.ignore=true
464+
bash zmsapiautomation-test -Dtest=StatusEndpointTest -Dmaven.test.failure.ignore=true
470465
```
471466

472467
**Environment Configuration:**
473468

474-
The script automatically detects Podman or DDEV environments and sets appropriate defaults:
469+
The script runs natively inside the container and uses environment variables. Default endpoints:
475470

476-
- **Podman**: Uses `http://zms-web/terminvereinbarung/api/2` for BASE_URI
477-
- **DDEV**: Uses `http://web/terminvereinbarung/api/2` for BASE_URI
471+
- `BASE_URI`: `http://localhost/terminvereinbarung/api/2`
472+
- `CITIZEN_API_BASE_URI`: `http://localhost/terminvereinbarung/api/citizen`
478473

479474
You can override these defaults:
480475

481476
```bash
482-
BASE_URI=http://localhost:8080/terminvereinbarung/api/2 ./zmsapiautomation-test
483-
CITIZEN_API_BASE_URI=http://localhost:8080/terminvereinbarung/api/citizen ./zmsapiautomation-test
477+
BASE_URI=http://localhost/terminvereinbarung/api/2 bash zmsapiautomation-test
478+
CITIZEN_API_BASE_URI=http://localhost/terminvereinbarung/api/citizen bash zmsapiautomation-test
484479
```
485480

486481
**What the Script Does:**
@@ -503,17 +498,17 @@ CITIZEN_API_BASE_URI=http://localhost:8080/terminvereinbarung/api/citizen ./zmsa
503498
To import Munich DLDB data during test setup:
504499

505500
```bash
506-
ZMS_CRONROOT=1 ZMS_SOURCE_DLDB_MUNICH="<munich-source-url>" ./zmsapiautomation-test
501+
ZMS_CRONROOT=1 ZMS_SOURCE_DLDB_MUNICH="<munich-source-url>" bash zmsapiautomation-test
507502
```
508503

509-
**Running Tests Directly with Maven:**
504+
**Running Tests Directly with Maven (inside container):**
510505

511-
For local development without the full setup script:
506+
For development without the full setup script (assumes database is already prepared):
512507

513508
```bash
514509
cd zmsapiautomation
515-
mvn test -DBASE_URI=http://localhost:8080/terminvereinbarung/api/2
516-
mvn test -Dtest=StatusEndpointTest -DBASE_URI=http://localhost:8080/terminvereinbarung/api/2
510+
mvn test
511+
mvn test -Dtest=StatusEndpointTest
517512
```
518513

519514
**References:**

cli

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ def cli_modules_loop(commands):
142142
specific_modules = ["zmsadmin", "zmscalldisplay", "zmsstatistic", "zmsticketprinter"]
143143

144144
is_npm_command = commands[0] == "npm"
145+
is_composer_install = len(commands) >= 2 and commands[0] == "composer" and commands[1] == "install"
145146

146147
build_commands = {
147148
"zmsadmin": ["npm run build"],
@@ -166,6 +167,15 @@ def cli_modules_loop(commands):
166167
os.system(build_command)
167168
else:
168169
os.system(" ".join(commands))
170+
171+
# Fix vendor/bin permissions after composer install
172+
if is_composer_install:
173+
vendor_bin = os.path.join(module_dir, "vendor", "bin")
174+
if os.path.isdir(vendor_bin):
175+
for script in os.listdir(vendor_bin):
176+
script_path = os.path.join(vendor_bin, script)
177+
if os.path.isfile(script_path):
178+
os.chmod(script_path, 0o755)
169179

170180

171181
if __name__ == "__main__":

0 commit comments

Comments
 (0)