From 2ac39b5748321ad65550aff947f8a7dcef19e9a8 Mon Sep 17 00:00:00 2001 From: Raul Ochoa Date: Thu, 6 Oct 2016 11:53:56 +0200 Subject: [PATCH] Move all batch tests to their own directory --- Makefile | 2 +- test/acceptance/{ => batch}/batch.test.js | 19 ++++++++++--------- .../{ => batch}/job.callback-template.test.js | 12 ++++++------ .../{ => batch}/job.fallback.test.js | 12 ++++++------ .../{ => batch}/job.query.limit.test.js | 10 +++++----- test/acceptance/{ => batch}/job.test.js | 8 ++++---- .../acceptance/{ => batch}/job.timing.test.js | 12 ++++++------ .../{ => batch}/job.use-case-1.test.js | 10 +++++----- .../{ => batch}/job.use-case-10.test.js | 10 +++++----- .../{ => batch}/job.use-case-2.test.js | 10 +++++----- .../{ => batch}/job.use-case-3.test.js | 10 +++++----- .../{ => batch}/job.use-case-4.test.js | 10 +++++----- .../{ => batch}/job.use-case-5.test.js | 10 +++++----- .../{ => batch}/job.use-case-6.test.js | 10 +++++----- .../{ => batch}/job.use-case-7.test.js | 10 +++++----- .../{ => batch}/job.use-case-8.test.js | 10 +++++----- .../{ => batch}/job.use-case-9.test.js | 10 +++++----- 17 files changed, 88 insertions(+), 87 deletions(-) rename test/acceptance/{ => batch}/batch.test.js (93%) rename test/acceptance/{ => batch}/job.callback-template.test.js (96%) rename test/acceptance/{ => batch}/job.fallback.test.js (99%) rename test/acceptance/{ => batch}/job.query.limit.test.js (94%) rename test/acceptance/{ => batch}/job.test.js (97%) rename test/acceptance/{ => batch}/job.timing.test.js (96%) rename test/acceptance/{ => batch}/job.use-case-1.test.js (93%) rename test/acceptance/{ => batch}/job.use-case-10.test.js (93%) rename test/acceptance/{ => batch}/job.use-case-2.test.js (94%) rename test/acceptance/{ => batch}/job.use-case-3.test.js (94%) rename test/acceptance/{ => batch}/job.use-case-4.test.js (94%) rename test/acceptance/{ => batch}/job.use-case-5.test.js (93%) rename test/acceptance/{ => batch}/job.use-case-6.test.js (91%) rename test/acceptance/{ => batch}/job.use-case-7.test.js (93%) rename test/acceptance/{ => batch}/job.use-case-8.test.js (95%) rename test/acceptance/{ => batch}/job.use-case-9.test.js (94%) diff --git a/Makefile b/Makefile index 1caa1470..50c370f6 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ TEST_SUITE := $(shell find test/{acceptance,unit,integration} -name "*.js") TEST_SUITE_UNIT := $(shell find test/unit -name "*.js") TEST_SUITE_INTEGRATION := $(shell find test/integration -name "*.js") TEST_SUITE_ACCEPTANCE := $(shell find test/acceptance -name "*.js") -TEST_SUITE_BATCH := $(shell find test -name "*job*.js") +TEST_SUITE_BATCH := $(shell find test/*/batch -name "*.js") test: @echo "***tests***" diff --git a/test/acceptance/batch.test.js b/test/acceptance/batch/batch.test.js similarity index 93% rename from test/acceptance/batch.test.js rename to test/acceptance/batch/batch.test.js index c870d3fe..6e1baa36 100644 --- a/test/acceptance/batch.test.js +++ b/test/acceptance/batch/batch.test.js @@ -1,16 +1,17 @@ -var assert = require('../support/assert'); -var redisUtils = require('../support/redis_utils'); +require('../../helper'); +var assert = require('../../support/assert'); +var redisUtils = require('../../support/redis_utils'); var _ = require('underscore'); var RedisPool = require('redis-mpool'); var queue = require('queue-async'); -var batchFactory = require('../../batch'); +var batchFactory = require('../../../batch/index'); -var JobPublisher = require('../../batch/job_publisher'); -var JobQueue = require('../../batch/job_queue'); -var JobBackend = require('../../batch/job_backend'); -var JobService = require('../../batch/job_service'); -var UserDatabaseMetadataService = require('../../batch/user_database_metadata_service'); -var JobCanceller = require('../../batch/job_canceller'); +var JobPublisher = require('../../../batch/job_publisher'); +var JobQueue = require('../../../batch/job_queue'); +var JobBackend = require('../../../batch/job_backend'); +var JobService = require('../../../batch/job_service'); +var UserDatabaseMetadataService = require('../../../batch/user_database_metadata_service'); +var JobCanceller = require('../../../batch/job_canceller'); var metadataBackend = require('cartodb-redis')(redisUtils.getConfig()); describe('batch module', function() { diff --git a/test/acceptance/job.callback-template.test.js b/test/acceptance/batch/job.callback-template.test.js similarity index 96% rename from test/acceptance/job.callback-template.test.js rename to test/acceptance/batch/job.callback-template.test.js index 9fdfbf67..86e88e87 100644 --- a/test/acceptance/job.callback-template.test.js +++ b/test/acceptance/batch/job.callback-template.test.js @@ -1,12 +1,12 @@ -require('../helper'); +require('../../helper'); -var assert = require('../support/assert'); -var redisUtils = require('../support/redis_utils'); -var server = require('../../app/server')(); +var assert = require('../../support/assert'); +var redisUtils = require('../../support/redis_utils'); +var server = require('../../../app/server')(); var querystring = require('qs'); var metadataBackend = require('cartodb-redis')(redisUtils.getConfig()); -var batchFactory = require('../../batch'); -var jobStatus = require('../../batch/job_status'); +var batchFactory = require('../../../batch/index'); +var jobStatus = require('../../../batch/job_status'); describe('Batch API callback templates', function () { diff --git a/test/acceptance/job.fallback.test.js b/test/acceptance/batch/job.fallback.test.js similarity index 99% rename from test/acceptance/job.fallback.test.js rename to test/acceptance/batch/job.fallback.test.js index f17ed56f..ccde5ebf 100644 --- a/test/acceptance/job.fallback.test.js +++ b/test/acceptance/batch/job.fallback.test.js @@ -1,12 +1,12 @@ -require('../helper'); +require('../../helper'); -var assert = require('../support/assert'); -var redisUtils = require('../support/redis_utils'); -var server = require('../../app/server')(); +var assert = require('../../support/assert'); +var redisUtils = require('../../support/redis_utils'); +var server = require('../../../app/server')(); var querystring = require('qs'); var metadataBackend = require('cartodb-redis')(redisUtils.getConfig()); -var batchFactory = require('../../batch'); -var jobStatus = require('../../batch/job_status'); +var batchFactory = require('../../../batch/index'); +var jobStatus = require('../../../batch/job_status'); describe('Batch API fallback job', function () { diff --git a/test/acceptance/job.query.limit.test.js b/test/acceptance/batch/job.query.limit.test.js similarity index 94% rename from test/acceptance/job.query.limit.test.js rename to test/acceptance/batch/job.query.limit.test.js index 9ce4e627..5587ecda 100644 --- a/test/acceptance/job.query.limit.test.js +++ b/test/acceptance/batch/job.query.limit.test.js @@ -12,11 +12,11 @@ * HSET rails:users:vizzuality database_name cartodb_test_user_1_db * */ -require('../helper'); -var JobController = require('../../app/controllers/job_controller'); -var redisUtils = require('../support/redis_utils'); -var server = require('../../app/server')(); -var assert = require('../support/assert'); +require('../../helper'); +var JobController = require('../../../app/controllers/job_controller'); +var redisUtils = require('../../support/redis_utils'); +var server = require('../../../app/server')(); +var assert = require('../../support/assert'); var querystring = require('qs'); function payload(query) { diff --git a/test/acceptance/job.test.js b/test/acceptance/batch/job.test.js similarity index 97% rename from test/acceptance/job.test.js rename to test/acceptance/batch/job.test.js index ec4f45ee..5c3f2b5e 100644 --- a/test/acceptance/job.test.js +++ b/test/acceptance/batch/job.test.js @@ -12,11 +12,11 @@ * HSET rails:users:vizzuality database_name cartodb_test_user_1_db * */ -require('../helper'); +require('../../helper'); -var server = require('../../app/server')(); -var assert = require('../support/assert'); -var redisUtils = require('../support/redis_utils'); +var server = require('../../../app/server')(); +var assert = require('../../support/assert'); +var redisUtils = require('../../support/redis_utils'); var querystring = require('querystring'); describe('job module', function() { diff --git a/test/acceptance/job.timing.test.js b/test/acceptance/batch/job.timing.test.js similarity index 96% rename from test/acceptance/job.timing.test.js rename to test/acceptance/batch/job.timing.test.js index a3d71fa7..932f189d 100644 --- a/test/acceptance/job.timing.test.js +++ b/test/acceptance/batch/job.timing.test.js @@ -1,12 +1,12 @@ -require('../helper'); +require('../../helper'); -var assert = require('../support/assert'); -var redisUtils = require('../support/redis_utils'); -var server = require('../../app/server')(); +var assert = require('../../support/assert'); +var redisUtils = require('../../support/redis_utils'); +var server = require('../../../app/server')(); var querystring = require('qs'); var metadataBackend = require('cartodb-redis')(redisUtils.getConfig()); -var batchFactory = require('../../batch'); -var jobStatus = require('../../batch/job_status'); +var batchFactory = require('../../../batch'); +var jobStatus = require('../../../batch/job_status'); describe('Batch API query timing', function () { diff --git a/test/acceptance/job.use-case-1.test.js b/test/acceptance/batch/job.use-case-1.test.js similarity index 93% rename from test/acceptance/job.use-case-1.test.js rename to test/acceptance/batch/job.use-case-1.test.js index 4f3786ed..fde821aa 100644 --- a/test/acceptance/job.use-case-1.test.js +++ b/test/acceptance/batch/job.use-case-1.test.js @@ -12,14 +12,14 @@ * HSET rails:users:vizzuality database_name cartodb_test_user_1_db * */ -require('../helper'); +require('../../helper'); -var server = require('../../app/server')(); -var assert = require('../support/assert'); -var redisUtils = require('../support/redis_utils'); +var server = require('../../../app/server')(); +var assert = require('../../support/assert'); +var redisUtils = require('../../support/redis_utils'); var querystring = require('querystring'); var metadataBackend = require('cartodb-redis')(redisUtils.getConfig()); -var batchFactory = require('../../batch'); +var batchFactory = require('../../../batch/index'); describe('Use case 1: cancel and modify a done job', function () { var batch = batchFactory(metadataBackend, redisUtils.getConfig()); diff --git a/test/acceptance/job.use-case-10.test.js b/test/acceptance/batch/job.use-case-10.test.js similarity index 93% rename from test/acceptance/job.use-case-10.test.js rename to test/acceptance/batch/job.use-case-10.test.js index b6172ee5..e7786a56 100644 --- a/test/acceptance/job.use-case-10.test.js +++ b/test/acceptance/batch/job.use-case-10.test.js @@ -12,14 +12,14 @@ * HSET rails:users:vizzuality database_name cartodb_test_user_1_db * */ -require('../helper'); +require('../../helper'); -var server = require('../../app/server')(); -var assert = require('../support/assert'); -var redisUtils = require('../support/redis_utils'); +var server = require('../../../app/server')(); +var assert = require('../../support/assert'); +var redisUtils = require('../../support/redis_utils'); var querystring = require('querystring'); var metadataBackend = require('cartodb-redis')(redisUtils.getConfig()); -var batchFactory = require('../../batch'); +var batchFactory = require('../../../batch/index'); describe('Use case 10: cancel and modify a done multiquery job', function () { var batch = batchFactory(metadataBackend, redisUtils.getConfig()); diff --git a/test/acceptance/job.use-case-2.test.js b/test/acceptance/batch/job.use-case-2.test.js similarity index 94% rename from test/acceptance/job.use-case-2.test.js rename to test/acceptance/batch/job.use-case-2.test.js index 4e83e9e4..35f36f71 100644 --- a/test/acceptance/job.use-case-2.test.js +++ b/test/acceptance/batch/job.use-case-2.test.js @@ -12,14 +12,14 @@ * HSET rails:users:vizzuality database_name cartodb_test_user_1_db * */ -require('../helper'); +require('../../helper'); -var server = require('../../app/server')(); -var assert = require('../support/assert'); -var redisUtils = require('../support/redis_utils'); +var server = require('../../../app/server')(); +var assert = require('../../support/assert'); +var redisUtils = require('../../support/redis_utils'); var querystring = require('querystring'); var metadataBackend = require('cartodb-redis')(redisUtils.getConfig()); -var batchFactory = require('../../batch'); +var batchFactory = require('../../../batch/index'); describe('Use case 2: cancel a running job', function() { var batch = batchFactory(metadataBackend, redisUtils.getConfig()); diff --git a/test/acceptance/job.use-case-3.test.js b/test/acceptance/batch/job.use-case-3.test.js similarity index 94% rename from test/acceptance/job.use-case-3.test.js rename to test/acceptance/batch/job.use-case-3.test.js index 644c0784..e3e5fad6 100644 --- a/test/acceptance/job.use-case-3.test.js +++ b/test/acceptance/batch/job.use-case-3.test.js @@ -12,14 +12,14 @@ * HSET rails:users:vizzuality database_name cartodb_test_user_1_db * */ -require('../helper'); +require('../../helper'); -var server = require('../../app/server')(); -var assert = require('../support/assert'); -var redisUtils = require('../support/redis_utils'); +var server = require('../../../app/server')(); +var assert = require('../../support/assert'); +var redisUtils = require('../../support/redis_utils'); var querystring = require('querystring'); var metadataBackend = require('cartodb-redis')(redisUtils.getConfig()); -var batchFactory = require('../../batch'); +var batchFactory = require('../../../batch/index'); describe('Use case 3: cancel a pending job', function() { var batch = batchFactory(metadataBackend, redisUtils.getConfig()); diff --git a/test/acceptance/job.use-case-4.test.js b/test/acceptance/batch/job.use-case-4.test.js similarity index 94% rename from test/acceptance/job.use-case-4.test.js rename to test/acceptance/batch/job.use-case-4.test.js index d3cdf9d1..0baae3ad 100644 --- a/test/acceptance/job.use-case-4.test.js +++ b/test/acceptance/batch/job.use-case-4.test.js @@ -12,14 +12,14 @@ * HSET rails:users:vizzuality database_name cartodb_test_user_1_db * */ -require('../helper'); +require('../../helper'); -var server = require('../../app/server')(); -var assert = require('../support/assert'); -var redisUtils = require('../support/redis_utils'); +var server = require('../../../app/server')(); +var assert = require('../../support/assert'); +var redisUtils = require('../../support/redis_utils'); var querystring = require('querystring'); var metadataBackend = require('cartodb-redis')(redisUtils.getConfig()); -var batchFactory = require('../../batch'); +var batchFactory = require('../../../batch'); describe('Use case 4: modify a pending job', function() { var batch = batchFactory(metadataBackend, redisUtils.getConfig()); diff --git a/test/acceptance/job.use-case-5.test.js b/test/acceptance/batch/job.use-case-5.test.js similarity index 93% rename from test/acceptance/job.use-case-5.test.js rename to test/acceptance/batch/job.use-case-5.test.js index caab7663..b916ff1d 100644 --- a/test/acceptance/job.use-case-5.test.js +++ b/test/acceptance/batch/job.use-case-5.test.js @@ -12,14 +12,14 @@ * HSET rails:users:vizzuality database_name cartodb_test_user_1_db * */ -require('../helper'); +require('../../helper'); -var server = require('../../app/server')(); -var assert = require('../support/assert'); -var redisUtils = require('../support/redis_utils'); +var server = require('../../../app/server')(); +var assert = require('../../support/assert'); +var redisUtils = require('../../support/redis_utils'); var querystring = require('querystring'); var metadataBackend = require('cartodb-redis')(redisUtils.getConfig()); -var batchFactory = require('../../batch'); +var batchFactory = require('../../../batch'); describe('Use case 5: modify a running job', function() { var batch = batchFactory(metadataBackend, redisUtils.getConfig()); diff --git a/test/acceptance/job.use-case-6.test.js b/test/acceptance/batch/job.use-case-6.test.js similarity index 91% rename from test/acceptance/job.use-case-6.test.js rename to test/acceptance/batch/job.use-case-6.test.js index 971970f3..e046a2ac 100644 --- a/test/acceptance/job.use-case-6.test.js +++ b/test/acceptance/batch/job.use-case-6.test.js @@ -12,14 +12,14 @@ * HSET rails:users:vizzuality database_name cartodb_test_user_1_db * */ -require('../helper'); +require('../../helper'); -var server = require('../../app/server')(); -var assert = require('../support/assert'); -var redisUtils = require('../support/redis_utils'); +var server = require('../../../app/server')(); +var assert = require('../../support/assert'); +var redisUtils = require('../../support/redis_utils'); var querystring = require('querystring'); var metadataBackend = require('cartodb-redis')(redisUtils.getConfig()); -var batchFactory = require('../../batch'); +var batchFactory = require('../../../batch'); describe('Use case 6: modify a done job', function() { var batch = batchFactory(metadataBackend, redisUtils.getConfig()); diff --git a/test/acceptance/job.use-case-7.test.js b/test/acceptance/batch/job.use-case-7.test.js similarity index 93% rename from test/acceptance/job.use-case-7.test.js rename to test/acceptance/batch/job.use-case-7.test.js index 118a5c8f..09c5a054 100644 --- a/test/acceptance/job.use-case-7.test.js +++ b/test/acceptance/batch/job.use-case-7.test.js @@ -12,14 +12,14 @@ * HSET rails:users:vizzuality database_name cartodb_test_user_1_db * */ -require('../helper'); +require('../../helper'); -var server = require('../../app/server')(); -var assert = require('../support/assert'); -var redisUtils = require('../support/redis_utils'); +var server = require('../../../app/server')(); +var assert = require('../../support/assert'); +var redisUtils = require('../../support/redis_utils'); var querystring = require('querystring'); var metadataBackend = require('cartodb-redis')(redisUtils.getConfig()); -var batchFactory = require('../../batch'); +var batchFactory = require('../../../batch'); describe('Use case 7: cancel a job with quotes', function() { var batch = batchFactory(metadataBackend, redisUtils.getConfig()); diff --git a/test/acceptance/job.use-case-8.test.js b/test/acceptance/batch/job.use-case-8.test.js similarity index 95% rename from test/acceptance/job.use-case-8.test.js rename to test/acceptance/batch/job.use-case-8.test.js index 5b992d3e..43ee016b 100644 --- a/test/acceptance/job.use-case-8.test.js +++ b/test/acceptance/batch/job.use-case-8.test.js @@ -12,14 +12,14 @@ * HSET rails:users:vizzuality database_name cartodb_test_user_1_db * */ -require('../helper'); +require('../../helper'); -var server = require('../../app/server')(); -var assert = require('../support/assert'); -var redisUtils = require('../support/redis_utils'); +var server = require('../../../app/server')(); +var assert = require('../../support/assert'); +var redisUtils = require('../../support/redis_utils'); var querystring = require('querystring'); var metadataBackend = require('cartodb-redis')(redisUtils.getConfig()); -var batchFactory = require('../../batch'); +var batchFactory = require('../../../batch'); describe('Use case 8: cancel a running multiquery job', function() { var batch = batchFactory(metadataBackend, redisUtils.getConfig()); diff --git a/test/acceptance/job.use-case-9.test.js b/test/acceptance/batch/job.use-case-9.test.js similarity index 94% rename from test/acceptance/job.use-case-9.test.js rename to test/acceptance/batch/job.use-case-9.test.js index c68fa383..6d508855 100644 --- a/test/acceptance/job.use-case-9.test.js +++ b/test/acceptance/batch/job.use-case-9.test.js @@ -12,14 +12,14 @@ * HSET rails:users:vizzuality database_name cartodb_test_user_1_db * */ -require('../helper'); +require('../../helper'); -var server = require('../../app/server')(); -var assert = require('../support/assert'); -var redisUtils = require('../support/redis_utils'); +var server = require('../../../app/server')(); +var assert = require('../../support/assert'); +var redisUtils = require('../../support/redis_utils'); var querystring = require('querystring'); var metadataBackend = require('cartodb-redis')(redisUtils.getConfig()); -var batchFactory = require('../../batch'); +var batchFactory = require('../../../batch'); describe('Use case 9: modify a pending multiquery job', function() { var batch = batchFactory(metadataBackend, redisUtils.getConfig());