Skip to content
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

Build tidiness #233

Merged
merged 8 commits into from
Apr 24, 2016
Merged

Build tidiness #233

merged 8 commits into from
Apr 24, 2016

Conversation

rgarner
Copy link
Contributor

@rgarner rgarner commented Apr 5, 2016

  • Nix Object#timeout deprecation warnings when building with 2.3.0
  • Fix Reel adapter/tests seam to be broken #230 by not running Celluloid in backported mode
  • Fix a problem whereby Socket#close does not actually block on closing the socket. Ruby thinks it's closed, but the OS has it in a brief TIME_WAIT state. There's seemingly no good way of detecting this, so we combine sleeping after close with reverting to before(:all) for adapter lint tests and having each adapter's server live for the duration of all adapter_lint tests instead of restarting on every test.
  • Add 2.2.0/2.3.0 to Travis YML
  • Fix NoMethodError: undefined methodspec' for nil:NilClass` which occurred in various of Travis's rubies due to old bundler versions by updating bundler before build

* Use Timeout.timeout, not Object#timeout
* http://git.io/vJf3J
* This appears consistently to fix the red Reel tests
@rgarner rgarner closed this Apr 5, 2016
@rgarner rgarner deleted the build-tidiness branch April 5, 2016 21:48
@rgarner rgarner restored the build-tidiness branch April 5, 2016 21:48
@rgarner rgarner deleted the build-tidiness branch April 5, 2016 21:56
@rgarner rgarner restored the build-tidiness branch April 5, 2016 21:56
@rgarner
Copy link
Contributor Author

rgarner commented Apr 6, 2016

Oh my word, github, you really are in a mood tonight.

@rgarner rgarner reopened this Apr 6, 2016
* Avoids NoMethodError: undefined method `spec' for nil:NilClass
* Similar approach used in thoughtbot/factory_bot@3c0547f
@rgarner rgarner force-pushed the build-tidiness branch 2 times, most recently from cab9deb to 0899628 Compare April 6, 2016 21:26
In order to 'reserve' a free TCP Server port, we create a TCPServer,
take a note of its port number, and then immediately close it.
We'd then ask our adapter to use the port we just finished with via
that adapter's configuration.

While this isn't a particularly safe way of 'reserving' a port,
it's the best we can do with heterogeneous adapters that have a one-way
config method.

However, this would cause intermittent test failures when our 'canary'
socket did not get out of the way in time for an adapter to bind its
server. Socket#close does not actually block until the socket is
closed at OS level, it just frees the Ruby handle to it.

Actually waiting for the socket to become free or garbage-collecting
it to force the issue is counterproductive – we'd need to poll the port
or run a full GC, which would take more time than a
simple sleep. Additionally, the sleep needs to be tuned so that tests
 are not unduly slowed by it – too quick and we'll see failures, too
 slow and our builds will reflect it.
Using let-style RSpec and lazily creating our servers before every
test is good from a test purity point of view but increases greatly the
risk of port collisions when we attempt to find a free port to run
our adapter in adapter_lint (bearing in mind that Socket#close only
releases the Ruby resources, and the socket persists in a TIME_WAIT
state for an indeterminate period of time at OS level).

Revert to before(:all) and create only one server that will be used
for the duration of all tests in adapter_lint. We still need to sleep
 to ensure our 'free' ports are available, but we reduce the risk of
 servers being unavailable. This also has the happy side effect of
 making the tests somewhat faster.
@seancribbs
Copy link
Member

This looks good to me. Is there a reason not to have Ruby 2.2 in the build?

@rgarner
Copy link
Contributor Author

rgarner commented Apr 9, 2016

No good reason, no. Really I was just avoiding it to try and make the build time more tolerable while still acknowledging latest stable.

For reasons we can't currently fathom, Rubinius has a tendency to fail
the build. Rather than let this continue to be the case, until such
time as someone has time to figure out precisely why, unblock other PRs
by letting builds pass with MRI Rubies for now.
@rfestag
Copy link
Contributor

rfestag commented Apr 23, 2016

Should we wait for this to be merged into master before merging into other PRs (like #235), or would it be fine to pull in to them now to get tests passing?

@Asmod4n
Copy link
Member

Asmod4n commented Apr 23, 2016

I am going to run this a couple times on travis now.
If it always succeeds ill merge them soonish ™️

@Asmod4n
Copy link
Member

Asmod4n commented Apr 24, 2016

builds all the time, merge merge.

@Asmod4n Asmod4n merged commit 9d6307e into master Apr 24, 2016
@Asmod4n
Copy link
Member

Asmod4n commented Apr 24, 2016

Next step would be to extract all adapters except those shipped by ruby itself to be moved to different gems.

Could there be a way to load them automatically when needed? @seancribbs @rgarner

@rgarner
Copy link
Contributor Author

rgarner commented Apr 24, 2016

screen shot 2016-04-24 at 09 15 19

The relief ... now to work out why Rubinius is such a pain and fix it.

@rgarner rgarner deleted the build-tidiness branch April 24, 2016 08:18
@Asmod4n Asmod4n mentioned this pull request Apr 24, 2016
@Asmod4n
Copy link
Member

Asmod4n commented Apr 24, 2016

@rgarner i believe it will work when done it like i said back here: #196

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.

Reel adapter/tests seam to be broken
4 participants