diff options
author | Eric Avdey <eiri@eiri.ca> | 2018-12-06 15:32:43 -0400 |
---|---|---|
committer | Eric Avdey <eiri@eiri.ca> | 2018-12-10 19:28:02 -0400 |
commit | 5350907e123f63243596b8b6e3e34267ec15def5 (patch) | |
tree | 058d6e80703335bf3d459d93ecbcf16fd90f5055 | |
parent | 3a46fb4fcd3b9426875bc8621459001b9f7e2cab (diff) | |
download | couchdb-5350907e123f63243596b8b6e3e34267ec15def5.tar.gz |
Port delayed_commits test to Elixir
-rw-r--r-- | test/elixir/README.md | 2 | ||||
-rw-r--r-- | test/elixir/test/delayed_commits_test.exs | 31 |
2 files changed, 32 insertions, 1 deletions
diff --git a/test/elixir/README.md b/test/elixir/README.md index e80df1f31..54de35929 100644 --- a/test/elixir/README.md +++ b/test/elixir/README.md @@ -33,7 +33,7 @@ X means done, - means partially - [ ] Port conflicts.js - [ ] Port cookie_auth.js - [ ] Port copy_doc.js - - [ ] Port delayed_commits.js + - [X] Port delayed_commits.js - [ ] Port design_docs.js - [ ] Port design_options.js - [ ] Port design_paths.js diff --git a/test/elixir/test/delayed_commits_test.exs b/test/elixir/test/delayed_commits_test.exs new file mode 100644 index 000000000..e80d0bdfb --- /dev/null +++ b/test/elixir/test/delayed_commits_test.exs @@ -0,0 +1,31 @@ +defmodule DelayedCommitsTest do + use CouchTestCase + + @moduledoc """ + Test CouchDB delayed commits + This is a port of the delayed_commits.js suite + + Note that delayed_commits is deprecated in 2.0, so this is a minimal + test to show it still works. delayed_commits will be removed in 3.0. + """ + + @tag config: [ + {"couchdb", "delayed_commits", "true"} + ] + @tag :with_db + test "delayed commit", context do + db_name = context[:db_name] + doc_id = "doc-1" + resp = Couch.put("/#{db_name}/#{doc_id}", body: %{a: 2, b: 4}) + assert resp.status_code in 201..204 + assert resp.body["ok"] + + resp = Couch.get("/#{db_name}/#{doc_id}") + assert resp.status_code == 200, "The new doc should be in the database" + + restart_cluster() + + resp = Couch.get("/#{db_name}/#{doc_id}") + assert resp.status_code == 404, "The new doc should be missing" + end +end |