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.
Nosso CI funciona para PRs e commits, mas no job cron ele falha aqui toda vez.
Consigo reproduzir isso no console do Rails com um bloco semelhante:
[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
Isso funciona se eu colocar:
[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
E só para verificar, falha com:
[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
Então proponho a seguinte alteração em um PR, que ficarei feliz em submeter:
if ENV['LOAD_PLUGINS'] == '1' && s.has_setting? :discourse_narrative_bot_enabled
Por algum motivo, a presença do plugin narrativo não pode ser garantida?
Nesses exemplos, você tem a configuração do site como discourse_narrative_bot_enab, não discourse_narrative_bot_enabled. Imagino que, uma vez corrigido, não seja reproduzível?
A coisa mais surpreendente aqui é:
Isso sugere uma diferença no ambiente de execução para as execuções agendadas
Olhando para um dos logs de falha, parece que o GitHub está clonando o plugin multilíngue diretamente no diretório plugins, em vez de em seu próprio diretório. Então, ele está essencialmente ‘desinstalando’ todos os plugins principais (e falhando em instalar a si mesmo corretamente)
Olhando para a documentação, não parece haver uma maneira consistente de obter o nome do repositório (sem o proprietário), então precisaremos de alguns truques. Acho que isso deve funcionar:
cc @cvx - talvez devêssemos usar essa técnica no CI do template de plugin/tema?