Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Authentication with sorcery #210

Open
PedroAugustoRamalhoDuarte opened this issue Apr 27, 2022 · 4 comments
Open

Authentication with sorcery #210

PedroAugustoRamalhoDuarte opened this issue Apr 27, 2022 · 4 comments

Comments

@PedroAugustoRamalhoDuarte

Hello, I am trying to setup a sorcery (https://github.com/Sorcery/sorcery) to use derailed benchmarks, but struggling with it, i try do setup this code inside perf.rake:

class SorceryAuth < DerailedBenchmarks::AuthHelper
  def setup
    require 'sorcery'
    require 'sorcery/controller'
    extend ::Sorcery::TestHelpers::Rails::Controller
    extend ::Sorcery::TestHelpers::Rails::Request
    extend ::Sorcery::TestHelpers::Rails::Integration
    extend ::Sorcery::Controller::InstanceMethods
    # initialize code here
  end

  def call(env)
    # log something in on each request
    login(User.first.email, '1234', remember_me = false)
    app.call(env)
  end
end

DerailedBenchmarks.auth = SorceryAuth.new

When i run:

USE_AUTH=true PATH_TO_HIT='/library/library/livros' derailed exec perf:stackprof

I receive the following error:

/home/pedro/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/sorcery-0.16.3/lib/sorcery/controller.rb:52:in `block in login': undefined local variable or method `session' for #<SorceryAuth:0x0000556237a2a078> (NameError)
Did you mean?  old_session

Thanks for the help!!

@PedroAugustoRamalhoDuarte PedroAugustoRamalhoDuarte changed the title Autentication with sorcery Authentication with sorcery Apr 27, 2022
@schneems
Copy link
Member

schneems commented Jun 3, 2022

If you can provide an https://www.codetriage.com/example_app that reproduces the problem then maybe I can take a look.

@PedroAugustoRamalhoDuarte
Copy link
Author

@schneems thanks for the support, i will provide soon

@PedroAugustoRamalhoDuarte
Copy link
Author

PedroAugustoRamalhoDuarte commented Nov 20, 2022

Hello @schneems , i have build the repo to reproduce the problem (https://github.com/PedroAugustoRamalhoDuarte/derailed_benchmarks_sorcery), try to run: USE_AUTH=true derailed exec perf:stackprof

@PedroAugustoRamalhoDuarte
Copy link
Author

PedroAugustoRamalhoDuarte commented Nov 20, 2022

Sorcery have 3 types of test helpers (https://github.com/Sorcery/sorcery/wiki/Testing-Rails), i have tried with all options and didn't succeed, each one with a different problem.

The best way is using auto_login from sorcery, but its uses sessions and i think is not enable when we execute derailed, because this error:

undefined local variable or method `session' for #<SorceryAuth:0x00007f259719d138 @app=#<DerailedBencgmarksSorcery::Application>> (NameError)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants