Build issues at :test:test > Executing test org.openremote.test.custom.CustomTest

So, I have made a custom project, and I dont know what has happened, or what I might have changed, from my knowledge I havent changed anything in the project. Except for restarting my computer. When running gradlew clean build installDist and I get stuck at this:


I have let this sit for more then 30 minutes when doing other things, but I have absolutely no clue whats causing this error. Any ideas or suggestions on what I can do to fix it? I have tried to run keycloak manually through docker and then running gradlew clean build installDist and its still not being able to create a connection and build the custom project.

I can add that I have tried to create multiple custom-projects and I have the same issue in both of them. So either its on my end or something has happened with recent updates? I am also getting this issue in a github pipeline where I am trying to build a deployment image (image of my custom deployment).

Hi!

For context; The test task is included in the build task.

When working on the project locally, we tend to skip the build step,
and simply run gradlew clean installDist to verify if everything compiles.

Also worth adding; tests are more likely to fail on a local machine,
compared to an isolated pipeline. For example, I regularly get failed tests myself.

Because, have you updated the OpenRemote submodule of your custom project?

Oh, forgot to mention; During the test task,
you’re required to have a running Keycloak- and PostgreSQL container in Docker.
Otherwise, we cannot test anything :wink:

I had this docker-compose file running:

version: '2.4'

volumes:
  proxy-data:
  deployment-data:
  postgresql-data:
  manager-data:

services:

  # This service will only populate an empty volume on startup and then exit.
  # If the volume already contains data, it exits immediately.
  deployment:
    image: openremote/deployment:1337  #{DEPLOYMENT_VERSION}
    volumes:
      - deployment-data:/deployment

  proxy:
    image: openremote/proxy:${PROXY_VERSION:-latest}
    restart: always
    depends_on:
      manager:
        condition: service_healthy
    ports:
      - "80:80"
      - "443:443"
      - "8883:8883"  # Secure MQTT
      - "1883:1883"  # Unencrypted MQTT
    volumes:
      - proxy-data:/deployment
      - deployment-data:/data
      - ./haproxy.cfg:/data/proxy/haproxy.cfg  # Mount custom HAProxy config
      - ./certs:/etc/haproxy/certs  # Mount self-signed certificates
    environment:
      DOMAINNAME: localhost  # Set to 'localhost'
      HAPROXY_CONFIG: '/data/proxy/haproxy.cfg'
      OR_USE_SELF_SIGNED_CERTS: true
      OR_DEV_MODE: false  # Disable development mode
      # Keep Let's Encrypt variables for future use
      # LE_EMAIL: your-email@example.com
      # DOMAINNAMES: additional.domain.com

  postgresql:
    image: openremote/postgresql:${POSTGRESQL_VERSION:-latest}
    restart: always
    volumes:
      - postgresql-data:/var/lib/postgresql/data
      - manager-data:/storage

  keycloak:
    image: openremote/keycloak:${KEYCLOAK_VERSION:-latest}
    restart: always
    depends_on:
      postgresql:
        condition: service_healthy
    volumes:
      - deployment-data:/deployment
      - ./deployment/keycloak/themes:/deployment/keycloak/themes
    environment:
      KEYCLOAK_ADMIN_PASSWORD: verysecret
      KC_HOSTNAME: localhost  # 'localhost' for local development
      KC_HOSTNAME_PORT: -1

  manager:
    image: openremote/manager:latest #1337 #${MANAGER_VERSION:-latest}
    restart: always
    depends_on:
      keycloak:
        condition: service_healthy
    volumes:
      - manager-data:/storage
      - deployment-data:/deployment
      - ./deployment/map:/deployment/map
    environment:
      OR_ADMIN_PASSWORD: verysecret
      OR_HOSTNAME: localhost
      OR_DEV_MODE: false  # Disable development mode
      OR_SETUP_TYPE: # Typical values to support are staging and production
      OR_SETUP_RUN_ON_RESTART:
      OR_EMAIL_HOST:
      OR_EMAIL_USER:
      OR_EMAIL_PASSWORD:
      OR_EMAIL_X_HEADERS:
      OR_EMAIL_FROM:
      OR_EMAIL_ADMIN:
      OR_ADDITIONAL_HOSTNAMES: ${OR_ADDITIONAL_HOSTNAMES:-}
      OR_SSL_PORT: ${OR_SSL_PORT:--1}
      MAP_TILES_PATH: /deployment/map/mapdata.mbtiles
      MAP_SETTINGS_PATH: /deployment/map/mapsettings.json

When attempting to run it with the build task.

I am new to git submodules, but I did run git submodule add -b master https://github.com/openremote/openremote.git openremote/ if thats what you meant with updating the submodule?

For local testing we recommend to use the ‘dev-testing’ docker compose profile.
This is because only PostgreSQL and Keycloak should be running in Docker during tests. :wink:
The file is located in the /profile folder of the git repository.
As stated in the docs, you’d use docker-compose run -f profile/dev-testing.yml up -d.

Yes you’ve added the submodule correctly.
You can update to the latest version of OpenRemote using git submodule update --remote.
This checks the OpenRemote repository, and updates your /openremote folder to the latest version.

The reason why I asked, is to make sure you’re not running a version of 2 years ago :joy:

I have solved it. Thanks for taking your time to help me out!

2 Likes