Skip to content
This repository was archived by the owner on Oct 8, 2024. It is now read-only.

Commit

Permalink
added Dockerfile that runs tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tylertucker202 committed Mar 12, 2019
1 parent 2779c2e commit 8b056de
Show file tree
Hide file tree
Showing 12 changed files with 29 additions and 16 deletions.
26 changes: 15 additions & 11 deletions Dockerfile
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
FROM continuumio/miniconda3
WORKDIR /usr/src/argo-database

# copies everything from host dir to container work dir
COPY . .
#need to install netcdf libraries
RUN apt-get update && apt-get --assume-yes install libhdf5-serial-dev netcdf-bin libnetcdf-dev
# install python libraries
RUN pip install -r requirements.txt
#--net=host seems to work. use network_mode: "host" in docker-compose.
#RUN cd /usr/src/argo-database
WORKDIR /usr/src/argo-database

# run test scripts
WORKDIR /usr/src/argo-database/test
CMD [ "python", "./unitTest.py" ]
RUN groupadd -g 998 argouser && \
useradd -r -u 998 -g argouser argouser
# copies requirements.txt from host dir to container work dir
COPY ./requirements.txt ./requirements.txt
#need to install netcdf libraries and cron
RUN apt-get update && \
apt-get --assume-yes install libhdf5-serial-dev netcdf-bin libnetcdf-dev nano && \
pip install -r requirements.txt
#CMD echo 'we ah doin da test' `date` > cron.log
USER argouser
CMD cd /usr/src/argo-database/test && /opt/conda/bin/python testTmpFunctions.py >> ./../cron.log 2>&1
#docker build -t argo-db:1.0
#docker run --net=host -v /home/tyler/Desktop/argo-database:/usr/src/argo-database/ argo-db:1.0
11 changes: 8 additions & 3 deletions add-profiles/tmpFunctions.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,11 @@ def write_last_updated(date, filename='lastUpdated.txt'):

def clean_up_space(globalProfileIndex='argo_merge-profile_index*.txt', mixedProfileIndex='ar_index_this_week_prof-*.txt', tmpDir='tmp/'):
#remove indexList
os.system('rm '+ globalProfileIndex)
os.system('rm '+ mixedProfileIndex)
os.system('rm -r '+ tmpDir)
files = [ globalProfileIndex, mixedProfileIndex ]

for file in files:
if os.path.exists(file):
os.system('rm ' + file)

if os.path.exists(tmpDir):
os.system('rm -r '+ tmpDir)
3 changes: 3 additions & 0 deletions crontab
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# m h dom mon dow command
* * * * * root cd /usr/src/argo-database/test && echo 'doin da test' >> ./../cron.log 2>&1
#* * * * * root cd /usr/src/argo-database/test && /opt/conda/bin/python testTmpFunctions.py >> ./../cron.log 2>&1
Empty file modified test/argoDBClass.py
100644 → 100755
Empty file.
Empty file modified test/argoDatabaseTest.py
100644 → 100755
Empty file.
Empty file modified test/bgcTest.py
100644 → 100755
Empty file.
Empty file modified test/deepTest.py
100644 → 100755
Empty file.
Empty file modified test/forDonataAndMegan.py
100644 → 100755
Empty file.
Empty file modified test/netCDFToDocTest.py
100644 → 100755
Empty file.
Empty file modified test/testMeasToDf.py
100644 → 100755
Empty file.
5 changes: 3 additions & 2 deletions test/testTmpFunctions.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import sys
import pdb
sys.path.append('..')
sys.path.append('../add-profiles')
sys.path.append('./../add-profiles')
import unittest
from datetime import datetime, timedelta
import warnings
Expand Down Expand Up @@ -50,7 +50,8 @@ def test_download_todays_file_and_clean_up_space(self):
self.assertTrue(os.path.exists(tf.mixedProfileIndex), 'mixed profile file not created')

tmpDir = os.path.join(os.getcwd(), 'tmp')
os.mkdir( tmpDir )
if not os.path.exists(tmpDir):
os.mkdir( tmpDir )
self.assertTrue(os.path.exists(tmpDir), 'tmp dir not created')
tf.clean_up_space()

Expand Down
Empty file modified test/unitTest.py
100644 → 100755
Empty file.

0 comments on commit 8b056de

Please sign in to comment.