New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: port coffee.js to Elixir test suite #1760

Merged
merged 1 commit into from Nov 28, 2018

Conversation

Projects
None yet
4 participants
@dottorblaster
Copy link
Contributor

dottorblaster commented Nov 23, 2018

Overview

I just ported coffee.js to the Elixir test suite.

Testing recommendations

Issue make elixir

Related Issues or Pull Requests

None

Checklist

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

@moduletag :coffee
@headers ["X-Couch-Full-Commit": "false"]

This comment has been minimized.

@jaydoane

jaydoane Nov 23, 2018

Contributor

Not sure if we need this header any more. I ran this test with that header removed, and it also passed.

This comment has been minimized.

@dottorblaster

dottorblaster Nov 24, 2018

Contributor

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.

This comment has been minimized.

@dottorblaster

dottorblaster Nov 24, 2018

Contributor

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)

This comment has been minimized.

@jaydoane

jaydoane Nov 23, 2018

Contributor

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)

This comment has been minimized.

@dottorblaster

dottorblaster Nov 24, 2018

Contributor

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!

@dottorblaster dottorblaster force-pushed the dottorblaster:port-coffee-js-test-to-elixir branch from b8f3229 to ec93044 Nov 24, 2018

@dottorblaster

This comment has been minimized.

Copy link
Contributor

dottorblaster commented Nov 24, 2018

@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 retry_until logic.

Thanks for pointing out that retry_until can be used anyway, I think it'll be useful for future ports! 👍 And thanks for the review man 😎

@van-mronov van-mronov referenced this pull request Nov 27, 2018

Merged

Check code format before running elixir test suite #1767

0 of 3 tasks complete
@wohali

This comment has been minimized.

Copy link
Member

wohali commented Nov 28, 2018

@dottorblaster Keeping in mind #1767, please re-run make elixir on this PR after rebasing on master and ensure that your new test conforms to the coding standard.

Once I have a +1 from you I'll merge this PR. Thanks!

@dottorblaster dottorblaster force-pushed the dottorblaster:port-coffee-js-test-to-elixir branch from ec93044 to f4295bb Nov 28, 2018

@dottorblaster dottorblaster force-pushed the dottorblaster:port-coffee-js-test-to-elixir branch from f4295bb to 662b523 Nov 28, 2018

@dottorblaster

This comment has been minimized.

Copy link
Contributor

dottorblaster commented Nov 28, 2018

@wohali done. Thanks!

@garrensmith garrensmith merged commit 78b0a7d into apache:master Nov 28, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@dottorblaster dottorblaster deleted the dottorblaster:port-coffee-js-test-to-elixir branch Nov 28, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment