An error occurred while loading ./plugins/poll/spec/integration/poll_endpoints_spec.rb.
Failure/Error: raise ArgumentError.new(“No setting named ‘#{name}’ exists”)
To run just the poll specs the command is: bundle exec rake "plugin:spec[poll]" (or shorter: bin/rake "plugin:spec[poll]") otherwise you’re running all plugins specs.
Regarding the error you’re getting, I’m not sure. Is the test database migrated? (bin/rails db:migrate RAILS_ENV=test)
Thanks. Like you said, it did run all the plugin specs, which I worked around by removing the other plugins. I was basing off of this, but it turns out the parentheses were in the wrong spot.
Yes, the database is migrated in the test environment. I worked around this error by commenting out the raise ArgumentError.new("No setting named '#{name}' exists") line and replacing it with a puts, and it shows only discourse_narrative_bot_enabled triggers this error; all other settings are fine. I don’t think we did anything with this setting. Anyway, since my spec run properly while ignoring this error, I can leave the workaround in my local discourse. When I find what actually caused this, I’ll update this post.
Our CI works for PR’s and commits, but on cron job it’s failing here every time.
I’m able to reproduce this on the rails console by a similar block:
[19] pry(main)> SiteSetting.defaults.tap do |s|
[19] pry(main)* s.set_regardless_of_locale(:discourse_narrative_bot_enab, false)
[19] pry(main)* end
ArgumentError: No setting named 'discourse_narrative_bot_enab' exists
This works if I put:
[21] pry(main)> SiteSetting.defaults.tap do |s|
[21] pry(main)* if s.has_setting? :discourse_narrative_bot_enab
[21] pry(main)* s.set_regardless_of_locale(:discourse_narrative_bot_enab, false)
[21] pry(main)* end
[21] pry(main)* end
and just to check, fails with:
[21] pry(main)> SiteSetting.defaults.tap do |s|
[21] pry(main)* if s.has_setting? :discourse_narrative_bot_enabled
[21] pry(main)* s.set_regardless_of_locale(:discourse_narrative_bot_enab, false)
[21] pry(main)* end
[21] pry(main)* end
So I propose the following change in a PR which I’d be happy to submit:
if ENV['LOAD_PLUGINS'] == '1' && s.has_setting? :discourse_narrative_bot_enabled
For some reason the presence of the narrative bot plugin can’t be guaranteed?
In these examples you have the site setting as discourse_narrative_bot_enab, not discourse_narrative_bot_enabled. I’m guessing once that’s corrected, it’s not reproducable?
The most surprising thing here is:
That suggests a difference in the runtime environment for the scheduled runs
Looking at one of the fail logs it seems like GitHub is cloning the multilingual plugin directly into the plugins directory, rather than into its own directory. So it’s essentially ‘uninstalling’ all the core plugins (and failing to install itself properly)
I suspect, to make cron work, we’ll need to replace all the occurences of github.event.repository.name with something else:
Looking at the docs, it doesn’t look like there’s a consistent way to get the repository name (without the owner), so we’ll need some trickery. I think this should do it:
cc @CvX - maybe we should use this technique in the plugin/theme template CI?