Working on a test where two users login one after the other. Also adding debug info about the login/logout of davaz.com to track the problem.
Pushed commit Added login test for two browsers. But this tests works.
Modifying it to test against the real davaz.com, to be sure, that my mocking of the yus and db_manager did not introduce any error. It passes on http://davaz.com, too.
Adding at test starting from URL en/works/movies/#111, to see whether after a login we can edit the movie directly.
While playing around here I suddenly did see this unexpected error
NoMethodError: undefined method `switch_zone' for #<DaVaz::State::LoginForm:0x00564fb94aaab0> /home/niklaus/git/davaz.com/src/util/session.rb:75:in `active_state' /home/niklaus/git/sbsm/lib/sbsm/session.rb:218:in `block in process_rack' /home/niklaus/git/sbsm/lib/sbsm/session.rb:210:in `synchronize' /home/niklaus/git/sbsm/lib/sbsm/session.rb:210:in `process_rack' /home/niklaus/git/sbsm/lib/sbsm/app.rb:130:in `call' /home/niklaus/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rack-2.0.1/lib/rack/lint.rb:49:in `_call' /home/niklaus/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rack-2.0.1/lib/rack/lint.rb:37:in `call' /home/niklaus/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rack-2.0.1/lib/rack/show_exceptions.rb:23:in `call' /home/niklaus/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rack-2.0.1/lib/rack/static.rb:149:in `call' /home/niklaus/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rack-2.0.1/lib/rack/content_length.rb:15:in `call' /home/niklaus/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rack-2.0.1/lib/rack/reloader.rb:45:in `call' /home/niklaus/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rack-2.0.1/lib/rack/common_logger.rb:33:in `call' /home/niklaus/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rack-2.0.1/lib/rack/tempfile_reaper.rb:15:in `call' /home/niklaus/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rack-2.0.1/lib/rack/lint.rb:49:in `_call' /home/niklaus/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rack-2.0.1/lib/rack/lint.rb:37:in `call' /home/niklaus/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rack-2.0.1/lib/rack/show_exceptions.rb:23:in `call' /home/niklaus/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rack-2.0.1/lib/rack/common_logger.rb:33:in `call' /home/niklaus/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rack-2.0.1/lib/rack/chunked.rb:54:in `call' /home/niklaus/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rack-2.0.1/lib/rack/content_length.rb:15:in `call' /home/niklaus/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rack-2.0.1/lib/rack/handler/webrick.rb:86:in `service' /home/niklaus/.rbenv/versions/2.3.1/lib/ruby/2.3.0/webrick/httpserver.rb:140:in `service' /home/niklaus/.rbenv/versions/2.3.1/lib/ruby/2.3.0/webrick/httpserver.rb:96:in `run' /home/niklaus/.rbenv/versions/2.3.1/lib/ruby/2.3.0/webrick/server.rb:296:in `block in start_thread' ::1 - - [15/Mar/2017:09:42:52 +0100] "GET /en/admin/login_form/ HTTP/1.1" 500 76351 0.0302
I was doing a login in movies, switched to Shop. Is this the consequence of my trying to remove VOLATILE_STATE = true in LoginForm?
Changing the test_login_then_logout to check the presence of the Logout after going to Guestbook AND Movies. Analysing the log.
There are two different session_ids used when we visit Guestbook and Movies. They are stored in the request.cookies. Do we have an error there? Also I am looking whether for testing-purposes I can use deterministic session_id and not a random number, which changes from RUN to run. Using a global variable. Remarked that I opened a new session even when the request just returned a file. Fixed this problem. Now the session_id goes from 1 to 4, which is still wrong.
I think I found the culprit. The request.headers contain twice the session_id, e.g language=en; _session_id=0000000000000002; remember=generate_token; name=juerg%40davaz.com; language=en; _session_id=0000000000000008
Now I am able to break using binding.pry if /0000000000000004/.match(request.inspect.to_s) && /0000000000000002/.match(request.inspect.to_s)
when running test/feature/login_out_test.rb
.
In the file /var/www/sandoz.xmlconv.bbmb.ch/svc/log/main/current
on fastpower we found many entries like
XmlConv::Util::Mail.notify xmlconv@ywesee.com -> ["yasaka@ywesee.com"] subject: XmlConv2 - Polling-Error Skipping as RUBY_VERSON is 2.3.1
In lib/xmlconv/util/mail.rb I have
def Mail.notify recipients, my_subject, my_body unless /^1\.8/.match(RUBY_VERSION) puts "XmlConv::Util::Mail.notify #{ XmlConv::CONFIG.mail_from} -> #{recipients} subject: #{my_subject}" puts "Skipping as RUBY_VERSON is #{RUBY_VERSION}" return end <...>
If we run under Ruby 2.3.1 we skip sending mail.