« Return to Thread: rake build issue related to foreign key constraints?

Re: rake build issue related to foreign key constraints?

by Patrick Joyce :: Rate this Message:

Reply to Author | View in Thread

Did anyone ever find a solution to this? My tests pass when I run "rake test" in the work directory but when cc.rb runs the tests I get an error on every test after the test in which the Schedules fixture is loaded. All tests before the schedules fixture is loaded pass. It seems as though that table isn't being cleared. Any idea why this would happen?

Name: test_should_allow_site_admin(Admin::TemplatesControllerTest) Type: Error Message: ActiveRecord::StatementInvalid: Mysql::Error: #23000Cannot delete or update a parent row: a foreign key constraint fails (`sandwichboard_cruisecontrol/schedules`, CONSTRAINT `fk_schedule_restaurants` FOREIGN KEY (`restaurant_id`) REFERENCES `restaurants` (`id`)): TRUNCATE TABLE restaurants  /Users/patrick/cruisecontrolrb/projects/SandwichBoard/work/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:128:in `log' /Users/patrick/cruisecontrolrb/projects/SandwichBoard/work/vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:243:in `execute' /Users/patrick/cruisecontrolrb/projects/SandwichBoard/work/vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:258:in `update' /Users/patrick/cruisecontrolrb/projects/SandwichBoard/work/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:47:in `delete' ./test/functional/admin/../../test_helper.rb:96:in `delete_existing_fixtures_for' ./test/functional/admin/../../test_helper.rb:92:in `delete_existing_fixtures' /Users/patrick/cruisecontrolrb/projects/SandwichBoard/work/vendor/rails/activerecord/lib/active_record/fixtures.rb:256:in `create_fixtures' /Users/patrick/cruisecontrolrb/projects/SandwichBoard/work/vendor/rails/activerecord/lib/active_record/fixtures.rb:256:in `each' /Users/patrick/cruisecontrolrb/projects/SandwichBoard/work/vendor/rails/activerecord/lib/active_record/fixtures.rb:256:in `create_fixtures' /Users/patrick/cruisecontrolrb/projects/SandwichBoard/work/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:59:in `transaction' /Users/patrick/cruisecontrolrb/projects/SandwichBoard/work/vendor/rails/activerecord/lib/active_record/fixtures.rb:255:in `create_fixtures' /Users/patrick/cruisecontrolrb/projects/SandwichBoard/work/vendor/rails/activerecord/lib/active_record/base.rb:867:in `silence' /Users/patrick/cruisecontrolrb/projects/SandwichBoard/work/vendor/rails/activerecord/lib/active_record/fixtures.rb:248:in `create_fixtures' /Users/patrick/cruisecontrolrb/projects/SandwichBoard/work/vendor/rails/activerecord/lib/active_record/fixtures.rb:593:in `load_fixtures' /Users/patrick/cruisecontrolrb/projects/SandwichBoard/work/vendor/rails/activerecord/lib/active_record/fixtures.rb:538:in `setup_with_fixtures' /Users/patrick/cruisecontrolrb/projects/SandwichBoard/work/vendor/rails/activerecord/lib/active_record/fixtures.rb:575:in `setup' /Users/patrick/cruisecontrolrb/projects/SandwichBoard/work/vendor/plugins/mocha/lib/mocha/test_case_adapter.rb:18:in `run'



Travis Walters-2 wrote:
I'm setting up cruisecontrol.rb to build a simple rails project.  When I run rake test from the work directory manually all tests pass and the build is successful but when I run the build thru cc it fails with an error on a create table statement saying the table already exists.  Any suggestions would be very much appreciated.  Also, if I run the rake command with a trace the results show different values when run through cc than when I run the same test task manually (Execute environment call when run manually doesn't appear in my trace for cc).
 
 
 
 
_______________________________________________
Cruisecontrolrb-users mailing list
Cruisecontrolrb-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/cruisecontrolrb-users

 « Return to Thread: rake build issue related to foreign key constraints?