Skip to content

Split parallel test coverage reports into their own folders#9686

Merged
andreslucena merged 1 commit intodecidim:developfrom
mainio:fix/simplecov-split-parallel-reports
Sep 15, 2022
Merged

Split parallel test coverage reports into their own folders#9686
andreslucena merged 1 commit intodecidim:developfrom
mainio:fix/simplecov-split-parallel-reports

Conversation

@ahukkanen
Copy link
Copy Markdown
Contributor

@ahukkanen ahukkanen commented Aug 14, 2022

🎩 What? Why?

I started to first improve the unit test coverage on the core but then I bumped into one report where the Decidim::GroupsController coverage was at 0% although all specs had been run correctly during that run.

I started to investigate this and I found this issue with the simplecov when used with the parallel_tests:
simplecov-ruby/simplecov#1019

This issue seems really close to what we are experiencing with Decidim and the suggested solution is to split the coverage reports for each parallel test run into their separate folders. This way merging should happen at Codecov's side which means that if the simplecov merging is buggy, it shouldn't affect our CI coverage reports.

Regardless of this, I will still continue on #9684 to add a bit more unit tests.

📌 Related Issues

Testing

We'll just have to see if the coverage reports consistency improves.

@ahukkanen ahukkanen changed the title Split the parallel test reports into their own folders Split parallel test reports into their own folders Aug 14, 2022
@ahukkanen ahukkanen added the type: internal PRs that aren't necessary to add to the CHANGELOG for implementers label Aug 14, 2022
@ahukkanen ahukkanen changed the title Split parallel test reports into their own folders Split parallel test coverage reports into their own folders Aug 14, 2022
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.

Makes perfect sense, thanks for the great explanation 👍🏽

