Skip to content

Commit 981825f

Browse files
Add local testing dependencies.
1 parent e2385f4 commit 981825f

File tree

4 files changed

+31
-73
lines changed

4 files changed

+31
-73
lines changed

.devcontainer/Dockerfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,8 @@ FROM mcr.microsoft.com/devcontainers/base:bullseye
77

88
RUN \
99
apt update && \
10-
apt-get install bash-completion -y
10+
apt-get install bash-completion graphviz -y
11+
12+
ENV DJ_HOST fakeservices.datajoint.io
13+
ENV DJ_USER root
14+
ENV DJ_PASS simple

.devcontainer/devcontainer.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,13 @@
1212
"features": {
1313
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
1414
"ghcr.io/devcontainers/features/git:1": {},
15-
"ghcr.io/rocker-org/devcontainer-features/apt-packages:1": {},
1615
"ghcr.io/eitsupi/devcontainer-features/jq-likes:1": {},
1716
"ghcr.io/guiyomh/features/vim:0": {},
18-
"ghcr.io/devcontainers/features/python:1": {},
17+
"ghcr.io/devcontainers/features/python:1": {
18+
"version": "3.7"
19+
},
1920
},
20-
"postCreateCommand": "pip install black",
21+
"postCreateCommand": "pip install flake8 black faker ipykernel nose nose-cov && pip install -e . && MYSQL_VER=5.7 MINIO_VER=RELEASE.2022-08-11T04-37-28Z docker compose -f local-docker-compose.yml up --build -d",
2122
"customizations": {
2223
"vscode": {
2324
"extensions": [

.devcontainer/docker-compose.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: '3'
1+
version: "3"
22

33
services:
44
app:
@@ -19,5 +19,5 @@ services:
1919
# security_opt:
2020
# - seccomp:unconfined
2121

22-
# Use "forwardPorts" in **devcontainer.json** to forward an app port locally.
22+
# Use "forwardPorts" in **devcontainer.json** to forward an app port locally.
2323
# (Adding the "ports" property to this file will not forward from a Codespace.)

local-docker-compose.yml

Lines changed: 20 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
# PY_VER=3.8 MYSQL_VER=5.7 DISTRO=alpine MINIO_VER=RELEASE.2022-08-11T04-37-28Z HOST_UID=$(id -u) docker compose -f local-docker-compose.yml up --build
1+
# MYSQL_VER=5.7 MINIO_VER=RELEASE.2022-08-11T04-37-28Z docker compose -f local-docker-compose.yml up --build
22
version: '2.4'
3-
x-net: &net
3+
x-net:
4+
&net
45
networks:
5-
- main
6+
- main
67
services:
78
db:
89
<<: *net
@@ -28,23 +29,29 @@ services:
2829
# - ./minio/config:/root/.minio
2930
command: server --address ":9000" /data
3031
healthcheck:
31-
test: ["CMD", "curl", "--fail", "http://minio:9000/minio/health/live"]
32+
test:
33+
[
34+
"CMD",
35+
"curl",
36+
"--fail",
37+
"http://minio:9000/minio/health/live"
38+
]
3239
timeout: 5s
3340
retries: 60
3441
interval: 1s
3542
fakeservices.datajoint.io:
3643
<<: *net
3744
image: datajoint/nginx:v0.2.4
3845
environment:
39-
- ADD_db_TYPE=DATABASE
40-
- ADD_db_ENDPOINT=db:3306
41-
- ADD_minio_TYPE=MINIO
42-
- ADD_minio_ENDPOINT=minio:9000
43-
- ADD_minio_PORT=80 # allow unencrypted connections
44-
- ADD_minio_PREFIX=/datajoint
45-
- ADD_browser_TYPE=MINIOADMIN
46-
- ADD_browser_ENDPOINT=minio:9000
47-
- ADD_browser_PORT=80 # allow unencrypted connections
46+
- ADD_db_TYPE=DATABASE
47+
- ADD_db_ENDPOINT=db:3306
48+
- ADD_minio_TYPE=MINIO
49+
- ADD_minio_ENDPOINT=minio:9000
50+
- ADD_minio_PORT=80 # allow unencrypted connections
51+
- ADD_minio_PREFIX=/datajoint
52+
- ADD_browser_TYPE=MINIOADMIN
53+
- ADD_browser_ENDPOINT=minio:9000
54+
- ADD_browser_PORT=80 # allow unencrypted connections
4855
ports:
4956
- "80:80"
5057
- "443:443"
@@ -55,59 +62,5 @@ services:
5562
condition: service_healthy
5663
minio:
5764
condition: service_healthy
58-
app:
59-
<<: *net
60-
image: datajoint/djtest:py${PY_VER}-${DISTRO}
61-
depends_on:
62-
fakeservices.datajoint.io:
63-
condition: service_healthy
64-
environment:
65-
- DJ_HOST=fakeservices.datajoint.io
66-
- DJ_USER=root
67-
- DJ_PASS=simple
68-
- DJ_TEST_HOST=fakeservices.datajoint.io
69-
- DJ_TEST_USER=datajoint
70-
- DJ_TEST_PASSWORD=datajoint
71-
# If running tests locally, make sure to add entry in /etc/hosts for 127.0.0.1 fakeservices.datajoint.io
72-
- S3_ENDPOINT=fakeservices.datajoint.io
73-
- S3_ACCESS_KEY=datajoint
74-
- S3_SECRET_KEY=datajoint
75-
- S3_BUCKET=datajoint.test
76-
- PYTHON_USER=dja
77-
- JUPYTER_PASSWORD=datajoint
78-
- DISPLAY
79-
working_dir: /src
80-
command:
81-
- sh
82-
- -c
83-
- |
84-
set -e
85-
pip install --user nose nose-cov
86-
pip install -e .
87-
pip list --format=freeze | grep datajoint
88-
## You may run the below tests once sh'ed into container i.e. docker exec -it datajoint-python_app_1 sh
89-
# nosetests -vsw tests; #run all tests
90-
# nosetests -vs --tests=tests.test_external_class:test_insert_and_fetch; #run specific basic test
91-
# nosetests -vs --tests=tests.test_fetch:TestFetch.test_getattribute_for_fetch1; #run specific Class test
92-
# flake8 datajoint --count --select=E9,F63,F7,F82 --show-source --statistics
93-
# flake8 --ignore=E203,E722,W503 datajoint --count --max-complexity=62 --max-line-length=127 --statistics
94-
# black datajoint --check -v
95-
## Remote debugger
96-
set +e
97-
while true
98-
do
99-
python -m ptvsd --host 0.0.0.0 --port 5678 --wait .
100-
sleep 2
101-
done
102-
ports:
103-
- "8888:8888"
104-
- "5678:5678"
105-
user: ${HOST_UID}:anaconda
106-
volumes:
107-
- .:/src
108-
- /tmp/.X11-unix:/tmp/.X11-unix:rw
109-
# Additional mounted notebooks may go here
110-
# - ./notebook:/home/dja/notebooks
111-
# - ../dj-python-101/ch1:/home/dja/tutorials
11265
networks:
11366
main:

0 commit comments

Comments
 (0)