Test automation with redis sentinels?

Issue summery:
When running docker images from gitlab connectivity against redis from redis sentinels.

Base image maven 3.5 jdk 8
Redis image: latest
Redis sentinel image /self built own config
sql image

App is check out and run as in.

redis failes to find master from time to time. secondary issue seems to be that redis sentinel can use hostnames in configuration to work properly.

We have a application pipeline running over gitlab. And automated system tests that rely on properly configured redis and redis sentinels which fails to find the correct connectivity point for the redis master.
For a while it worked with hardcoded for the master but a while ago that stopped working as well.
So how is this done in the most proper way? Unfortunately we don’t have the knowledge in house and fallen upon me to figure this out.

Looking for
Any suggestion on help on how to configure our project to properly run with redis and redis sentinels. as a part of the build pipeline.

best regards