Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store integreat-cms.log as an artifact after test run in CI #2672

Merged
merged 1 commit into from
Mar 25, 2024

Conversation

seluianova
Copy link
Contributor

Short description

Sometimes we encounter test failures in CI that are not reproduced locally.
We can see some pieces of the log in the test output, but sometimes it's not enough to localize the problem.
To make the analysis a bit easier, I suggest attaching full integreat-cms.log as a job artifact.
It will only be available when there are test failures:
image

Proposed changes

  • add step "Copy CMS log" to the test job in CI

Side effects

No?

I think it would also be useful to set the logging level to DEBUG, but I couldn't find how to do that :(
I thought this was supposed to be managed by

#: Use debug logging on CircleCI
LOG_LEVEL = "DEBUG"

in circleci_settings.py, but no.
The actual log level in CI is currently INFO.
log example
Maybe someone has some ideas on how to change this?

Resolved issues

Fixes: #2256


Pull Request Review Guidelines

@seluianova seluianova requested a review from a team as a code owner February 27, 2024 18:10
@seluianova seluianova linked an issue Feb 27, 2024 that may be closed by this pull request
Copy link

codeclimate bot commented Feb 27, 2024

Code Climate has analyzed commit d540ee3 and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 100.0% (50% is the threshold).

This pull request will bring the total coverage in the repository to 81.5% (-0.2% change).

View more on Code Climate.

@seluianova seluianova added the prio: low Not urgent, can be resolved in the distant future. label Mar 1, 2024
Copy link
Member

@david-venhoff david-venhoff left a comment

Choose a reason for hiding this comment

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

Thanks, LGTM. I was a bit surprised that the circleci checks for this pr did not generate the artifact (Or I did not find it). Is that to be expected?

Copy link
Member

@timobrembeck timobrembeck left a comment

Choose a reason for hiding this comment

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

Thanks! 👍

think it would also be useful to set the logging level to DEBUG, but I couldn't find how to do that :(
I thought this was supposed to be managed by

#: Use debug logging on CircleCI
LOG_LEVEL = "DEBUG"

in circleci_settings.py, but no.
The actual log level in CI is currently INFO.
log example
Maybe someone has some ideas on how to change this?

@seluianova Ah, I got it: The LOG_LEVEL setting is just an intermediary variable and not used by Django. The real logging setting is here:

LOGGING: Final[dict[str, Any]] = {

So what happens is this:

  • from .settings import * sets the LOGGING setting based on the default value of LOG_LEVEL (which is INFO in this case)
  • LOG_LEVEL = "DEBUG" does not change the LOGGING setting anymore and thus has no effect

I was a bit surprised that the circleci checks for this pr did not generate the artifact (Or I did not find it). Is that to be expected?

@david-venhoff I think that's expected since the tests did not fail and the artifact is only stored when the tests fail.
I mean we could also think about storing the log in any case, since a few lines of text are only a few kb, so storing it will not cost a lot of credits.

@seluianova
Copy link
Contributor Author

@timobrembeck thank you!
Added logging configuration for integreat_cms and integreat_cms.core.management.commands.
I assume this should be sufficient for analyzing test failures.

@seluianova seluianova merged commit c2e9ea7 into develop Mar 25, 2024
5 checks passed
@seluianova seluianova deleted the test/cms-log-in-ci branch March 25, 2024 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
prio: low Not urgent, can be resolved in the distant future.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add the ability to view CMS logs after running tests in CircleCI
3 participants