Skip to content

Refactor elixir test suite initialization#1779

Merged
wohali merged 3 commits intoapache:masterfrom
van-mronov:couch-test-case
Dec 7, 2018
Merged

Refactor elixir test suite initialization#1779
wohali merged 3 commits intoapache:masterfrom
van-mronov:couch-test-case

Conversation

@van-mronov
Copy link
Copy Markdown
Contributor

Overview

  • moved CouchTestCase module declaration in its own file;
  • moved functions declarations from using of CouchTestCase to Couch.DBTest module (see Kernel.use/2 doc for explanation why it is important);

Testing recommendations

make elixir

Since we don't run this in the CI test suite yet, here is my output:

$ make elixir
[ * ] Setup environment ... ok
[ * ] Ensure CouchDB is built ... ok
[ * ] Prepare configuration files ... ok
[ * ] Start node node1 ... ok
[ * ] Start node node2 ... ok
[ * ] Start node node3 ... ok
[ * ] Check node at http://127.0.0.1:15984/ ... ok
[ * ] Check node at http://127.0.0.1:25984/ ... ok
[ * ] Check node at http://127.0.0.1:35984/ ... ok
[ * ] Running cluster setup ... ok
[ * ] Exec command test/elixir/run ... * creating /Users/iam/.asdf/installs/elixir/1.7.4/.mix/archives/hex-0.18.2
* creating /Users/iam/.asdf/installs/elixir/1.7.4/.mix/rebar
* creating /Users/iam/.asdf/installs/elixir/1.7.4/.mix/rebar3
Resolving Hex dependencies...
Dependency resolution completed:
Unchanged:
  httpotion 3.1.0
  ibrowse 4.4.1
  jiffy 0.15.2
All dependencies up to date
Compiling 3 files (.ex)
Generated foo app
Excluding tags: [pending: true]


ReplicationTest
  * test non-admin or reader user on source - local-to-remote (1421.4ms)
  * test filtered replications - remote-to-local (2096.6ms)
  * test source database not found with path - COUCHDB-317 (23.0ms)
  * test continuous replication - local-to-remote (7978.2ms)
  * test replicate with since_seq - local-to-local (1917.7ms)
  * test replication by doc ids - local-to-local (19585.3ms)
  * test create_target filter option - local-to-remote (1606.7ms)
  * test replication restarts after filter change - COUCHDB-892 - remote-to-local (2126.9ms)
  * test continuous replication - remote-to-remote (6313.6ms)
  * test simple remote-to-local replication - remote-to-local (5044.0ms)
  * test continuous replication - remote-to-local (6659.7ms)
  * test replicate with since_seq - remote-to-remote (1585.1ms)
  * test validate_doc_update failure replications - remote-to-remote (1866.8ms)
  * test validate_doc_update failure replications - local-to-local (1873.3ms)
  * test non-admin or reader user on source - remote-to-local (2146.0ms)
  * test create_target filter option - local-to-local (1587.5ms)
  * test non-admin user on target - remote-to-local (2279.6ms)
  * test compressed attachment replication - remote-to-local (4233.9ms)
  * test compressed attachment replication - local-to-remote (5647.9ms)
  * test create_target filter option - remote-to-local (1322.8ms)
  * test unauthorized replication cancellation (2150.5ms)
  * test replication restarts after filter change - COUCHDB-892 - local-to-local (1838.8ms)
  * test replication by doc ids - remote-to-remote (21374.2ms)
  * test simple local-to-local replication - local-to-local (5226.8ms)
  * test filtered replications - local-to-remote (2623.4ms)
  * test simple local-to-remote replication - local-to-remote (5605.9ms)
  * test validate_doc_update failure replications - local-to-remote (1934.7ms)
  * test compressed attachment replication - local-to-local (3771.8ms)
  * test non-admin user on target - local-to-remote (2163.8ms)
  * test source database does not exist (89.0ms)
  * test filtered replications - local-to-local (1946.3ms)
  * test non-admin or reader user on source - local-to-local (2263.5ms)
  * test replication restarts after filter change - COUCHDB-892 - remote-to-remote (2134.6ms)
  * test replicate with since_seq - remote-to-local (1807.2ms)
  * test simple remote-to-remote replication - remote-to-remote (5759.7ms)
  * test non-admin user on target - remote-to-remote (2298.7ms)
  * test replication by doc ids - remote-to-local (22059.0ms)
  * test replicating attachment without conflict - COUCHDB-885 (1833.4ms)
  * test filtered replications - remote-to-remote (2339.9ms)
  * test non-admin user on target - local-to-local (2363.9ms)
  * test source database not found with host (72.1ms)
  * test replication by doc ids - local-to-remote (20905.3ms)
  * test validate_doc_update failure replications - remote-to-local (1950.0ms)
  * test continuous replication - local-to-local (8207.4ms)
  * test create_target filter option - remote-to-remote (1835.5ms)
  * test replication cancellation (1872.7ms)
  * test replication restarts after filter change - COUCHDB-892 - local-to-remote (2089.4ms)
  * test non-admin or reader user on source - remote-to-remote (2169.2ms)
  * test replicate with since_seq - local-to-remote (1638.6ms)
  * test compressed attachment replication - remote-to-remote (2895.3ms)

ReduceTest
  * test Basic reduce functions (3070.1ms)
  * test More complex reductions that need to use the combine option (3644.4ms)
  * test Reduce pagination (2096.7ms)
  * test More complex array key view row testing (16289.1ms)

BasicsTest
  * test Regression test for COUCHDB-954 (excluded)
  * test Revs info status is good (728.3ms)
  * test Created database has appropriate db info name (716.1ms)
  * test _bulk_docs POST error when body not an object (589.1ms)
  * test POST doc response has a Location header (808.9ms)
  * test POST doc with an _id field isn't overwritten by uuid (774.7ms)
  * test Welcome endpoint (1.6ms)
  * test Session contains adm context (1.3ms)
  * test Make sure you can do a seq=true option (622.0ms)
  * test PUT error when body not an object (639.3ms)
  * test Database should be in _all_dbs (1189.9ms)
  * test PUT on existing DB should return 412 instead of 500 (812.3ms)
  * test Creating a new DB with slashes should return Location header (COUCHDB-411) (830.3ms)
  * test Can create several documents (1018.0ms)
  * test Check for invalid document members (673.7ms)
  * test Simple map functions (2472.9ms)
  * test oops, the doc id got lost in code nirwana (804.3ms)
  * test DELETE'ing a non-existent doc should 404 (661.2ms)
  * test Create a document and save it to the database (788.0ms)
  * test PUT doc has a Location header (excluded)
  * test Empty database should have zero docs (822.0ms)
  * test On restart, a request for creating an already existing db can not override (excluded)
  * test Creating a new DB should return location header (1075.0ms)
  * test _all_docs POST error when multi-get is not a {'key': [...]} structure (690.8ms)

RewriteTest
  * test Test basic rewrites on test_rewrite_suite_db (1902.2ms)
  * test Test basic rewrites on test_rewrite_suite_db%2Fwith_slashes (2086.6ms)

SecurityValidationTest
  * test Non-admin user cannot save a ddoc (750.0ms)
  * test Jerry can save a document normally (608.8ms)
  * test Force basic login (2.9ms)
  * test _session API (0.9ms)
  * test Saving document using the wrong credentials (1.0ms)
  * test Author presence and user security (1880.5ms)
  * test Ddoc writes with admin and replication contexts (985.7ms)

UUIDsTest
  * test Bad Request error when exceeding max UUID count (1.6ms)
  * test Method Not Allowed error on POST (1.1ms)
  * test no duplicates in 1,000 UUIDs (14.0ms)
  * test utc_random uuids are roughly random (22.0ms)
  * test can return single uuid (2.1ms)
  * test cache busting headers are set (1.0ms)
  * test utc_id uuids are correct (10.9ms)
  * test sequential uuids are sequential (22.7ms)

ViewCollationTest
  * test descending collation order (341.0ms)
  * test ascending collation order (5.6ms)
  * test inclusive_end=true (13.3ms)
  * test inclusive_end=false (13.7ms)
  * test key query option (80.7ms)

AllDocsTest
  * test All Docs tests (1420.8ms)

