Skip to content

Remove the description field from the elections component seeds#9448

Merged
andreslucena merged 2 commits intodecidim:developfrom
mainio:fix/elections-seeds
Jun 17, 2022
Merged

Remove the description field from the elections component seeds#9448
andreslucena merged 2 commits intodecidim:developfrom
mainio:fix/elections-seeds

Conversation

@ahukkanen
Copy link
Copy Markdown
Contributor

@ahukkanen ahukkanen commented Jun 16, 2022

🎩 What? Why?

After #9401 was merged, some specs started failing because the description field was still in the elections component's seeds.

This wasn't spotted at #9401 because it only ran the elections specs.

📌 Related Issues

Testing

See that CI is green.

📋 Checklist

  • CONSIDER adding a unit test if your PR resolves an issue.
  • ✔️ DO check open PR's to avoid duplicates.
  • ✔️ DO keep pull requests small so they can be easily reviewed.
  • ✔️ DO build locally before pushing.
  • ✔️ DO make sure tests pass.
  • ✔️ DO make sure any new changes are documented in docs/.
  • ✔️ DO add and modify seeds if necessary.
  • ✔️ DO add CHANGELOG upgrade notes if required.
  • ✔️ DO add to GraphQL API if there are new public fields.
  • ✔️ DO add link to MetaDecidim if it's a new feature.
  • AVOID breaking the continuous integration build.
  • AVOID making significant changes to the overall architecture.

@ahukkanen ahukkanen added type: internal PRs that aren't necessary to add to the CHANGELOG for implementers module: elections labels Jun 16, 2022
@ahukkanen ahukkanen requested a review from andreslucena June 16, 2022 19:22
@andreslucena
Copy link
Copy Markdown
Member

Great! I just saw this in nightly, that as it seeds the DB in a clean state, tonight has broken.

Copy link
Copy Markdown
Member

@andreslucena andreslucena left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still seeing the same error:

$ bin/rails db:drop db:create db:migrate && bin/rails db:seed
(...)
Creating seeds for the participatory_processes space...
-- Creating pages component seeds for the participatory space with ID: 1...
-- Creating meetings component seeds for the participatory space with ID: 1...
-- Creating proposals component seeds for the participatory space with ID: 1...
-- Creating budgets component seeds for the participatory space with ID: 1...
-- Creating surveys component seeds for the participatory space with ID: 1...
-- Creating accountability component seeds for the participatory space with ID: 1...
-- Creating debates component seeds for the participatory space with ID: 1...
-- Creating sortitions component seeds for the participatory space with ID: 1...
-- Creating blogs component seeds for the participatory space with ID: 1...
-- Creating elections component seeds for the participatory space with ID: 1...
rails aborted!
ActiveModel::UnknownAttributeError: unknown attribute 'description' for Decidim::Elections::Question.
/home/apereira/Work/decidim/decidim/development_app/db/seeds.rb:9:in `<main>'
/home/apereira/Work/decidim/decidim/development_app/bin/rails:5:in `<top (required)>'
/home/apereira/Work/decidim/decidim/development_app/bin/spring:10:in `block in <top (required)>'
/home/apereira/Work/decidim/decidim/development_app/bin/spring:7:in `<top (required)>'
Tasks: TOP => db:seed
(See full trace by running task with --trace)

There are other Questions in this same file for the different type of Elections.

This is what worked for me:

diff --git a/decidim-elections/lib/decidim/elections/component.rb b/decidim-elections/lib/decidim/elections/component.rb
index 000cb511de..004ec02401 100644
--- a/decidim-elections/lib/decidim/elections/component.rb
+++ b/decidim-elections/lib/decidim/elections/component.rb
@@ -113,9 +113,6 @@ Decidim.register_component(:elections) do |component|
           {
             election: upcoming_election,
             title: Decidim::Faker::Localized.sentence(word_count: 2),
-            description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
-              Decidim::Faker::Localized.paragraph(sentence_count: 3)
-            end,
             max_selections: Faker::Number.between(from: 1, to: 3),
             weight: Faker::Number.number(digits: 1),
             random_answers_order: Faker::Boolean.boolean(true_ratio: 0.5),
@@ -213,9 +210,6 @@ Decidim.register_component(:elections) do |component|
           {
             election: finished_election,
             title: Decidim::Faker::Localized.sentence(word_count: 2),
-            description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
-              Decidim::Faker::Localized.paragraph(sentence_count: 3)
-            end,
             max_selections: 2,
             weight: Faker::Number.number(digits: 1),
             random_answers_order: Faker::Boolean.boolean(true_ratio: 0.5),
@@ -336,9 +330,6 @@ Decidim.register_component(:elections) do |component|
           {
             election: election_with_results,
             title: Decidim::Faker::Localized.sentence(word_count: 2),
-            description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
-              Decidim::Faker::Localized.paragraph(sentence_count: 3)
-            end,
             max_selections: 2,
             weight: Faker::Number.number(digits: 1),
             random_answers_order: Faker::Boolean.boolean(true_ratio: 0.5),
@@ -456,9 +447,6 @@ Decidim.register_component(:elections) do |component|
         {
           election: ongoing_election,
           title: Decidim::Faker::Localized.sentence(word_count: 2),
-          description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
-            Decidim::Faker::Localized.paragraph(sentence_count: 3)
-          end,
           max_selections: 2,
           weight: Faker::Number.number(digits: 1),
           random_answers_order: Faker::Boolean.boolean(true_ratio: 0.5),

I cannot do the comment/suggestion in GH as it's out of the scope of the change. Can you check it please? Thanks

@ahukkanen
Copy link
Copy Markdown
Contributor Author

I'm still seeing the same error:

Ah sorry, I just removed the first occurrence as I thought it's the only one.

Removed the rest as well.

Copy link
Copy Markdown
Member

@andreslucena andreslucena left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, it works as expected locally, thanks!

@andreslucena
Copy link
Copy Markdown
Member

Looks like we have a failing unrelated spec from decidim-elections, that isn't being fixed by retrying:

image

Let's wait for this last attempt, but I think we should merge it even if it fails again, as its unrelated to this fix, and the seeds bug is messing up with CI in other PRs (and develop). I'll report it and escalate it to the e-voting contractors, so this is handled properly.

@ahukkanen
Copy link
Copy Markdown
Contributor Author

Looks like we have a failing unrelated spec from decidim-elections, that isn't being fixed by retrying:

Yes I noticed.

Let's wait for this last attempt, but I think we should merge it even if it fails again, as its unrelated to this fix, and the seeds bug is messing up with CI in other PRs (and develop). I'll report it and escalate it to the e-voting contractors, so this is handled properly.

Yep, I just wanted to get the build fixed before merging any other PRs.

I'm currently investigating the problem and it is failing on this line:

expect(page).to have_content("Upload your identification keys")

Which is called e.g. here:

This message is not visible if the public key is blank for the trustee, so I think there is some other spec that is interfering with this process. Because when I locally run this particular test ONLY, I cannot make it fail.

I'll see if I can figure out what is causing it.

@andreslucena andreslucena mentioned this pull request Jun 17, 2022
12 tasks
@ahukkanen
Copy link
Copy Markdown
Contributor Author

All green @andreslucena, it's a flaky one.

@andreslucena
Copy link
Copy Markdown
Member

Because when I locally run this particular test ONLY, I cannot make it fail.

Oh, now that you say that, I think this could be the same problem that we had with #8796. My theory there was that decidim-elections (and the bulletin-board) doesn't play nice with parallel_tests, as we have two specs using the same bulletin-board installation. That could be too why locally it works, as you're not running it with parallel_tests, or are you?

The solution that I found was disabling that for "[CI] Elections (system public)". Maybe we need to disable it on "[CI] Elections (system admin)"?

@andreslucena andreslucena merged commit f9adbd6 into decidim:develop Jun 17, 2022
andreslucena pushed a commit that referenced this pull request Jun 17, 2022
* Remove the description field from the elections component seeds

* Remove the rest of the question descriptions from the seeds
@ahukkanen ahukkanen deleted the fix/elections-seeds branch June 17, 2022 10:45
@ahukkanen
Copy link
Copy Markdown
Contributor Author

Oh, now that you say that, I think this could be the same problem that we had with #8796. My theory there was that decidim-elections (and the bulletin-board) doesn't play nice with parallel_tests, as we have two specs using the same bulletin-board installation. That could be too why locally it works, as you're not running it with parallel_tests, or are you?

This is also one option I was thinking actually. I wasn't locally running them in parallel. I was only targeting this one spec.

The solution that I found was disabling that for "[CI] Elections (system public)". Maybe we need to disable it on "[CI] Elections (system admin)"?

I'll try to debug a bit further but I'll try that if I don't figure out anything else.

andreslucena pushed a commit that referenced this pull request Jun 29, 2022
* Remove the description field from the elections component seeds

* Remove the rest of the question descriptions from the seeds
andreslucena pushed a commit that referenced this pull request Jul 6, 2022
* Remove the description field from the elections component seeds

* Remove the rest of the question descriptions from the seeds
eliegaboriau pushed a commit to eliegaboriau/decidim that referenced this pull request Oct 25, 2022
…dim#9448)

* Remove the description field from the elections component seeds

* Remove the rest of the question descriptions from the seeds
@alecslupu alecslupu added this to the 0.27.0 milestone Jul 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module: elections type: internal PRs that aren't necessary to add to the CHANGELOG for implementers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants