Code Monkey home page Code Monkey logo

Comments (12)

agrare avatar agrare commented on July 17, 2024 2

@Fryguy this test? https://github.com/ManageIQ/manageiq-cross_repo-tests/runs/6692135533?check_suite_focus=true#step:6:2265
Seems to still be an issue, I do see it occasionally on PRs as well

from manageiq-api.

Fryguy avatar Fryguy commented on July 17, 2024 1

it failed at the time for this seed consistently...it's possible things have changed and we have to find a new seed.

from manageiq-api.

kbrock avatar kbrock commented on July 17, 2024

@Fryguy do you remember if this always failed for the seed, or if this is just plain sporadic.

Unfortunately, this is working for me.

from manageiq-api.

kbrock avatar kbrock commented on July 17, 2024

tried 3 times, will try some more. These are all passing for me for now.

for i in {1..20} ; do be rspec spec/requests/authentication_spec.rb || break ; done

(not sure if the break will successfully kick in, so just running 20 times a pop.)
It is taking 25s per iteration - so 10 minutes for the loop to run.

from manageiq-api.

Fryguy avatar Fryguy commented on July 17, 2024

I'm pretty sure I saw this recently - wish I had recorded the seed πŸ˜•

from manageiq-api.

Fryguy avatar Fryguy commented on July 17, 2024

Hmmm - maybe not - don't see anything in GitHub Actions. Maybe it's fixed.

from manageiq-api.

Fryguy avatar Fryguy commented on July 17, 2024

I'm gonna close - I also can't reproduce with the given seed, and I also ran it 100 times locally.

from manageiq-api.

Fryguy avatar Fryguy commented on July 17, 2024

I can't reproduce directly with seed 2979 as seen in that link...perhaps it needs more files?

from manageiq-api.

jrafanie avatar jrafanie commented on July 17, 2024

ok, so I looked at this and the only way I can see this is happening is if the return from token_get_info is an empty hash or a hash without token_ttl key:

token_info = token_service.token_mgr(requester_type).token_get_info(auth_token)
res = {
:auth_token => auth_token,
:token_ttl => token_info[:token_ttl],

This can happen in a few scenarios:

https://github.com/ManageIQ/manageiq/blob/c2a5828bf17d7744c7ab17fe4880589184940369/lib/token_manager.rb#L41-L46

  1. token_valid? is false (nil token, empty string, or not found in the token_store)
  2. Note: a nil return here would cause the calling method to blow up with undefined method [] for nil, which isn't happening. So, it's not line 44
  3. reading the token is returning an empty hash {}

With this knowledge, it must be a contamination or timing issue where we're either sporadically using an invalid token for these failing examples or we read the token and it's empty. Perhaps this is a timing problem on ActionDispatch::Session::MemoryStore or more likely, we're stubbing or caching the various things such as token manager or the token store and some state changes are retained across tests.

I am unable to find a seed that recreates this issue so it's hard to track things down. I do wonder if resetting the caches such as we do in the users_spec would help.

from manageiq-api.

jrafanie avatar jrafanie commented on July 17, 2024

Note, the prior comment is in regards to a recent failure in github actions on a cross repo. It's important to note, it's still using memory store:

 ** override_gem("manageiq-ui-classic", :path=>"/home/runner/work/manageiq-cross_repo-tests/manageiq-cross_repo-tests/repos/ManageIQ/manageiq-ui-classic@35401b4006f98665f75a9675e13bfff7332ab0ef") at /home/runner/work/manageiq-cross_repo-tests/manageiq-cross_repo-tests/repos/ManageIQ/manageiq-api@0c841dcd5757445443a1bea64002fb0a2584cb7a/spec/manageiq/bundler.d/overrides.rb:1
  ** Using session_store: ActionDispatch::Session::MemoryStore
  ** ManageIQ master, codename: Oparin
  ** ManageIQ master, codename: Oparin
  ** override_gem("manageiq-ui-classic", :path=>"/home/runner/work/manageiq-cross_repo-tests/manageiq-cross_repo-tests/repos/ManageIQ/manageiq-ui-classic@35401b4006f98665f75a9675e13bfff7332ab0ef") at /home/runner/work/manageiq-cross_repo-tests/manageiq-cross_repo-tests/repos/ManageIQ/manageiq-api@0c841dcd5757445443a1bea64002fb0a2584cb7a/spec/manageiq/bundler.d/overrides.rb:1
  ** Using session_store: ActionDispatch::Session::MemoryStore
  ** ManageIQ master, codename: Oparin
  
  Randomized with seed 19159
  Top level ::CompositeIO is deprecated, require 'multipart/post' and use `Multipart::Post::CompositeReadIO` instead!
  Top level ::Parts is deprecated, require 'multipart/post' and use `Multipart::Post::Parts` instead!
  .........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................F............F.............F...........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
  
  Failures:
  
    1) Authentication API Token Based Authentication when using a cache session store Tokens for Web Sockets gets a UI based token_ttl when requesting token for web sockets
       Failure/Error: expect(response.parsed_body["token_ttl"]).to eq(::Settings.session.timeout.to_i_with_method)
  
         expected: 3600
              got: nil
  
         (compared using ==)
       # ./spec/requests/authentication_spec.rb:371:in `block (6 levels) in <top (required)>'
  
    2) Authentication API Token Based Authentication when using a sql session store Tokens for Web Sockets gets a UI based token_ttl when requesting token for web sockets
       Failure/Error: expect(response.parsed_body["token_ttl"]).to eq(::Settings.session.timeout.to_i_with_method)
  
         expected: 3600
              got: nil
  
         (compared using ==)
       # ./spec/requests/authentication_spec.rb:371:in `block (6 levels) in <top (required)>'
  
    3) Authentication API Token Based Authentication when using a memory session store Tokens for Web Sockets gets a UI based token_ttl when requesting token for web sockets
       Failure/Error: expect(response.parsed_body["token_ttl"]).to eq(::Settings.session.timeout.to_i_with_method)
  
         expected: 3600
              got: nil
  
         (compared using ==)
       # ./spec/requests/authentication_spec.rb:371:in `block (6 levels) in <top (required)>'

from manageiq-api.

kbrock avatar kbrock commented on July 17, 2024

@jrafanie nailed it. Or at least pointed to something that I want to resolve (if not the full solution): #1171

from manageiq-api.

kbrock avatar kbrock commented on July 17, 2024

Ok, so I am diving into a different spot for this spec.
Looking at comments from Nick around why that code was introduced in the first place.

It is possible there is a nil hanging around:
e5bc44c

I'm not able to reproduce Nick's example.

If this is not resolved, may want to look into using stub_settings_merge instead of directly setting the session timeout

from manageiq-api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.