diff --git a/monkey/tests/unit_tests/monkey_island/cc/setup/test_data_dir.py b/monkey/tests/unit_tests/monkey_island/cc/setup/test_data_dir.py index fd1dbb693..e476784b1 100644 --- a/monkey/tests/unit_tests/monkey_island/cc/setup/test_data_dir.py +++ b/monkey/tests/unit_tests/monkey_island/cc/setup/test_data_dir.py @@ -102,7 +102,7 @@ def test_new_data_dir_docker(monkeypatch, temp_data_dir_path, temp_version_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") 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): 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)