UT's: assert correct behavior on docker if empty data directory is present and if no version file, but other files are present in the data directory

This commit is contained in:
VakarisZ 2021-10-25 18:30:53 +03:00
parent 9ef9ba0024
commit 01f8488b07
1 changed files with 20 additions and 1 deletions

View File

@ -102,7 +102,7 @@ def test_new_data_dir_docker(monkeypatch, temp_data_dir_path, temp_version_file_
assert bogus_file_path.is_file() assert bogus_file_path.is_file()
def test_old_data_dir_docker(monkeypatch, temp_data_dir_path, temp_version_file_path): def test_data_dir_docker_old_version(monkeypatch, temp_data_dir_path, temp_version_file_path):
monkeypatch.setenv(DOCKER_ENV_VAR, "true") monkeypatch.setenv(DOCKER_ENV_VAR, "true")
temp_data_dir_path.mkdir() temp_data_dir_path.mkdir()
@ -110,3 +110,22 @@ def test_old_data_dir_docker(monkeypatch, temp_data_dir_path, temp_version_file_
with pytest.raises(IncompatibleDataDirectory): with pytest.raises(IncompatibleDataDirectory):
setup_data_dir(temp_data_dir_path) setup_data_dir(temp_data_dir_path)
def test_empty_data_dir_docker(monkeypatch, temp_data_dir_path, temp_version_file_path):
monkeypatch.setenv(DOCKER_ENV_VAR, "true")
temp_data_dir_path.mkdir()
setup_data_dir(temp_data_dir_path)
assert temp_version_file_path.read_text() == current_version
def test_old_data_dir_docker_no_version(monkeypatch, temp_data_dir_path):
monkeypatch.setenv(DOCKER_ENV_VAR, "true")
temp_data_dir_path.mkdir()
create_bogus_file(temp_data_dir_path)
with pytest.raises(IncompatibleDataDirectory):
setup_data_dir(temp_data_dir_path)