Skip to content

Conversation

@Edu92337
Copy link
Contributor

@Edu92337 Edu92337 commented Jan 8, 2026

Related to #760 (mitigation)

  • Keep unconditional /data cleanup at start
  • Make /logs cleanup conditional on --preserve-data-dir flag
  • Prevents reusing old log state between test runs

Description and Notes

Currently, the cleanup of /logs directory happens at the END of test execution and only if tests pass. This causes:

  • Failed tests leave corrupted log state for next run
  • Tests may fail when run multiple times without manual cleanup

This PR provides a temporary mitigation by making /logs cleanup conditional on the --preserve-data-dir flag, while keeping /data unconditionally cleaned at start.

Note: This is a partial fix. Complete resolution will come in a follow-up PR after #742 is merged, where cleanup logic will be migrated to the Python runner for better control over test data management.

How to verify the changes you have done?

# Test 1: Run tests multiple times
./tests/prepare.sh
./tests/run.sh
./tests/run.sh  # Should work without manual cleanup

# Test 2: Preserve logs for debugging
./tests/run.sh --preserve-data-dir
ls -la $FLORESTA_TEMP_DIR/logs  # Logs preserved

Next Steps

After #742 is merged, I plan to submit a follow-up PR to:

Contributor Checklist

  • I've followed the contribution guidelines
  • I've verified one of the following:
    • Ran just pcc (skipped - changes are bash-only, validated manually)
    • Ran just lint-features '-- -D warnings' && cargo test --release (not applicable)
    • Confirmed CI passed on my fork (will run after PR creation)
  • I've linked any related issue(s) in the sections above

Manual validation performed:

  • ✅ Bash syntax check (bash -n)
  • ✅ Logic tested with simulations
  • --preserve-data-dir flag tested
  • ✅ Consecutive test runs verified

@moisesPompilio moisesPompilio added code quality Generally improves code readability and maintainability functional tests labels Jan 8, 2026
@moisesPompilio
Copy link
Collaborator

Please squash the commits.

Fixes #760

- Keep unconditional /data cleanup at start
- Make /logs cleanup conditional on --preserve-data-dir flag
@jaoleal
Copy link
Collaborator

jaoleal commented Jan 9, 2026

As stated in #760 (comment)

I'll add the cleanup logic to run.sh at the start of execution,
respecting the --preserve-data-dir flag.
After #742 is merged, I can help migrate this cleanup logic to the Python runner if
needed. What do you think?
Will submit a PR soon

What would be fixing #760 is the follow-up pr that you mentioned. This should be a mitigation PR, including in the description that this fixes #760 will close the issue.

Also,

CACK


fi

# Clean existing data/logs directories before running the tests
Copy link
Member

Choose a reason for hiding this comment

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

Why did you remove the comment?

# Clean existing logs directories BEFORE running tests (unless preserving)
if [ "$PRESERVE_DATA" = false ]; then
echo "Cleaning up test directories before running tests..."
rm -rf "$FLORESTA_TEMP_DIR/logs"
Copy link
Member

Choose a reason for hiding this comment

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

Need to delete data as well, no?

@Edu92337 Edu92337 closed this by deleting the head repository Feb 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

code quality Generally improves code readability and maintainability functional tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Functional tests failing if you dont clean datadir

4 participants