Page MenuHomePhabricator

Create more tests for transferpy package
Closed, ResolvedPublic

Description

The transferpy is a package used for database backup and recovery. This ticket is to discuss and improve the test coverage of the transferpy package.

Event Timeline

Privacybatm edited projects, added DBA; removed Google-Summer-of-Code (2020).
Privacybatm moved this task from Triage to GSOC2020 on the DBA board.

Change 612354 had a related patch set uploaded (by Privacybatm; owner: Privacybatm):
[operations/software/transferpy@master] transfer.py: Comment on setup_logger function

https://gerrit.wikimedia.org/r/612354

The following scenarios come under this ticket:

  1. Unit tests:

transfer.py

  • correctness in logger level setting (test_setup_logger: Done)
  • correctness in passing new options:
    • verbose (test_verbose, test_remote_execution_verbose, test_setup_logger: Done)
    • parallel-checksum (test_parallel_checksum_source_and_target_command, test_parallel_checksum: Done)
  • split_traget calling (test_split_target: Done)

Firewall.py

  • find_available_port (test_find_available_port: Done)
  • change name of the function from find_available_port_command to find_used_ports_command: The name is misleading (Done)
  • reserve_port (test_reserve_port: Done)
  • unreserve_port (test_unreserve_port: Done)
  • no free port available situation(test_no_available_port: Done)
  • netstat and fuser absolute path (Done)
  • open function (test_open_with_auto_port_finding, test_open_with_given_port, test_open_with_given_non_available_port, test_open_failure: Done)
  • open sends a free port (test_open_with_auto_port_finding, test_open_with_given_port: Done)
  • close function (test_close: Done)
  • close is getting same port or not (test_close_gets_port_from_open: Done)
  • what if no port is able to reserve after it finds free ports (test_no_available_port: Done)
  • test for argument non free port (test_open_with_given_non_available_port: Done)

Transferer.py

  • host_exists (test_host_exists: Done)
  • is_socket (test_is_socket: Done)
  • dir_is_empty (test_dir_is_empty: Done)
  • parallel_checksum_source_command (test_parallel_checksum_source_command: Done)
  • parallel_checksum_target_command (test_parallel_checksum_target_command: Done)
  • read_checksum (test_read_checksum: Done)
  • netcat_send_command and listen command (test_netcat_send_command, test_netcat_listen_command: Done)
  • tar and untar command (test_untar_command, test_tar_command: Done)
  • get_datadir_from_socket (test_get_datadir_from_socket: Done)
  • xtrabackup_command (test_xtrabackup_command: Done)
  • mbstream_command (test_mbstream_command: Done)
  • password function (test_password: Done)
  • copy_to as a whole (test_copy_to_success, test_copy_to_failure: Done)
  • sanity_checks (test_sanity_checks_xtrabackup, test_sanity_checks_file: Done)
  • after_transfer_checks (test_after_transfer_checks: Done)

(Optional)

  • find_pid (test_find_pid: Done)
  • kill_process (test_kill_process: Done)
  1. Integration tests:

Transferer.py

  • parallel-checksum (test_parallel_checksum_file, test_parallel_checksum_dir, test_parallel_checksum_decompress, test_parallel_checksum_xtrabackup: Done)
  1. Comments:
  • Give comments on setup_logger function. (Done)

Change 612384 had a related patch set uploaded (by Privacybatm; owner: Privacybatm):
[operations/software/transferpy@master] transfer.py: Add unit tests

https://gerrit.wikimedia.org/r/612384

Change 612705 had a related patch set uploaded (by Privacybatm; owner: Privacybatm):
[operations/software/transferpy@master] Firewall.py: Provide an absolute path to commands and refactor a function

https://gerrit.wikimedia.org/r/612705

Change 612726 had a related patch set uploaded (by Privacybatm; owner: Privacybatm):
[operations/software/transferpy@master] Firewall.py: Add unit tests

https://gerrit.wikimedia.org/r/612726

Aklapper renamed this task from Create more tests for transfepy package to Create more tests for transferpy package.Jul 15 2020, 10:20 AM

Change 613024 had a related patch set uploaded (by Privacybatm; owner: Privacybatm):
[operations/software/transferpy@master] Transferer.py: Add unit tests

https://gerrit.wikimedia.org/r/613024

Change 612354 merged by jenkins-bot:
[operations/software/transferpy@master] transfer.py: Comment on setup_logger function

https://gerrit.wikimedia.org/r/612354

Change 612705 merged by jenkins-bot:
[operations/software/transferpy@master] Firewall.py: Provide an absolute path to commands and refactor a function

https://gerrit.wikimedia.org/r/612705

Not a huge priority, but check if you can rebase cleanly the extra units tests to HEAD, after the latest merges, and they still validate. It doesn't let me do it automatically, but I am guessing the manual rebase is not too involved.

Sure, I will do the rebasing! Thank you for mentioning it.

Change 612384 merged by Jcrespo:
[operations/software/transferpy@master] transfer.py: Add unit tests

https://gerrit.wikimedia.org/r/612384

Change 612726 merged by jenkins-bot:
[operations/software/transferpy@master] Firewall.py: Add unit tests

https://gerrit.wikimedia.org/r/612726

The transferpy unit test file is getting much larger. If there is enough time, it would be nice to split, where possible, the different classes on different files, to keep individual file size smaller.

I agree on this, As you suggested we will split it based on class.

Change 615688 had a related patch set uploaded (by Privacybatm; owner: Privacybatm):
[operations/software/transferpy@master] transferpy: Change tox development environment to Python3.7

https://gerrit.wikimedia.org/r/615688

Change 615688 merged by jenkins-bot:
[operations/software/transferpy@master] transferpy: Change tox development environment to Python3.7

https://gerrit.wikimedia.org/r/615688

Change 613024 merged by jenkins-bot:
[operations/software/transferpy@master] Transferer.py: Add unit tests

https://gerrit.wikimedia.org/r/613024