Hi,

Thanks for doing this investigative work and finding the solution, to a problem 
that I have been unable to reproduce. I have just committed the change.

I know that during implementation there were a few changes to the changeset 
stuff between Time and DataTime classes.

In the day job we came across a similar issue, whereby when your timezone was 
not UTC, the test would fail, however this doesn't seem to be the issue in this 
case.

Which version of Ruby are you using? I'm using 
ruby -v
ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]
on the debian server that runs the continuous integration server 
http://cruise.openstreetmap.org/
and
ruby -v
ruby 1.8.7 (2008-08-11 patchlevel 72) [universal-darwin10.0]
on my development machine, which is Mac OS X.

I suspect that the problem is that you are running an older version of Ruby.

Shaun

On 17 Jan 2010, at 16:50, Steve wrote:

> Hi everyone,
>  
> Ubuntu server 8.04.3 install
>  
> Whenever I ran 'rake test', I would get 3 unit errors and 39 functional 
> failures ie:
>  
>   1) Error:
> test_create(NodeTest):
> OSM::APIChangesetAlreadyClosedError: The changeset 1 was closed at Tue Jan 12 
> 18:46:10 UTC 2010
>     lib/consistency_validations.rb:29:in `check_create_consistency'
>     app/models/node.rb:180:in `create_with_history'
>     /test/unit/node_test.rb:85:in `test_create'
>  
> with the 2nd and 3rd errors always complaining about changeset closed also, 
> and functional test errors like:
>  
>  36) Failure:
> test_update_relation_tags_via_upload(RelationControllerTest)
>     [/test/functional/relation_controller_test.rb:835:in `with_update_diff'
>      /test/functional/../test_helper.rb:86:in `with_controller'
>      /test/functional/relation_controller_test.rb:825:in `with_update_diff'
>      /test/functional/relation_controller_test.rb:314:in 
> `test_update_relation_tags_via_upload'
>      /test/functional/relation_controller_test.rb:792:in `with_relation'
>      /test/functional/relation_controller_test.rb:307:in 
> `test_update_relation_tags_via_upload']:
> can't upload diff relation: The changeset 2 was closed at Wed Jan 13 06:27:56 
> UTC 2010.
> Expected response to be a <:success>, but was <409>
>  
> Again, complaining about closed changesets.
>  
> Finally, after five (possibly more) OS, Ruby, Rails and Rails_port 
> reinstalls, decided to look at the code even though previous posts concerning 
> this error were always thought to be ruby/rails, or outdated svn rails_port 
> problems. http://www.mail-archive.com/dev@openstreetmap.org/msg07830.html
>  
> Found that in /app/models/changeset.rb open changesets are determined by,
>  
>   def is_open?
>     return ((closed_at > Time.now.getutc) and (num_changes <= MAX_ELEMENTS))
>   end
>  
> Here the Ruby 'Time' function is called referencing UTC, but in 
> /tests/fixtures/changsets.yml the 'Open" changesets were polulated with:
>  
>   closed_at: <%= DateTime.now + Rational(1,24) %>
>  
> Ruby 'Time' and "DateTime' are not interchangeable: 
> http://stackoverflow.com/questions/279769/convert-to-from-datetime-and-time-in-ruby
>  
> They are 2 defferent classes.
>  
> I modified my local changesets.yml to use Time.now.utc only, ie:
>  
> # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
> normal_user_first_change:
>   id: 1
>   user_id: 1
>   created_at: "2007-01-01 00:00:00"
>   closed_at: <%= Time.now.utc + 86400 %>
>   min_lon: <%= 1 * SCALE %>
>   min_lat: <%= 1 * SCALE %>
>   max_lon: <%= 5 * SCALE %>
>   max_lat: <%= 5 * SCALE %>
>   num_changes: 11
>  
> public_user_first_change:
>   id: 2
>   user_id: 2
>   created_at: <%= Time.now.utc %>
>   closed_at: <%= Time.now.utc + 86400 %>
>   num_changes: 0
>  
> Where the 86400 is 24 hours in seconds, and all 3 errors and 39 failures 
> disappeared, and 100% 'rake test's’ now pass!
>  
> Haven't looked into why DateTime would work on some installs and not others, 
> (timezone, local date format??) but just fixing the changesets.yml to be 
> consistent with how the open changeset is being determined seems to work like 
> it should.
>  
> Would someone with svn write capability want to update changesets.yml?  I can 
> post the code as the file is not too long.
>  
> Bye,
> Steve
> _______________________________________________
> dev mailing list
> dev@openstreetmap.org
> http://lists.openstreetmap.org/listinfo/dev

_______________________________________________
dev mailing list
dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/dev

Reply via email to