Skip to content

Commit

Permalink
tests: run development server on port 8000 (#1125)
Browse files Browse the repository at this point in the history
Instead of running the dev server on port 8080 inside docker and expose
it externally on port 9090.
  • Loading branch information
azmeuk authored May 17, 2024
1 parent d86cbee commit 8bb4227
Show file tree
Hide file tree
Showing 15 changed files with 27 additions and 27 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ help:

# Démarre le serveur de test
start:
(sleep 15 ; open http://localhost:9090) &
python3 manage.py runserver localhost:9090 --insecure
(sleep 15 ; open http://localhost:8000) &
python3 manage.py runserver localhost:8000 --insecure
# --insecure let serve static files even when DEBUG=False

# Démarre le serveur de test en https auto-signé
starts:
# nécessite les django-extensions
# cf https://timonweb.com/django/https-django-development-server-ssl-certificate/
(sleep 15 ; open https://localhost:9090) &
python3 manage.py runserver_plus localhost:9090 --cert-file cert.pem --key-file key.pem
(sleep 15 ; open https://localhost:8000) &
python3 manage.py runserver_plus localhost:8000 --cert-file cert.pem --key-file key.pem

# Première installation de pod (BDD SQLite intégrée)
install:
Expand Down
2 changes: 1 addition & 1 deletion docker-compose-dev-with-volumes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ services:
env_file:
- ./.env.dev
ports:
- 9090:8080
- 8000:8000
volumes: *pod-volumes

elasticsearch:
Expand Down
2 changes: 1 addition & 1 deletion docker-compose-full-dev-with-volumes-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ services:
env_file:
- ./.env.dev
ports:
- 9090:8080
- 8000:8000
volumes: *pod-volumes

pod-encode:
Expand Down
2 changes: 1 addition & 1 deletion docker-compose-full-dev-with-volumes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ services:
env_file:
- ./.env.dev
ports:
- 9090:8080
- 8000:8000
volumes: *pod-volumes

pod-encode:
Expand Down
2 changes: 1 addition & 1 deletion dockerfile-dev-with-volumes/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ Vous devriez obtenir ce message une fois esup-pod lancé
----
$ pod-dev-with-volumes | Superuser created successfully.
----
L'application esup-pod est dès lors disponible via cette URL : localhost:9090
L'application esup-pod est dès lors disponible via cette URL : localhost:8000

=== Arrêt de la stack
$ CTRL+C dans la fenetre depuis laquelle l'application esup-pod a été lancée
Expand Down
10 changes: 5 additions & 5 deletions dockerfile-dev-with-volumes/pa11y-ci/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
]
},
"urls": [
"http://pod-back:8080/",
"http://pod-back:8080/accounts/login",
"http://pod-back:8080/videos",
"http://pod-back:8080/video/0001-video-test/",
"http://pod-back:8080/live/events/"
"http://pod-back:8000/",
"http://pod-back:8000/accounts/login",
"http://pod-back:8000/videos",
"http://pod-back:8000/video/0001-video-test/",
"http://pod-back:8000/live/events/"
]
}
10 changes: 5 additions & 5 deletions dockerfile-dev-with-volumes/pa11y-ci/config_mobile.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
]
},
"urls": [
"http://pod-back:8080/",
"http://pod-back:8080/accounts/login",
"http://pod-back:8080/videos",
"http://pod-back:8080/video/0001-video-test/",
"http://pod-back:8080/live/events/"
"http://pod-back:8000/",
"http://pod-back:8000/accounts/login",
"http://pod-back:8000/videos",
"http://pod-back:8000/video/0001-video-test/",
"http://pod-back:8000/live/events/"
]
}
2 changes: 1 addition & 1 deletion dockerfile-dev-with-volumes/pod-back/my-entrypoint-back.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ fi
# Le serveur de développement permet de tester vos futures modifications facilement.
# N'hésitez pas à lancer le serveur de développement pour vérifier vos modifications au fur et à mesure.
# À ce niveau, vous devriez avoir le site en français et en anglais et voir l'ensemble de la page d'accueil.
python3 manage.py runserver 0.0.0.0:8080 --insecure
python3 manage.py runserver 0.0.0.0:8000 --insecure
sleep infinity
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh
echo "Launching commands into pod-dev"
until nc -z pod-back 8080; do echo waiting for pod-back; sleep 10; done;
until nc -z pod-back 8000; do echo waiting for pod-back; sleep 10; done;
# Serveur d'encodage
celery -A pod.video_encode_transcript.encoding_tasks worker -l INFO -Q encoding --concurrency 1 -n encode
sleep infinity
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh
echo "Launching commands into pod-dev"
until nc -z pod-back 8080; do echo waiting for pod-back; sleep 10; done;
until nc -z pod-back 8000; do echo waiting for pod-back; sleep 10; done;
# Serveur d'encodage
celery -A pod.video_encode_transcript.transcripting_tasks worker -l INFO -Q transcripting --concurrency 1 -n transcript
sleep infinity
2 changes: 1 addition & 1 deletion dockerfile-dev-with-volumes/pod-xapi/my-entrypoint-xapi.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh
echo "Launching commands into pod-dev"
until nc -z pod-back 8080; do echo waiting for pod-back; sleep 10; done;
until nc -z pod-back 8000; do echo waiting for pod-back; sleep 10; done;
# Serveur xAPI
celery -A pod.xapi.xapi_tasks worker -l INFO -Q xapi --concurrency 1 -n xapi
sleep infinity
2 changes: 1 addition & 1 deletion dockerfile-dev-with-volumes/pod/my-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ fi
# Le serveur de développement permet de tester vos futures modifications facilement.
# N'hésitez pas à lancer le serveur de développement pour vérifier vos modifications au fur et à mesure.
# À ce niveau, vous devriez avoir le site en français et en anglais et voir l'ensemble de la page d'accueil.
python3 manage.py runserver 0.0.0.0:8080 --insecure
python3 manage.py runserver 0.0.0.0:8000 --insecure
sleep infinity
2 changes: 1 addition & 1 deletion pod/custom/settings_local_docker_full_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
# If DOCKER_ENV = full: activate encoding, transcription and remote xapi
USE_REMOTE_ENCODING_TRANSCODING = True
ENCODING_TRANSCODING_CELERY_BROKER_URL = 'redis://redis:6379/7'
POD_API_URL = "http://pod-back:8080/rest"
POD_API_URL = "http://pod-back:8000/rest"
POD_API_TOKEN = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

USE_TRANSCRIPTION = True
Expand Down
2 changes: 1 addition & 1 deletion pod/live/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ def test_attributs(self):
event.id = None
self.assertEqual(event.__str__(), "None")
self.assertEqual(event.get_thumbnail_card(), "/static/img/default-event.svg")
self.assertEqual(event.get_full_url(), "//localhost:9090/live/event/0001-event1/")
self.assertEqual(event.get_full_url(), "//localhost:8000/live/event/0001-event1/")
print(" ---> test_attributs of EventTestCase: OK!")

def test_add_thumbnail(self):
Expand Down
4 changes: 2 additions & 2 deletions pod/main/fixtures/initial_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"model": "sites.site",
"pk": 1,
"fields": {
"domain": "localhost:9090",
"name": "localhost:9090"
"domain": "localhost:8000",
"name": "localhost:8000"
}
},
{
Expand Down

0 comments on commit 8bb4227

Please sign in to comment.