Allure TestOps - Clean up policies

Clean-up

Each test launch generates a considerable amount of data which includes test scenarios and attachments. You may need this information if the test run is not successful, but this data for successful tests consumes a lot of storage space. After you have analyzed the data, you can delete the data manually which could be difficult if you have thousands of tests running every day.

Allure TestOps allows you to configure automatic cleanup of such data.

Create a global cleanup rule

To create a global cleanup rule, you need administrator privileges.
  1. In the Allure TestOps main page, go to the User Menu and select Administration in the drop-down menu.

  2. Go to the Clean up policies section.

  3. Click the Create button. Select the Target and Test status of the target test from the drop-down lists.

  4. Specify the Clean delay (in hours) parameter. It defines number of hours between a test run and the data cleanup.

    Global cleanup rules

  5. Click Submit. You can also Edit or Delete created rules.

Think about the cleanup rules that suit you best. If you don’t need to analyze the data from the successful test cases, you can configure immediate data cleanup for them. If you need a few days to analyze the data every time something goes wrong, you can set that failed test attachments will be deleted after 50 hours.

Create a cleanup rule for a specific project

Global cleanup rules configured by the administrator may not be appropriate for your project. In this case, you can configure a rule for the current project.

To create a cleanup rule for the project, you must be the project Owner.
  1. Open the required project and go to the Settings section.

  2. Go to the Clean up policies section. Here you can see the global cleanup rules for your system.

  3. Click the Create button and specify Target, Test status and Clean delay (in hours) in the same way as above.

    Project cleanup rules

  4. Click Submit. You can also Edit or Delete created rules.

Set up a schedule

By default, Allure TestOps performs cleanup tasks at night. To change the schedule, you need specify required values for the following environment variables:

  • ALLURE_SCHEDULER_CLEANER_GLOBAL

    Parameter for global cleanup rules. Default value is "0 0 2 * * ?" — cleanup tasks will be performed every day at 2 am.

  • ALLURE_SCHEDULER_CLEANER_PROJECT

    Parameter for project cleanup rules. Default value is "0 30 2 * * ?" — cleanup tasks will be performed every day at 2:30 am.

For huge projects, cleaning may take a long time. In order to track execution time for cleanup tasks, Allure TestOps exports the following metrics: allure.scheduler.cleaner_schema and allure.scheduler.global_cleaner_schema.

Manual triggering of clean up procedures

At the moment, there is no UI to trigger clean up rules, but you can use API commands to initiate the clean up process outside of the standard schedule.

Open Allure TestOps API description by adding /swagger-ui.html to your Allure TestOps instance URL. Now you need to proceed to the cleanup-controller section and select one of the API functions you need to trigger outside the schedule.

Managing the clean up batch size

Allure TestOps collects the list of files based on the clean up policy and created blob remove tasks (usually done at 2 a.m.), then each 5 minutes Allure TestOps runs the task of blob removal. Files are deleted in batches. The default value of the batch size is 1000. This means that each 5 minutes Allure TestOps will request the blob storage to delete a batch of 1000 files.

There could be situations when your tests have huge amount of attachments and they are being created faster than the clean up deletes the files needs to be cleaned up. You can manage the batch size for files deletion by adding the following parameter to report service configuration.

How to check

Run the following in the report service’s database:

SQL select count(*) from blob_remove_task

If the returned value is more than 0 then you need to think about increasing the parameter.

docker-compose or Kubernetes deployment

ALLURE_SCHEDULER_CLEANER_BLOB_BATCHSIZE: 2000

Packages deployment

allure.scheduler.cleaner.blob.batchsize=2000

When ALLURE_SCHEDULER_CLEANER_BLOB_BATCHSIZE should be applied

ALLURE_SCHEDULER_CLEANER_BLOB_BATCHSIZE needs to be adjusted only in a case if you see that the size of the test results artifacts is growing or isn’t changing with the time and there are clean up rules in place, i.e. you are creating more files that you are deleting.

The batch size for the files deletion should have reasonable value. Don’t increase this parameter violently as it will dramatically degrade the performance of your blob storage and generally performance of Allure TestOps.