Skip to content

Commit

Permalink
feat: adding integration tests for the upload script
Browse files Browse the repository at this point in the history
  • Loading branch information
santibalda committed Jul 19, 2018
1 parent 4a66eed commit c44c559
Show file tree
Hide file tree
Showing 14 changed files with 82 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
*.egg-info
.settings
.idea
mapillary_run_provider.yml
docker/dockercontext/mapillary
gitversion
7 changes: 7 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!groovy
@Library('mapillary-pipeline') _
com.mapillary.pipeline.Pipeline.builder(this, steps)
.defaultPipeline()
.skipSystemStage()
.build()
.execute()
13 changes: 13 additions & 0 deletions docker/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# MISC
NAME = mapillary_tools

# BOOT
RUN_DIR=/mapillary_source
RUN_CMD=script/run upload

export

DOCKER_CONTEXT=../

MAPILLARY_CLUSTER_DIR ?= /opt/mapillary_cluster
include $(MAPILLARY_CLUSTER_DIR)/build/app/Makefile
23 changes: 23 additions & 0 deletions docker/dockercontext/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM ubuntu:16.04

# SETUP
RUN \
apt-get -qq update && \
apt-get -yqq install \
git \
python-pip && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

RUN \
pip install --upgrade pip

COPY . /source/mapillary_tools

WORKDIR /source/mapillary_tools

RUN pip install -r requirements.txt

COPY docker/dockercontext/mapillary/ /mapillary

ENV PATH="/mapillary:${PATH}"
2 changes: 1 addition & 1 deletion mapillary_tools/uploader.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import sys
import processing

MAPILLARY_UPLOAD_URL = "https://d22zcsn13kp53w.cloudfront.net/"
MAPILLARY_UPLOAD_URL = "http://awss3provider:4569/mapillary.uploads.images"
MAPILLARY_DIRECT_UPLOAD_URL = "https://s3-eu-west-1.amazonaws.com/mapillary.uploads.images"
PERMISSION_HASH = "eyJleHBpcmF0aW9uIjoiMjAyMC0wMS0wMVQwMDowMDowMFoiLCJjb25kaXRpb25zIjpbeyJidWNrZXQiOiJtYXBpbGxhcnkudXBsb2Fkcy5pbWFnZXMifSxbInN0YXJ0cy13aXRoIiwiJGtleSIsIiJdLHsiYWNsIjoicHJpdmF0ZSJ9LFsic3RhcnRzLXdpdGgiLCIkQ29udGVudC1UeXBlIiwiIl0sWyJjb250ZW50LWxlbmd0aC1yYW5nZSIsMCwyMDQ4NTc2MF1dfQ=="
SIGNATURE_HASH = "f6MHj3JdEq8xQ/CmxOOS7LvMxoI="
Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
-e .
git+https://github.com/mapillary/Piexif
git+https://github.com/mapillary/Piexif
redis
13 changes: 13 additions & 0 deletions script/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

source map_cluster_init

if [ "$1" = "upload" ];
then
map_cluster_wait_for_it $S3_WAIT
while :
do
mapillary_tools upload --import_path tests/integration/mapillary_tools_upload_provider/data/
sleep 60
done
fi
Empty file added tests/__init__.py
Empty file.
Empty file added tests/integration/__init__.py
Empty file.
Empty file.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import os
from time import sleep

from mapillary_messi.fixtures.psql_main_fixtures.psql_main_user_fixture import PsqlMainUserFixture
from mapillary_messi.models import User
from testtools import TestCase

UPLOADED_FILENAME = "2016_05_14_11_50_34_383.jpg"

class UploadProviderTestCase(TestCase):

def test_images_uploaded_are_harvested(self):
user_a = User()
self.useFixture(PsqlMainUserFixture([user_a]))

current_dir = os.path.abspath(__file__)
data_dir = os.path.dirname(current_dir)
image_path = os.path.join(data_dir, 'data/{}'.format(UPLOADED_FILENAME))

sleep(3000)

0 comments on commit c44c559

Please sign in to comment.