BulkDocsTest
  * test bulk docs raises error for missing `docs` parameter (648.2ms)
  * test bulk docs can create, update, & delete many docs per request (1670.9ms)
  * test bulk docs raises conflict error for combined update & delete (978.1ms)
  * test bulk docs raises error for `all_or_nothing` option (701.1ms)
  * test bulk docs raises error for invlaid `new_edits` parameter (655.4ms)
  * test bulk docs supplies `id` if not provided in doc (950.2ms)
  * test bulk docs can detect conflicts (1441.3ms)
  * test bulk docs emits conflict error for duplicate doc `_id`s (926.7ms)
  * test bulk docs raises error for invlaid `docs` parameter (851.9ms)

LotsOfDocsTest
  * test lots of docs with _all_docs (2918.2ms)
  * test lots of docs with a regular view (4067.6ms)

ConfigTest
  * test Keys not in the whitelist may not be modified (59.1ms)
  * test Standard config options are present (2.8ms)
  * test Settings can be altered with undefined whitelist allowing any change (7.9ms)
  * test Non-list whitelist values allow further modification of the whitelist (13.0ms)
  * test Non-term whitelist values allow further modification of the whitelist (111.6ms)
  * test CouchDB respects configured protocols (excluded)
  * test Atoms, binaries, and strings suffice as whitelist sections and keys. (211.9ms)
  * test PORT `BUGGED` ?raw tests from config.js (excluded)
  * test Server-side password hashing, and raw updates disabling that (72.0ms)
  * test Blacklist is functional (13.0ms)
  * test Non-2-tuples in the whitelist are ignored (11.5ms)

HelperTest
  * test retry_until handles assertions (0.01ms)
  * test retry_until times out (7.4ms)
  * test retry_until handles boolean conditions (0.01ms)

RevisionTest
  * test multiple updates with same _rev raise conflict errors (958.4ms)
  * test mismatched rev in body and etag returns error (1148.4ms)
  * test `new_edits: false` prevents bulk updates (COUCHDB-1178) (1352.1ms)
  * test mismatched rev in body and query string returns error (753.5ms)

CompactTest
  * test compaction reduces size of deleted docs (3073.0ms)

BatchSaveTest
  * test batch post (1686.8ms)
  * test batch put with identical doc ids (739.6ms)
  * test batch put (1603.9ms)

CoffeeTest
  * test CoffeeScript basic functionality (1522.8ms)


Finished in 336.7 seconds
135 tests, 0 failures, 5 excluded

Randomized with seed 384241

Related Issues or Pull Requests

maybe PR #1769

Checklist

  • Code is written and works correctly;
  • Changes are covered by tests;
  • Documentation reflects the changes;

@dottorblaster
Copy link
Copy Markdown
Member

Terrific! Just wait as I think that this needs to wait for Credo to land on master. Great contribution tho!

@van-mronov
Copy link
Copy Markdown
Contributor Author

van-mronov commented Nov 29, 2018

@dottorblaster sure, waiting for credo stuff

@van-mronov van-mronov force-pushed the couch-test-case branch 3 times, most recently from 2e3dbdc to e9c77c5 Compare December 6, 2018 03:09
@wohali
Copy link
Copy Markdown
Member

wohali commented Dec 6, 2018

@jaydoane any comments here?

@jaydoane
Copy link
Copy Markdown
Contributor

jaydoane commented Dec 7, 2018

@wohali yes, this LGTM. I also get the same results:

$ make elixir
[ * ] Setup environment ... ok
[ * ] Ensure CouchDB is built ... ok
[ * ] Prepare configuration files ... ok
[ * ] Start node node1 ... ok
[ * ] Start node node2 ... ok
[ * ] Start node node3 ... ok
[ * ] Check node at http://127.0.0.1:15984/ ... ok
[ * ] Check node at http://127.0.0.1:25984/ ... ok
[ * ] Check node at http://127.0.0.1:35984/ ... ok
[ * ] Running cluster setup ... ok
[ * ] Exec command test/elixir/run ... * creating /Users/jay/.mix/archives/hex-0.18.2

...snip...

