activegraph icon indicating copy to clipboard operation
activegraph copied to clipboard

ActiveGraph exception prevents single tests from running.

Open knirirr opened this issue 1 year ago • 2 comments

In a Rails 7.1.3 application with activegraph-f86d54c8ebf6, neo4j-ruby-driver-4.4.5, and Neo4j 4.1.6 the test_helper file contains require 'active_graph'. Running all the tests with rake test is fine, but running single test with e.g. rails test test/models/example_model.rb will throw the following exception:

~/.rvm/gems/ruby-3.2.2@my_app/bundler/gems/activegraph-f86d54c8ebf6/lib/active_graph.rb:32:in `<main>': uninitialized constant ActiveGraph (NameError)

Neo4j::Driver::Result.prepend ActiveGraph::Core::Result
                                               ^^^^^^^^
Did you mean?  ActiveSupport
	from ~/.rvm/gems/ruby-3.2.2@my_app/gems/bootsnap-1.17.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
	from ~/.rvm/gems/ruby-3.2.2@my_app/gems/bootsnap-1.17.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
	from ~/Work/Web/MyApp-API/test/test_helper.rb:4:in `<main>'
	from ~/.rvm/gems/ruby-3.2.2@my_app/gems/bootsnap-1.17.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
	from ~/.rvm/gems/ruby-3.2.2@my_app/gems/bootsnap-1.17.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
	from ~/Work/Web/MyApp-API/test/models/my_app_record_test.rb:1:in `<main>'
	from ~/.rvm/gems/ruby-3.2.2@my_app/gems/bootsnap-1.17.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
	from ~/.rvm/gems/ruby-3.2.2@my_app/gems/bootsnap-1.17.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
	from ~/.rvm/gems/ruby-3.2.2@my_app/gems/railties-7.1.3/lib/rails/test_unit/runner.rb:51:in `block in load_tests'
	from ~/.rvm/gems/ruby-3.2.2@my_app/gems/railties-7.1.3/lib/rails/test_unit/runner.rb:51:in `each'
	from ~/.rvm/gems/ruby-3.2.2@my_app/gems/railties-7.1.3/lib/rails/test_unit/runner.rb:51:in `load_tests'
	from ~/.rvm/gems/ruby-3.2.2@my_app/gems/railties-7.1.3/lib/rails/test_unit/runner.rb:43:in `run'
	from ~/.rvm/gems/ruby-3.2.2@my_app/gems/railties-7.1.3/lib/rails/commands/test/test_command.rb:33:in `perform'
	from ~/.rvm/gems/ruby-3.2.2@my_app/gems/thor-1.3.0/lib/thor/command.rb:28:in `run'
	from ~/.rvm/gems/ruby-3.2.2@my_app/gems/thor-1.3.0/lib/thor/invocation.rb:127:in `invoke_command'
	from ~/.rvm/gems/ruby-3.2.2@my_app/gems/railties-7.1.3/lib/rails/command/base.rb:178:in `invoke_command'
	from ~/.rvm/gems/ruby-3.2.2@my_app/gems/thor-1.3.0/lib/thor.rb:527:in `dispatch'
	from ~/.rvm/gems/ruby-3.2.2@my_app/gems/railties-7.1.3/lib/rails/command/base.rb:73:in `perform'
	from ~/.rvm/gems/ruby-3.2.2@my_app/gems/railties-7.1.3/lib/rails/command.rb:71:in `block in invoke'
	from ~/.rvm/gems/ruby-3.2.2@my_app/gems/railties-7.1.3/lib/rails/command.rb:149:in `with_argv'
	from ~/.rvm/gems/ruby-3.2.2@my_app/gems/railties-7.1.3/lib/rails/command.rb:69:in `invoke'
	from ~/.rvm/gems/ruby-3.2.2@my_app/gems/railties-7.1.3/lib/rails/commands.rb:18:in `<main>'
	from ~/.rvm/gems/ruby-3.2.2@my_app/gems/bootsnap-1.17.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
	from ~/.rvm/gems/ruby-3.2.2@my_app/gems/bootsnap-1.17.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
	from bin/rails:4:in `<main>'

This appears to originate from the require call in test_helper.

knirirr avatar Jan 25 '24 12:01 knirirr

@knirirr could you check activegraph-11.5.0.beta.3? Thank you

klobuczek avatar Jan 25 '24 19:01 klobuczek

Apologies, I didn't see the notification. For the moment I've re-written my code to use the Neo4j http interface instead. So, please feel free to close this unless you think it would be of any use to anyone else.

knirirr avatar Feb 06 '24 19:02 knirirr