test: port coffee.js to Elixir test suite#1760
Conversation
| use CouchTestCase | ||
|
|
||
| @moduletag :coffee | ||
| @headers ["X-Couch-Full-Commit": "false"] |
There was a problem hiding this comment.
Not sure if we need this header any more. I ran this test with that header removed, and it also passed.
There was a problem hiding this comment.
Yeah, I tried with and without the header and it was ~worthless, it seemed to get better but it didn't solve anything. We can drop it out eventually, I agree.
There was a problem hiding this comment.
With the new approach, the need for this header became absolute zero. I removed it indeed. Thanks!
|
|
||
| # Giving time to the database to complete sync, otherwise values | ||
| # would be messed up and the test would be so much flaky | ||
| :timer.sleep(100) |
There was a problem hiding this comment.
Using a fixed sleep time is still very fragile (since CI machines can be much slower than your dev env), and I would recommend using a more robust synchronization technique. You could do something like:
retry_until(fn ->
%{"rows" => values} =
Couch.get("/#{db_name}/_design/coffee/_view/myview",
headers: @headers
).body
assert 5 === hd(values)["value"]
end)There was a problem hiding this comment.
I think we would have to discuss about an official way to check collection consistency right after an update 😬 this looks fine, I'll try. Thanks for pointing this out!
b8f3229 to
ec93044
Compare
|
@jaydoane I think I came out with a cleverer approach in the end. Since we don't care about that specific execution order and we are testing the coffeescript query language here, now the test plays with documents first, then it receives the design document that builds the index. This way we work around the eventual consistency for the purpose of this test and we don't need any Thanks for pointing out that |
|
@dottorblaster Keeping in mind #1767, please re-run Once I have a +1 from you I'll merge this PR. Thanks! |
ec93044 to
f4295bb
Compare
f4295bb to
662b523
Compare
|
@wohali done. Thanks! |
Overview
I just ported
coffee.jsto the Elixir test suite.Testing recommendations
Issue
make elixirRelated Issues or Pull Requests
None
Checklist