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

Closes #59: Deletes or rename debug.log file before tests #60

Merged
merged 6 commits into from
Apr 5, 2024

Conversation

Miraeld
Copy link
Contributor

@Miraeld Miraeld commented Mar 28, 2024

Description

Fixes #59

Documentation

User documentation

It will deletes the debug.log before running tests, and once the test process is started, it will rename debug.log if it exists to debug-{previousTestName.log.

It requires to setup the ssh environment within the wp.config.ts to work.

Technical documentation

Type of change

Delete options that are not relevant.

  • Enhancement (non-breaking change which improves an existing functionality).

New dependencies

Risks

Checklists

Feature validation

  • I validated all the Acceptance Criteria. If possible, provide sreenshots or videos.
  • I triggered all changed lines of code at least once without new errors/warnings/notices.

@Miraeld Miraeld added the enhancement New feature or request label Mar 28, 2024
@Miraeld Miraeld requested a review from a team March 28, 2024 05:03
@Miraeld Miraeld self-assigned this Mar 28, 2024
const debugLogExists = await exists(debugLogPath);

if (debugLogExists) {
await rm(debugLogPath);
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe we should not only remove the debug.log but every scenario debug.log so we don't have unnecessary logs piled up over time.

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe @wp-media/qa-team can help here, if they have a preference?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Umm, yea that's not a bad idea.
We could do delete everything that ends by .log

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with removing them from all places.

jeawhanlee
jeawhanlee previously approved these changes Mar 28, 2024
jeawhanlee
jeawhanlee previously approved these changes Apr 2, 2024
@jeawhanlee jeawhanlee dismissed their stale review April 2, 2024 11:26

There was an oversight while I was reviewing

src/support/steps/general.ts Outdated Show resolved Hide resolved
@hanna-meda
Copy link
Contributor

hanna-meda commented Apr 4, 2024

@Miraeld, @jeawhanlee, me and @Mai-Saad tested this, and here are the conclusions:

  • 1st part, debug.log deleted before running tests ✓ is happening as expected;
  • 2nd part, rename debug.log if it exists to debug-{previousTestName}.log x this isn't working, file is not renamed;

We tested by having a page template added to a test, that triggered a PHP fatal error in the debug.log file

[04-Apr-2024 13:22:02 UTC] PHP Fatal error: Uncaught Error: Call to undefined function undefined() in /var/www/e2e.rocketlabsqa.ovh/htdocs/wp-content/rocket-test-data/templates/triggerErrorInDebug.php:6 Stack trace: #0 /var/www/e2e.rocketlabsqa.ovh/htdocs/wp-includes/template-loader.php(106): include() #1 /var/www/e2e.rocketlabsqa.ovh/htdocs/wp-blog-header.php(19): require_once('...') #2 /var/www/e2e.rocketlabsqa.ovh/htdocs/index.php(17): require('...') #3 {main} thrown in /var/www/e2e.rocketlabsqa.ovh/htdocs/wp-content/rocket-test-data/templates/triggerErrorInDebug.php on line 6
but the debug.log file was not suffixed as expected, with the scenario's name.

Expected here would be that we rename the debug.log for every scenario that creates it irrespective of whether the error it’s wpr related or not.

@jeawhanlee
Copy link
Contributor

Thanks @hanna-meda I pushed a fix for this.
Please note that we will rename the debug.log whether it has WPR related errors in it or not.

@jeawhanlee jeawhanlee requested a review from a team April 4, 2024 22:31
Copy link
Contributor

@hanna-meda hanna-meda left a comment

Choose a reason for hiding this comment

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

debug.log entries are deleting before running tests ✓
debug.log file is suffixed by the scenario name during which errors were caught ✓

  • if errors contain any of the patterns:
    /plugins/wp-rocket/
    wpr_rucss_used_css
    wpr_rocket_cache
    scenario(s) will fail
  • if any other error, not wpr related, the scenario will be passed.

@hanna-meda hanna-meda merged commit d81e89e into trunk Apr 5, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Delete debug.log before all test and rename if fail test
5 participants