jasmine / jasmine-gem

Jasmine ruby gem
681 stars 275 forks source link

Add ability to adjust hostname on CI #269

Closed tansaku closed 7 years ago

tansaku commented 8 years ago

Hi there, apologies if this is totally the wrong way to submit something. I'm just struggling with some really weird issues on travis CI - the travis folks suggested switching from localhost to 127.0.0.1 which I couldn't do with the existing config - so I forked and made this code.

The error I've been struggling with is:

$ USE_JASMINE_RAKE=true bundle exec rake jasmine:ci
[2016-08-11 01:25:32] INFO  WEBrick 1.3.1
[2016-08-11 01:25:32] INFO  ruby 2.3.1 (2016-04-26) [x86_64-linux]
rake aborted!
Errno::EINVAL: Invalid argument - connect(2) for "localhost" port 59417
/home/travis/build/AgileVentures/LocalSupport/vendor/bundle/ruby/2.3.0/gems/jasmine-2.4.0/lib/jasmine/base.rb:25:in `initialize'
/home/travis/build/AgileVentures/LocalSupport/vendor/bundle/ruby/2.3.0/gems/jasmine-2.4.0/lib/jasmine/base.rb:25:in `open'
/home/travis/build/AgileVentures/LocalSupport/vendor/bundle/ruby/2.3.0/gems/jasmine-2.4.0/lib/jasmine/base.rb:25:in `server_is_listening_on'
/home/travis/build/AgileVentures/LocalSupport/vendor/bundle/ruby/2.3.0/gems/jasmine-2.4.0/lib/jasmine/base.rb:35:in `wait_for_listener'
/home/travis/build/AgileVentures/LocalSupport/vendor/bundle/ruby/2.3.0/gems/jasmine-2.4.0/lib/jasmine/ci_runner.rb:34:in `run'
/home/travis/build/AgileVentures/LocalSupport/vendor/bundle/ruby/2.3.0/gems/jasmine-2.4.0/lib/jasmine/tasks/jasmine.rake:47:in `block (2 levels) in <top (required)>'
/home/travis/build/AgileVentures/LocalSupport/vendor/bundle/ruby/2.3.0/gems/airbrake-5.4.4/lib/airbrake/rake/task_ext.rb:19:in `execute'
/home/travis/build/AgileVentures/LocalSupport/vendor/bundle/ruby/2.3.0/gems/rake-11.2.2/exe/rake:27:in `<top (required)>'
/home/travis/.rvm/gems/ruby-2.3.1@global/gems/bundler-1.12.5/lib/bundler/cli/exec.rb:63:in `load'
/home/travis/.rvm/gems/ruby-2.3.1@global/gems/bundler-1.12.5/lib/bundler/cli/exec.rb:63:in `kernel_load'
/home/travis/.rvm/gems/ruby-2.3.1@global/gems/bundler-1.12.5/lib/bundler/cli/exec.rb:24:in `run'
/home/travis/.rvm/gems/ruby-2.3.1@global/gems/bundler-1.12.5/lib/bundler/cli.rb:304:in `exec'
/home/travis/.rvm/gems/ruby-2.3.1@global/gems/bundler-1.12.5/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/home/travis/.rvm/gems/ruby-2.3.1@global/gems/bundler-1.12.5/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/home/travis/.rvm/gems/ruby-2.3.1@global/gems/bundler-1.12.5/lib/bundler/vendor/thor/lib/thor.rb:359:in `dispatch'
/home/travis/.rvm/gems/ruby-2.3.1@global/gems/bundler-1.12.5/lib/bundler/vendor/thor/lib/thor/base.rb:440:in `start'
/home/travis/.rvm/gems/ruby-2.3.1@global/gems/bundler-1.12.5/lib/bundler/cli.rb:11:in `start'
/home/travis/.rvm/gems/ruby-2.3.1@global/gems/bundler-1.12.5/exe/bundle:27:in `block in <top (required)>'
/home/travis/.rvm/gems/ruby-2.3.1@global/gems/bundler-1.12.5/lib/bundler/friendly_errors.rb:98:in `with_friendly_errors'
/home/travis/.rvm/gems/ruby-2.3.1@global/gems/bundler-1.12.5/exe/bundle:19:in `<top (required)>'
/home/travis/.rvm/gems/ruby-2.3.1/bin/bundle:23:in `load'
/home/travis/.rvm/gems/ruby-2.3.1/bin/bundle:23:in `<main>'
/home/travis/.rvm/gems/ruby-2.3.1/bin/ruby_executable_hooks:15:in `eval'
/home/travis/.rvm/gems/ruby-2.3.1/bin/ruby_executable_hooks:15:in `<main>'
[2016-08-11 01:25:32] INFO  WEBrick::HTTPServer#start: pid=20244 port=59417
Tasks: TOP => jasmine:ci
(See full trace by running task with --trace)
[2016-08-11 01:25:32] INFO  going to shutdown ...
[2016-08-11 01:25:32] INFO  WEBrick::HTTPServer#start done.

You can see the full build here:

https://travis-ci.org/AgileVentures/LocalSupport/builds/151389370

I can't see any CONTRIBUTING.md on best practice for PRs, so I guess I'll get this in as an exploratory one ...

Apologies in advance if this is rude or the wrong way to make suggestions

tansaku commented 8 years ago

the travis fail above looks like a network issue:

Gem::InstallError: mime-types-data requires Ruby version >= 2.0.
An error occurred while installing mime-types-data (3.2016.0521), and Bundler
cannot continue.
Make sure that `gem install mime-types-data -v '3.2016.0521'` succeeds before
bundling.
The command "bundle install --retry=3" failed and exited with 5 during .

any chance someone with permissions could re-run that particular build (ruby 1.9.3 and rails 4)

slackersoft commented 8 years ago

I think it is probably fair that wait_for_listener should check on the host that has been setup with the existing host config option. I don't think we want to introduce a new config option, that should probably always be a duplicate of the existing option. Please make this change and remove the duplicate hostname option and we'll take another look.

Additionally, Jasmine itself actually uses this gem on travis-ci to test itself, so it seems like there might actually be something else going on there. Although we don't use a custom host.

tansaku commented 8 years ago

hi @slackersoft - if we don't have the hostname option how do we set it? Currently host contains the "http://" prefix by default. You think we should manipulate the string to extract the hostname rather than setting it separately?

slackersoft commented 7 years ago

I think it would be a nicer interface to use the same setting for both hostname and host. I think it makes sense to strip off an /https?:\/\// from the host to determine the hostname to check for ports.