@andreslucena andreslucena merged commit dba6811 into decidim:develop Sep 15, 2022
@ahukkanen ahukkanen deleted the fix/simplecov-split-parallel-reports branch September 15, 2022 07:31
entantoencuanto added a commit that referenced this pull request Sep 15, 2022
* develop: (24 commits)
  Add develop index to the documentation (#9666)
  Fix initiatives components (#9633)
  Fix conference speaker avatars (#9643)
  Update `rokroskar/workflow-run-cleanup-action` GitHub action to v0.3.3 (#9750)
  Fix character counter for the WYSIWYG editor (#9680)
  Fix posting comments before the initial load has run (#9614)
  Fix parallel tests port in use (#9661)
  Split parallel test coverage reports into their own folders (#9686)
  Improve admin panel user experience regarding title links and order of actions (#9496)
  Fix title and description too long in initiatives spec sometimes (#9648)
  Fix API GraphiQL system spec with newer ChromeDriver (#9642)
  Add missing character on code block (#9798)
  Fix hidden error messages on the registration form (#9625)
  Add documentation about configuring ActiveStorage / dynamic file uploads (#9777)
  Add documentation section about customizing cells (#9622)
  Fix hashtags not recognized at the beginning of the string (#9616)
  Fix version pages showing a HTTP 500 error when the version does not exist (#9615)
  Fix multitenant organizations stats cache (#9605)
  Prevent the account edit route through Devise (#9611)
  Fix iframe disabling producing invalid HTML (#9685)
  ...
@ahukkanen
Copy link
Copy Markdown
Contributor Author

It seems this did not fix the problem after all:
Coverage error

Some of the report files could be downloaded from Codecov but some of them give this kind of error:

<Error>
  <Code>ExpiredToken</Code>
  <Message>The provided token has expired.</Message>
  <Details>Request signature expired at: 2022-09-15T17:02:41+00:00</Details>
</Error>

In that particular run, for example these methods were reported as uncovered:
Uncovered code

Both of these should be covered by this spec:

before do
login_as admin, scope: :user
visit decidim_admin.root_path
click_link "Pages"
end
it "can create new pages" do
within ".secondary-nav" do
click_link "Create page"
end
within ".new_static_page" do
fill_in :static_page_slug, with: "welcome"
fill_in_i18n(
:static_page_title,
"#static_page-title-tabs",
en: "Welcome to Decidim",
es: "Te damos la bienvendida a Decidim",
ca: "Et donem la benvinguda a Decidim"
)
fill_in_i18n_editor(
:static_page_content,
"#static_page-content-tabs",
en: "<p>Some HTML content</p>",
es: "<p>Contenido HTML</p>",
ca: "<p>Contingut HTML</p>"
)
select topic.title[I18n.locale.to_s], from: "Topic"
find("*[type=submit]").click
end
expect(page).to have_admin_callout("successfully")
within find(".card", text: topic.title[I18n.locale.to_s]) do
expect(page).to have_css("tr", text: "Welcome to Decidim")
end
end
context "with existing pages" do
let!(:decidim_page) { create(:static_page, :with_topic, organization:) }
let!(:topic) { create(:static_page_topic, organization:) }
before do
visit current_path
end
it "can edit them" do
within find("tr", text: translated(decidim_page.title)) do
click_link "Edit"
end
within ".edit_static_page" do
fill_in_i18n(
:static_page_title,
"#static_page-title-tabs",
en: "Not welcomed anymore"
)
fill_in_i18n_editor(
:static_page_content,
"#static_page-content-tabs",
en: "This is the new <strong>content</strong>"
)
select topic.title[I18n.locale.to_s], from: "Topic"
find("*[type=submit]").click
end
expect(page).to have_admin_callout("successfully")
within find(".card", text: topic.title[I18n.locale.to_s]) do
expect(page).to have_css("tr", text: "Not welcomed anymore")
end
end
it "can delete them" do
within find("tr", text: translated(decidim_page.title)) do
accept_confirm { click_link "Delete" }
end
expect(page).to have_admin_callout("successfully")
within "table" do
expect(page).to have_no_content(translated(decidim_page.title))
end
end

But the report from that run could not be uploaded to codecov as the logs show:
Upload error

Here's the same in text format:

_____          _
 / ____|        | |
| |     ___   __| | ___  ___ _____   __
| |    / _ \ / _` |/ _ \/ __/ _ \ \ / /
| |___| (_) | (_| |  __/ (_| (_) \ V /
 \_____\___/ \__,_|\___|\___\___/ \_/
                              Bash-1.0.6


==> git version 2.37.3 found
==> curl 7.68.0 (x86_64-pc-linux-gnu) libcurl/7.68.0 OpenSSL/1.1.1f zlib/1.2.11 brotli/1.0.7 libidn2/2.2.0 libpsl/0.21.0 (+libidn2/2.2.0) libssh/0.9.3/openssl/zlib nghttp2/1.40.0 librtmp/2.3
Release-Date: 2020-01-08
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp 
Features: AsynchDNS brotli GSS-API HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM NTLM_WB PSL SPNEGO SSL TLS-SRP UnixSockets
==> GitHub Actions detected.
    Env vars used:
      -> GITHUB_ACTIONS:    true
      -> GITHUB_HEAD_REF:   
      -> GITHUB_REF:        refs/heads/develop
      -> GITHUB_REPOSITORY: decidim/decidim
      -> GITHUB_RUN_ID:     3061503581
      -> GITHUB_SHA:        c6791f1455d88ba20aedd3c6a93a709d8771b5ae
      -> GITHUB_WORKFLOW:   [CI] Admin (system tests)
    current dir:  /home/runner/work/decidim/decidim
    project root: .
    Yaml found at: codecov.yml
==> Running gcov in . (disable via -X gcov)
==> Python coveragepy not found
==> Searching for coverage reports in:
    + .
    -> Found 2 reports
==> Detecting git/mercurial file structure
==> Reading reports
    + ./coverage/2/coverage.xml bytes=4385785
    + ./coverage/1/coverage.xml bytes=4433054
==> Appending adjustments
    https://docs.codecov.io/docs/fixing-reports
/dev/fd/63: line [17](https://github.com/decidim/decidim/actions/runs/3061503581/jobs/4941352077#step:6:18)17: echo: write error: Broken pipe
    + Found adjustments
==> Gzipping contents
        452K	/tmp/codecov.jZ0ENY.gz
==> Uploading reports
    url: https://codecov.io
    query: branch=develop&commit=c6791f1455d88ba[20](https://github.com/decidim/decidim/actions/runs/3061503581/jobs/4941352077#step:6:21)aedd3c6a93a709d8771b5ae&build=3061503581&build_url=https%3A%2F%2Fgithub.com%2Fdecidim%2Fdecidim%2Factions%2Fruns%2F3061503581&name=decidim-admin&tag=&slug=decidim%2Fdecidim&service=github-actions&flags=decidim-admin&pr=&job=%5BCI%5D%20Admin%20%28system%20tests%29&cmd_args=n,C,F
->  Pinging Codecov
https://codecov.io/upload/v4?package=bash-1.0.6&token=<hidden>&package=bash-1.0.6&token=&branch=develop&commit=c6791f1455d88ba20aedd3c6a93a709d8771b5ae&build=3061503581&build_url=https%3A%2F%2Fgithub.com%2Fdecidim%2Fdecidim%2Factions%2Fruns%2F3061503581&name=decidim-admin&tag=&slug=decidim%2Fdecidim&service=github-actions&flags=decidim-admin&pr=&job=%5BCI%5D%20Admin%20%28system%20tests%29&cmd_args=n,C,F
{'detail': ErrorDetail(string='Unable to locate build via Github Actions API. Please upload with the Codecov repository upload token to resolve issue.', code='not_found')}
404
==> Uploading to Codecov
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  448k  100   171  100  448k    881  [23](https://github.com/decidim/decidim/actions/runs/3061503581/jobs/4941352077#step:6:24)13k --:--:-- --:--:-- --:--:-- 2[31](https://github.com/decidim/decidim/actions/runs/3061503581/jobs/4941352077#step:6:32)3k
    {'detail': ErrorDetail(string='Unable to locate build via Github Actions API. Please upload with the Codecov repository upload token to resolve issue.', code='not_found')}

eliegaboriau pushed a commit to eliegaboriau/decidim that referenced this pull request Oct 25, 2022
ahukkanen added a commit to mainio/decidim that referenced this pull request Feb 6, 2023
alecslupu pushed a commit that referenced this pull request Feb 14, 2023
* Switch to the official Codecov action v3

* Revert "Split parallel test coverage reports into their own folders (#9686)"

This reverts commit dba6811.

* Use working-directory instead of the directory argument

* Add unique name to the decidim-core coverage reports

* Move the working-directory under the with arguments

* Remove working-directory as the report is always at the root

* Define the flag argument similarly to the old uploader

* Remove the legacy coverage uploader

* Hard code the CodeCov token to the workflow files
ahukkanen added a commit that referenced this pull request Mar 1, 2023
* Switch to the official Codecov action v3

* Revert "Split parallel test coverage reports into their own folders (#9686)"

This reverts commit dba6811.

* Use working-directory instead of the directory argument

* Add unique name to the decidim-core coverage reports

* Move the working-directory under the with arguments

* Remove working-directory as the report is always at the root

* Define the flag argument similarly to the old uploader

* Remove the legacy coverage uploader

* Hard code the CodeCov token to the workflow files
ahukkanen added a commit that referenced this pull request Mar 1, 2023
* Switch to the official Codecov action v3

* Revert "Split parallel test coverage reports into their own folders (#9686)"

This reverts commit dba6811.

* Use working-directory instead of the directory argument

* Add unique name to the decidim-core coverage reports

* Move the working-directory under the with arguments

* Remove working-directory as the report is always at the root

* Define the flag argument similarly to the old uploader

* Remove the legacy coverage uploader

* Hard code the CodeCov token to the workflow files
alecslupu pushed a commit that referenced this pull request Mar 1, 2023
* Switch to the official Codecov action v3

* Revert "Split parallel test coverage reports into their own folders (#9686)"

This reverts commit dba6811.

* Use working-directory instead of the directory argument

* Add unique name to the decidim-core coverage reports

* Move the working-directory under the with arguments

* Remove working-directory as the report is always at the root

* Define the flag argument similarly to the old uploader

* Remove the legacy coverage uploader

* Hard code the CodeCov token to the workflow files
alecslupu pushed a commit that referenced this pull request Mar 1, 2023
)

* Switch to the official Codecov action for CI (#10344)

* Switch to the official Codecov action v3

* Revert "Split parallel test coverage reports into their own folders (#9686)"

This reverts commit dba6811.

* Use working-directory instead of the directory argument

* Add unique name to the decidim-core coverage reports

* Move the working-directory under the with arguments

* Remove working-directory as the report is always at the root

* Define the flag argument similarly to the old uploader

* Remove the legacy coverage uploader

* Hard code the CodeCov token to the workflow files

* Switch to the codecov action at the rest of the workflows
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

2 participants