ReplicationTest
  * test simple local-to-local replication - local-to-local (2028.3ms)
  * test replication by doc ids - remote-to-local (5530.7ms)
  * test filtered replications - local-to-local (818.6ms)
  * test non-admin or reader user on source - remote-to-remote (490.6ms)
  * test create_target filter option - local-to-local (459.0ms)
  * test filtered replications - remote-to-remote (792.5ms)
  * test continuous replication - local-to-remote (3740.7ms)
  * test continuous replication - local-to-local (3804.8ms)
  * test create_target filter option - remote-to-remote (426.7ms)
  * test validate_doc_update failure replications - local-to-local (540.6ms)
  * test continuous replication - remote-to-local (3866.1ms)
  * test continuous replication - remote-to-remote (4314.0ms)
  * test source database not found with path - COUCHDB-317 (14.4ms)
  * test non-admin user on target - remote-to-remote (502.8ms)
  * test compressed attachment replication - local-to-remote (4740.3ms)
  * test replication by doc ids - local-to-remote (5298.4ms)
  * test filtered replications - remote-to-local (790.5ms)
  * test filtered replications - local-to-remote (943.6ms)
  * test non-admin user on target - local-to-local (554.8ms)
  * test unauthorized replication cancellation (909.7ms)
  * test replication restarts after filter change - COUCHDB-892 - local-to-remote (621.3ms)
  * test source database not found with host (12.7ms)
  * test non-admin user on target - remote-to-local (551.0ms)
  * test simple remote-to-local replication - remote-to-local (2238.7ms)
  * test non-admin or reader user on source - local-to-local (567.7ms)
  * test replicate with since_seq - local-to-remote (468.7ms)
  * test replication by doc ids - local-to-local (5944.3ms)
  * test compressed attachment replication - remote-to-local (2694.6ms)
  * test replicate with since_seq - remote-to-local (414.5ms)
  * test simple remote-to-remote replication - remote-to-remote (2160.1ms)
  * test replication restarts after filter change - COUCHDB-892 - local-to-local (666.9ms)
  * test compressed attachment replication - remote-to-remote (1845.5ms)
  * test replicate with since_seq - local-to-local (876.6ms)
  * test replication restarts after filter change - COUCHDB-892 - remote-to-remote (1023.6ms)
  * test non-admin or reader user on source - local-to-remote (477.0ms)
  * test replication cancellation (1013.6ms)
  * test validate_doc_update failure replications - remote-to-remote (491.6ms)
  * test compressed attachment replication - local-to-local (3002.6ms)
  * test create_target filter option - local-to-remote (398.9ms)
  * test replicate with since_seq - remote-to-remote (563.7ms)
  * test create_target filter option - remote-to-local (577.1ms)
  * test replication by doc ids - remote-to-remote (5639.9ms)
  * test non-admin user on target - local-to-remote (585.1ms)
  * test simple local-to-remote replication - local-to-remote (2060.7ms)
  * test replication restarts after filter change - COUCHDB-892 - remote-to-local (667.0ms)
  * test replicating attachment without conflict - COUCHDB-885 (492.3ms)
  * test validate_doc_update failure replications - local-to-remote (583.6ms)
  * test non-admin or reader user on source - remote-to-local (543.6ms)
  * test source database does not exist (33.3ms)
  * test validate_doc_update failure replications - remote-to-local (481.1ms)

ReduceTest
  * test Reduce pagination (1045.9ms)
  * test Basic reduce functions (892.7ms)
  * test More complex reductions that need to use the combine option (1226.8ms)
  * test More complex array key view row testing (4948.5ms)

BasicsTest
  * test On restart, a request for creating an already existing db can not override (skipped)
  * test DELETE'ing a non-existent doc should 404 (371.6ms)
  * test Revs info status is good (233.1ms)
  * test PUT doc has a Location header (skipped)
  * test _bulk_docs POST error when body not an object (166.4ms)
  * test oops, the doc id got lost in code nirwana (227.5ms)
  * test Make sure you can do a seq=true option (287.4ms)
  * test Create a document and save it to the database (371.1ms)
  * test Database should be in _all_dbs (299.5ms)
  * test Empty database should have zero docs (381.2ms)
  * test Session contains adm context (1.3ms)
  * test Creating a new DB should return location header (237.4ms)
  * test Simple map functions (724.8ms)
  * test _all_docs POST error when multi-get is not a {'key': [...]} structure (250.0ms)
  * test Check for invalid document members (224.9ms)
  * test Regression test for COUCHDB-954 (skipped)
  * test POST doc with an _id field isn't overwritten by uuid (203.8ms)
  * test Created database has appropriate db info name (223.5ms)
  * test POST doc response has a Location header (209.2ms)
  * test PUT error when body not an object (286.3ms)
  * test Can create several documents (316.9ms)
  * test PUT on existing DB should return 412 instead of 500 (205.6ms)
  * test Creating a new DB with slashes should return Location header (COUCHDB-411) (343.2ms)
  * test Welcome endpoint (1.4ms)

SecurityValidationTest
  * test Author presence and user security (593.3ms)
  * test Saving document using the wrong credentials (2.7ms)
  * test Non-admin user cannot save a ddoc (229.4ms)
  * test _session API (1.1ms)
  * test Ddoc writes with admin and replication contexts (280.8ms)
  * test Force basic login (1.2ms)
  * test Jerry can save a document normally (312.8ms)

UUIDsTest
  * test utc_id uuids are correct (13.6ms)
  * test can return single uuid (2.9ms)
  * test cache busting headers are set (1.3ms)
  * test Bad Request error when exceeding max UUID count (1.6ms)
  * test utc_random uuids are roughly random (30.6ms)
  * test sequential uuids are sequential (30.4ms)
  * test no duplicates in 1,000 UUIDs (17.8ms)
  * test Method Not Allowed error on POST (1.7ms)

ViewCollationTest
  * test inclusive_end=false (150.0ms)
  * test descending collation order (8.8ms)
  * test inclusive_end=true (18.1ms)
  * test key query option (124.2ms)
  * test ascending collation order (3.0ms)

RewriteTest
  * test Test basic rewrites on test_rewrite_suite_db%2Fwith_slashes (677.7ms)
  * test Test basic rewrites on test_rewrite_suite_db (759.4ms)

AllDocsTest
  * test All Docs tests (546.3ms)

LotsOfDocsTest
  * test lots of docs with a regular view (1391.7ms)
  * test lots of docs with _all_docs (1013.9ms)

BulkDocsTest
  * test bulk docs emits conflict error for duplicate doc `_id`s (336.2ms)
  * test bulk docs supplies `id` if not provided in doc (202.3ms)
  * test bulk docs can detect conflicts (357.1ms)
  * test bulk docs raises error for missing `docs` parameter (161.4ms)
  * test bulk docs raises error for invlaid `new_edits` parameter (219.8ms)
  * test bulk docs raises error for invlaid `docs` parameter (136.7ms)
  * test bulk docs raises error for `all_or_nothing` option (297.2ms)
  * test bulk docs can create, update, & delete many docs per request (390.4ms)
  * test bulk docs raises conflict error for combined update & delete (216.7ms)

ConfigTest
  * test Blacklist is functional (14.8ms)
  * test PORT `BUGGED` ?raw tests from config.js (skipped)
  * test Server-side password hashing, and raw updates disabling that (54.4ms)
  * test Keys not in the whitelist may not be modified (12.8ms)
  * test Atoms, binaries, and strings suffice as whitelist sections and keys. (87.7ms)
  * test CouchDB respects configured protocols (skipped)
  * test Non-2-tuples in the whitelist are ignored (8.4ms)
  * test Non-term whitelist values allow further modification of the whitelist (6.4ms)
  * test Settings can be altered with undefined whitelist allowing any change (6.0ms)
  * test Standard config options are present (1.6ms)
  * test Non-list whitelist values allow further modification of the whitelist (5.7ms)

HelperTest
  * test retry_until times out (7.8ms)
  * test retry_until handles assertions (0.01ms)
  * test retry_until handles boolean conditions (0.01ms)

RevisionTest
  * test `new_edits: false` prevents bulk updates (COUCHDB-1178) (289.6ms)
  * test multiple updates with same _rev raise conflict errors (342.0ms)
  * test mismatched rev in body and etag returns error (270.6ms)
  * test mismatched rev in body and query string returns error (186.4ms)

CompactTest
  * test compaction reduces size of deleted docs (1044.8ms)

CoffeeTest
  * test CoffeeScript basic functionality (833.7ms)

BatchSaveTest
  * test batch put with identical doc ids (441.2ms)
  * test batch post (725.7ms)
  * test batch put (633.7ms)


Finished in 120.8 seconds
135 tests, 0 failures, 5 skipped

Randomized with seed 351341

Copy link
Copy Markdown
Contributor

@jaydoane jaydoane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

informal +1

@wohali wohali merged commit 77eb982 into apache:master Dec 7, 2018
@van-mronov van-mronov deleted the couch-test-case branch December 7, 2018 21:55
van-mronov added a commit to van-mronov/couchdb that referenced this pull request Dec 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants