English summary
This repository contains the replam project, a system for managing computing resource backups and their retention plans. The idea of retention plans and rules contained here are part of a technical test for a Python Backend Developer job.
- Create a lib that receives a retention plan and a date, and it should tell if the snapshot for this date should be retained or deleted.
- Standard: 42 days retention
- We will retain each snapshot daily for 42 days
- Gold: 42 days and 12 months retention
- We will retain each snapshot daily for 42 days
- We will retain the last snapshot of the month for 12 months
- Platinum: 42 days, 12 months and 7 years
- We will retain each snapshot daily for 42 days
- We will retain the last snapshot of the month for 12 months
- We will retain the last snapshot of the year for 7 years
- Python and pip installed on the machine
- Locally cloned replam project
- Access the project folder with the command
cd replam
- It is recommended to create a virtual environment, for that run the command
python -m venv .
and.\Scripts\activate
to activate it - Install the dependencies with the command
pip install requirements.txt
Tests can be done in two ways:
- Run the test scripts with the command
pytest
- Run each test script individually, here's an example running the
pytest .\test\test_snapshot.py
The project has three classes: Resource, Snapshot and RetentionPlan, and below is the class diagram illustrating each of them in more details:
SumĂĄrio em portuguĂȘs
Este repositório contém o projeto replam, um sistema para gerenciamento de backups de recursos de computação e seus planos de retenção. A ideia de planos de retenção e regras contidas aqui fazem parte de um teste técnico para uma vaga de Python Backend Developer.
- Crie uma biblioteca que receba um plano de retenção e uma data, e ela deve informar se o snapshot dessa data deve ser retido ou excluĂdo.
- Standard: retenção de 42 dias
- Manteremos cada snapshot diariamente por 42 dias
- Gold: retenção de 42 dias e 12 meses
- Manteremos cada snapshot diariamente por 42 dias
- Manteremos o Ășltimo snapshot do mĂȘs por 12 meses
- Platinum: (42 dias, 12 meses e 7 anos)
- Manteremos cada snapshot diariamente por 42 dias
- Manteremos o Ășltimo snapshot do mĂȘs por 12 meses
- Manteremos o Ășltimo snapshot do ano por 7 anos
- Python e pip instalados na mĂĄquina
- Projeto replam clonado localmente
- Acesse a pasta do projeto com o comando
cd replam
- Recomenda-se criar um ambiente virtual, para isso execute o comando
python -m venv .
e.\Scripts\activate
para ativĂĄ-lo - Instale as dependĂȘncias com o comando
pip install requirements.txt
Os testes podem ser executados de duas formas:
- Execute os scripts de teste com o comando
pytest
- Execute os scripts de teste individualmente, exemplo da execução do
pytest .\test\test_snapshot.py
O projeto possui trĂȘs classes: Resource, Snapshot e RetentionPlan, e abaixo estĂĄ o diagrama de classes ilustrando cada uma delas com mais detalhes: