mirror of
https://github.com/SaraSmiseth/prosody.git
synced 2025-04-19 16:01:14 +00:00
WIP test refactoring, TODO run tests for second prosody container
This commit is contained in:
parent
9055b0ce79
commit
902a76b6ee
5 changed files with 53 additions and 34 deletions
|
@ -89,7 +89,7 @@ ENV __FLUSH_LOG yes
|
||||||
VOLUME ["/usr/local/var/lib/prosody"]
|
VOLUME ["/usr/local/var/lib/prosody"]
|
||||||
|
|
||||||
COPY prosody.cfg.lua /usr/local/etc/prosody/prosody.cfg.lua
|
COPY prosody.cfg.lua /usr/local/etc/prosody/prosody.cfg.lua
|
||||||
COPY docker-entrypoint.sh /entrypoint.sh
|
COPY docker-entrypoint.bash /entrypoint.bash
|
||||||
COPY conf.d/*.cfg.lua /usr/local/etc/prosody/conf.d/
|
COPY conf.d/*.cfg.lua /usr/local/etc/prosody/conf.d/
|
||||||
|
|
||||||
COPY *.bash /usr/local/bin/
|
COPY *.bash /usr/local/bin/
|
||||||
|
@ -110,6 +110,6 @@ RUN download-prosody-modules.bash \
|
||||||
|
|
||||||
USER prosody
|
USER prosody
|
||||||
|
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
ENTRYPOINT ["/entrypoint.bash"]
|
||||||
CMD ["prosody", "-F"]
|
CMD ["prosody", "-F"]
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,23 @@ version: '3.7'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
prosody:
|
prosody:
|
||||||
|
image: prosody
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- "5000:5000"
|
||||||
|
- "5222:5222"
|
||||||
|
- "5223:5223"
|
||||||
|
- "5269:5269"
|
||||||
|
- "5281:5281"
|
||||||
|
environment:
|
||||||
|
DOMAIN: localhost
|
||||||
|
E2E_POLICY_WHITELIST: "admin@localhost, user1@localhost"
|
||||||
|
LOG_LEVEL: debug
|
||||||
|
PROSODY_ADMINS: "admin@localhost, admin2@localhost"
|
||||||
|
volumes:
|
||||||
|
- ./certs:/usr/local/etc/prosody/certs
|
||||||
|
|
||||||
|
prosody_postgres:
|
||||||
image: prosody
|
image: prosody
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
ports:
|
ports:
|
||||||
|
@ -16,17 +33,12 @@ services:
|
||||||
LOG_LEVEL: debug
|
LOG_LEVEL: debug
|
||||||
PROSODY_ADMINS: "admin@localhost, admin2@localhost"
|
PROSODY_ADMINS: "admin@localhost, admin2@localhost"
|
||||||
#DB_DRIVER: "MySQL"
|
#DB_DRIVER: "MySQL"
|
||||||
#DB_DRIVER: "PostgreSQL"
|
DB_DRIVER: "PostgreSQL"
|
||||||
#DB_DATABASE: "prosody"
|
DB_DATABASE: "prosody"
|
||||||
#DB_HOST: "postgres"
|
DB_HOST: "postgres"
|
||||||
#DB_PORT: "5432"
|
DB_PORT: "5432"
|
||||||
#DB_USERNAME: "prosody"
|
DB_USERNAME: "prosody"
|
||||||
#DB_PASSWORD: "prosody"
|
DB_PASSWORD: "prosody"
|
||||||
extra_hosts:
|
|
||||||
- "conference.localhost:127.0.0.1"
|
|
||||||
- "pubsub.localhost:127.0.0.1"
|
|
||||||
- "proxy.localhost:127.0.0.1"
|
|
||||||
- "upload.localhost:127.0.0.1"
|
|
||||||
volumes:
|
volumes:
|
||||||
- ./certs:/usr/local/etc/prosody/certs
|
- ./certs:/usr/local/etc/prosody/certs
|
||||||
depends_on:
|
depends_on:
|
||||||
|
@ -39,5 +51,3 @@ services:
|
||||||
POSTGRES_DB: prosody
|
POSTGRES_DB: prosody
|
||||||
POSTGRES_USER: prosody
|
POSTGRES_USER: prosody
|
||||||
POSTGRES_PASSWORD: prosody
|
POSTGRES_PASSWORD: prosody
|
||||||
#volumes:
|
|
||||||
#- ./postgres-data:/var/lib/postgresql/data
|
|
||||||
|
|
|
@ -15,6 +15,30 @@ generateCert() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
registerTestUsers() {
|
||||||
|
local containerName="$1"
|
||||||
|
sudo docker exec "$containerName" /bin/bash -c "/entrypoint.bash register admin localhost 12345678" \
|
||||||
|
&& sudo docker exec "$containerName" /bin/bash -c "/entrypoint.bash register user1 localhost 12345678" \
|
||||||
|
&& sudo docker exec "$containerName" /bin/bash -c "/entrypoint.bash register user2 localhost 12345678" \
|
||||||
|
&& sudo docker exec "$containerName" /bin/bash -c "/entrypoint.bash register user3 localhost 12345678"
|
||||||
|
}
|
||||||
|
|
||||||
|
runTests() {
|
||||||
|
local containerName="$1"
|
||||||
|
python --version \
|
||||||
|
&& python3 --version \
|
||||||
|
&& python3 -m venv venv \
|
||||||
|
&& source venv/bin/activate \
|
||||||
|
&& python --version \
|
||||||
|
&& pip --version \
|
||||||
|
&& pip install -r requirements.txt \
|
||||||
|
&& pytest \
|
||||||
|
&& deactivate \
|
||||||
|
&& sleep 5 \
|
||||||
|
&& sudo docker-compose logs "$containerName" \
|
||||||
|
&& ./bats/bats-core/bin/bats tests.bats
|
||||||
|
}
|
||||||
|
|
||||||
generateCert "localhost"
|
generateCert "localhost"
|
||||||
generateCert "conference.localhost"
|
generateCert "conference.localhost"
|
||||||
generateCert "proxy.localhost"
|
generateCert "proxy.localhost"
|
||||||
|
@ -25,24 +49,9 @@ generateCert "upload.localhost"
|
||||||
sudo docker-compose down \
|
sudo docker-compose down \
|
||||||
&& sudo docker-compose up -d postgres \
|
&& sudo docker-compose up -d postgres \
|
||||||
&& sleep 10 \
|
&& sleep 10 \
|
||||||
&& sudo docker-compose up -d \
|
&& sudo docker-compose up -d prosody_postgres
|
||||||
\
|
|
||||||
&& sudo docker exec tests_prosody_1 /bin/bash -c "/entrypoint.sh register admin localhost 12345678" \
|
registerTestUsers tests_prosody_postgres_1
|
||||||
&& sudo docker exec tests_prosody_1 /bin/bash -c "/entrypoint.sh register user1 localhost 12345678" \
|
runTests prosody_postgres
|
||||||
&& sudo docker exec tests_prosody_1 /bin/bash -c "/entrypoint.sh register user2 localhost 12345678" \
|
|
||||||
&& sudo docker exec tests_prosody_1 /bin/bash -c "/entrypoint.sh register user3 localhost 12345678" \
|
|
||||||
\
|
|
||||||
&& python --version \
|
|
||||||
&& python3 --version \
|
|
||||||
&& python3 -m venv venv \
|
|
||||||
&& source venv/bin/activate \
|
|
||||||
&& python --version \
|
|
||||||
&& pip --version \
|
|
||||||
&& pip install -r requirements.txt \
|
|
||||||
&& pytest \
|
|
||||||
&& deactivate \
|
|
||||||
&& sleep 5 \
|
|
||||||
&& sudo docker-compose logs \
|
|
||||||
&& ./bats/bats-core/bin/bats tests.bats
|
|
||||||
|
|
||||||
sudo docker-compose down
|
sudo docker-compose down
|
||||||
|
|
Loading…
Reference in a new issue