On 06/05/2013 11:50 AM, Antonio Terceiro wrote:
On Wed, Jun 05, 2013 at 12:48:52AM -0400, Sam Ruby wrote:On 06/05/2013 12:31 AM, Praveen A wrote:We should add a package that runs at least these sequence of commands rails new foobar .... rake test when any of the dependencies for the default app is changed and make all those packages depend on this test package. Or we could have some other method which will notify us when we break this loop.I have exactly such a package. :-) In fact, it is an official part of the Rails release process: https://github.com/rails/rails/blob/master/RELEASING_RAILS.rdoc#is-sam-ruby-happy--if-not-make-him-happy When it fails, it sends me an IM (using XMPP), it sends messages to #rails-contrib on irc.freenode.net, and sends a CampFire notification to the rails core developers. Current results: http://intertwingly.net/projects/dashboard.html Everything needed to run the tests is on github: https://github.com/rubys/awdwr#readme Right now, I run this code against versions of rails from git. The same could would readily run against Debian installed versions of Rails and other gems. I'll gladly set this up on debian hardware. Or run it on my hardware and send notifications to wherever desired.I was starting to create something in that direction here: http://anonscm.debian.org/gitweb/?p=pkg-ruby-extras/ruby-debian-qa.git;a=summary My intention is to add tests to other Ruby packages besides Rails, and have this running on http://jenkins.debian.net/
Excellent! How can I help?
I will be happy to replace my very simple Rails test which yours. Is there a way to run those tests without installing anything, so that I can just do `apt-get install rails` and then run the tests? I couldn't figure this out from a quick read at the README.
I do have it down to a single command: "vagrant up"; but that is for Ubuntu and running Rails from git, so lets set that aside for the moment.
Running just the tests on Jesse/sid, using system installed versions of rails and other gems, is "just" a matter of checking out the tests, setting a few environment variables, installing a few gems that haven't yet been converted to .debs and running a single command. It looks like I am making good progress on this front, and if $DAYJOB doesn't intrude too much, I should have something that I can share -- and you can run for yourself -- in a day or three.
---But lets talk a moment about the bigger picture. My git repository, awdwr, is a test that the scenario described in my book, Agile Web Development with Rails[1], actually works. As I described elsewhere[2], I did this totally in self defense.
Along the way, I decided to factor out my testing framework from the tests, resulting in a gem named 'gorp'. You've already seen the output[3], now let me show you a simple test:
https://gist.github.com/rubys/5715383What this test does is "rails new depot; rails generate scaffold Product; rake db:migrate; rake test". For the last step, it verifies that there is at least one line written to stderr, and that each line written to stderr contains the string ", 0 failures, 0 errors".
I'm attaching the output of this test so that you can see what it produces. Note that it captures when the test was run, what gems are installed and even the debian version information.
For larger tests, I find it helpful to split the tests into sections, and to put the verification into a separate file. You can see examples at [4] and [5]. Each section shows up on a separate page in the dashboard[6].
I have some Rails specific support, most notably for starting and stopping the server, but tests don't need to be Rails specific. But mostly, the scripts involve editing files and running commands.
Net-net: if you have commands that produce output to stdout and stderr, the gorp gem can help you build a reproducible and self-verifying test case.
---By way of introduction, I've used various Unixes for over thirty years. I switched to Linux around 1998. I initially used RedHat because that seemed to be what everybody was using at the time. I switched to Debian in 2003 as I was concerned about the Fedora split. Turns out I had no reason to be concerned, but frankly I liked Debian better so I stayed. In 2005, I switched to Ubuntu as Debian wasn't consistently putting out releases at the time, so my choice was between stale and unstable, and pinning individual packages wasn't any fun either. Clearly, Debian is better now, but I don't have any compelling reason to switch at the moment.
Along the way, I contributed to PHP[7] and the ASF[8], so I know my way around "./configure" and am confident that I not have any problem conquering deb2gem.
So the offer is: if you help me get started, I'll promise to add more value than the time I consume asking questions.
Oh, and my editor of choice is vim. :-) - Sam Ruby [1] http://pragprog.com/magazines/2013-06/keeping-rails-on-the-rails [2] http://pragprog.com/book/rails4/agile-web-development-with-rails-4 [2] http://intertwingly.net/projects/dashboard.html [4] https://github.com/rubys/awdwr/blob/master/edition4/makedepot.rb#L27 [5] https://github.com/rubys/awdwr/blob/master/edition4/checkdepot.rb#L32 [6] http://intertwingly.net/projects/AWDwR4/checkdepot-193-40/ [7] http://php.net/credits.php [8] http://apache.org/foundation/board/Title: basic_rails_test
Create the application.
rails new depot
create
create README.rdoc
create Rakefile
create config.ru
create .gitignore
create Gemfile
create app
create app/assets/images/rails.png
create app/assets/_javascript_s/application.js
create app/assets/stylesheets/application.css
create app/controllers/application_controller.rb
create app/helpers/application_helper.rb
create app/views/layouts/application.html.erb
create app/mailers/.gitkeep
create app/models/.gitkeep
create config
create config/routes.rb
create config/application.rb
create config/environment.rb
create config/environments
create config/environments/development.rb
create config/environments/production.rb
create config/environments/test.rb
create config/initializers
create config/initializers/backtrace_silencers.rb
create config/initializers/inflections.rb
create config/initializers/mime_types.rb
create config/initializers/secret_token.rb
create config/initializers/session_store.rb
create config/initializers/wrap_parameters.rb
create config/locales
create config/locales/en.yml
create config/boot.rb
create config/database.yml
create db
create db/seeds.rb
create doc
create doc/README_FOR_APP
create lib
create lib/tasks
create lib/tasks/.gitkeep
create lib/assets
create lib/assets/.gitkeep
create log
create log/.gitkeep
create public
create public/404.html
create public/422.html
create public/500.html
create public/favicon.ico
create public/index.html
create public/robots.txt
create script
create script/rails
create test/fixtures
create test/fixtures/.gitkeep
create test/functional
create test/functional/.gitkeep
create test/integration
create test/integration/.gitkeep
create test/unit
create test/unit/.gitkeep
create test/performance/browsing_test.rb
create test/test_helper.rb
create tmp/cache
create tmp/cache/assets
create vendor/assets/_javascript_s
create vendor/assets/_javascript_s/.gitkeep
create vendor/assets/stylesheets
create vendor/assets/stylesheets/.gitkeep
create vendor/plugins
create vendor/plugins/.gitkeep
run bundle install --local
Resolving dependencies...
Using rake (10.0.4)
Using i18n (0.6.1)
Using multi_json (1.3.6)
Using activesupport (3.2.13)
Using builder (3.2.0)
Using activemodel (3.2.13)
Using erubis (2.7.0)
Using journey (1.0.4)
Using rack (1.5.2)
Using rack-cache (1.2)
Using rack-test (0.6.2)
Using hike (1.2.1)
Using tilt (1.3.3)
Using sprockets (2.4.3)
Using actionpack (3.2.13)
Using mime-types (1.23)
Using polyglot (0.3.3)
Using treetop (1.4.10)
Using mail (2.5.4)
Using actionmailer (3.2.13)
Using arel (3.0.2)
Using tzinfo (0.3.33)
Using activerecord (3.2.13)
Using activeresource (3.2.13)
Using bundler (1.3.5)
Using coffee-script-source (1.3.3)
Using execjs (1.4.0)
Using coffee-script (2.2.0)
Using rack-ssl (1.3.2)
Using rdoc (3.9.4)
Using thor (0.18.1)
Using railties (3.2.13)
Using coffee-rails (3.2.2)
Using jquery-rails (2.0.2)
Using rails (3.2.13)
Using sass (3.2.9)
Using sass-rails (3.2.5)
Using sqlite3 (1.3.6)
Using uglifier (1.2.5)
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
Create a simple resource.
rails generate scaffold Product
invoke active_record
create db/migrate/20130605170257_create_products.rb
create app/models/product.rb
invoke test_unit
create test/unit/product_test.rb
create test/fixtures/products.yml
invoke resource_route
route resources :products
invoke scaffold_controller
create app/controllers/products_controller.rb
invoke erb
create app/views/products
create app/views/products/index.html.erb
create app/views/products/edit.html.erb
create app/views/products/show.html.erb
create app/views/products/new.html.erb
create app/views/products/_form.html.erb
invoke test_unit
create test/functional/products_controller_test.rb
invoke helper
create app/helpers/products_helper.rb
invoke test_unit
create test/unit/helpers/products_helper_test.rb
invoke assets
invoke coffee
create app/assets/_javascript_s/products.js.coffee
invoke scss
create app/assets/stylesheets/products.css.scss
invoke scss
create app/assets/stylesheets/scaffolds.css.scss
rake db:migrate
mv 20130605170257_create_products.rb 20130605000001_create_products.rb
== CreateProducts: migrating =================================================
-- create_table(:products)
-> 0.0012s
== CreateProducts: migrated (0.0013s) ========================================
Run the provided tests.
rake test
Loaded suite /usr/lib/ruby/vendor_ruby/rake/rake_test_loader
Started
E
===============================================================================
Error: test_should_create_product(ProductsControllerTest)
NoMethodError: undefined method `load_session' for nil:NilClass
===============================================================================
E
===============================================================================
Error: test_should_create_product(ProductsControllerTest)
NoMethodError: undefined method `each' for nil:NilClass
===============================================================================
E
===============================================================================
Error: test_should_destroy_product(ProductsControllerTest)
NoMethodError: undefined method `load_session' for nil:NilClass
===============================================================================
E
===============================================================================
Error: test_should_destroy_product(ProductsControllerTest)
NoMethodError: undefined method `each' for nil:NilClass
===============================================================================
E
===============================================================================
Error: test_should_get_edit(ProductsControllerTest)
NoMethodError: undefined method `load_session' for nil:NilClass
===============================================================================
E
===============================================================================
Error: test_should_get_edit(ProductsControllerTest)
NoMethodError: undefined method `each' for nil:NilClass
===============================================================================
E
===============================================================================
Error: test_should_get_index(ProductsControllerTest)
NoMethodError: undefined method `load_session' for nil:NilClass
===============================================================================
E
===============================================================================
Error: test_should_get_index(ProductsControllerTest)
NoMethodError: undefined method `each' for nil:NilClass
===============================================================================
E
===============================================================================
Error: test_should_get_new(ProductsControllerTest)
NoMethodError: undefined method `load_session' for nil:NilClass
===============================================================================
E
===============================================================================
Error: test_should_get_new(ProductsControllerTest)
NoMethodError: undefined method `each' for nil:NilClass
===============================================================================
E
===============================================================================
Error: test_should_show_product(ProductsControllerTest)
NoMethodError: undefined method `load_session' for nil:NilClass
===============================================================================
E
===============================================================================
Error: test_should_show_product(ProductsControllerTest)
NoMethodError: undefined method `each' for nil:NilClass
===============================================================================
E
===============================================================================
Error: test_should_update_product(ProductsControllerTest)
NoMethodError: undefined method `load_session' for nil:NilClass
===============================================================================
E
===============================================================================
Error: test_should_update_product(ProductsControllerTest)
NoMethodError: undefined method `each' for nil:NilClass
===============================================================================
Finished in 0.00718847 seconds.
7 tests, 0 assertions, 0 failures, 14 errors, 0 pendings, 0 omissions, 0 notifications
0% passed
973.78 tests/s, 0.00 assertions/s
Errors running test:functionals! #<RuntimeError: Command failed with status (1): [ruby -I"lib:test" -I"/usr/lib/ruby/vendor_ruby" "/usr/lib/ruby/vendor_ruby/rake/rake_test_loader.rb" "test/functional/**/*_test.rb" ]>
Wed, 05 Jun 2013 17:03:05 GMT
rake about
About your application's environment
Ruby version 1.9.3 (x86_64-linux)
RubyGems version 1.8.23
Rack version 1.5
Rails version 3.2.13
_javascript_ Runtime Node.js (V8)
Active Record version 3.2.13
Action Pack version 3.2.13
Active Resource version 3.2.13
Action Mailer version 3.2.13
Active Support version 3.2.13
Middleware ActionDispatch::Static, Rack::Lock, #<ActiveSupport::Cache::Strategy::LocalCache::Middleware:0x000000017f2500>, Rack::Runtime, Rack::MethodOverride, ActionDispatch::RequestId, Rails::Rack::Logger, ActionDispatch::ShowExceptions, ActionDispatch::DebugExceptions, ActionDispatch::RemoteIp, ActionDispatch::Reloader, ActionDispatch::Callbacks, ActiveRecord::ConnectionAdapters::ConnectionManagement, ActiveRecord::QueryCache, ActionDispatch::Cookies, ActionDispatch::Session::CookieStore, ActionDispatch::Flash, ActionDispatch::ParamsParser, ActionDispatch::Head, Rack::ConditionalGet, Rack::ETag, ActionDispatch::BestStandardsSupport
Application root /home/rubys/tmp/work/depot
Environment development
Database adapter sqlite3
Database schema version 20130605000001
gem list
actionmailer (3.2.13)
actionpack (3.2.13)
activemodel (3.2.13)
activerecord (3.2.13)
activeresource (3.2.13)
activesupport (3.2.13)
arel (3.0.2)
blankslate (2.1.2.4)
builder (3.2.0, 3.0.4)
bundler (1.3.5)
coffee-rails (3.2.2)
coffee-script (2.2.0)
coffee-script-source (1.3.3)
erubis (2.7.0)
execjs (1.4.0)
hike (1.2.1)
i18n (0.6.1)
journey (1.0.4)
jquery-rails (2.0.2)
jquery-ui-rails (4.0.3)
json (1.8.0)
mail (2.5.4)
mime-types (1.23)
multi_json (1.3.6)
net-http-persistent (2.8)
nokogiri (1.5.9)
polyglot (0.3.3)
rack (1.5.2, 1.4.5)
rack-cache (1.2)
rack-ssl (1.3.2)
rack-test (0.6.2)
rails (3.2.13)
railties (3.2.13)
rake (10.0.4)
rdoc (3.9.4)
sass (3.2.9)
sass-rails (3.2.5)
sprockets (2.4.3, 2.2.2, 2.1.3)
sqlite3 (1.3.6)
test-unit (2.5.4)
thor (0.18.1)
tilt (1.3.3)
treetop (1.4.10)
tzinfo (0.3.33)
uglifier (1.2.5)
yajl-ruby (1.1.0)
echo $RUBYLIB | sed "s/:/\n/g"
/home/rubys/git/gorp/lib
gem -v
1.8.23
/usr/bin/ruby1.9.1 -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]
nodejs -v
v0.6.19
echo $PATH
/usr/local/bin
/usr/bin
/bin
/usr/local/games
/usr/games
cat /etc/debian_version
jessie/sid
uname -srm
Linux 3.5.0-32-generic x86_64