diff --git a/test/utils_tests/opencas-py-tests/test_cas_config_01.py b/test/utils_tests/opencas-py-tests/test_cas_config_01.py index efa4c67..b52ebe3 100644 --- a/test/utils_tests/opencas-py-tests/test_cas_config_01.py +++ b/test/utils_tests/opencas-py-tests/test_cas_config_01.py @@ -316,7 +316,7 @@ def test_cas_config_get_by_id_path_not_found(mock_listdir, mock_realpath): "2 /dev/dummy0n2 pt ioclass_file=mango.csv", "3 /dev/dummy0n3 WA cache_line_size=16", ("4 /dev/dummyc wb cache_line_size=16," - "ioclass_file=mango.csv,cleaning_policy=nop"), + "ioclass_file=mango.csv,cleaning_policy=nop,target_failover_state=standby"), ], [], ), diff --git a/test/utils_tests/opencas-py-tests/test_cas_config_cache_01.py b/test/utils_tests/opencas-py-tests/test_cas_config_cache_01.py index a2a9fec..897c668 100644 --- a/test/utils_tests/opencas-py-tests/test_cas_config_cache_01.py +++ b/test/utils_tests/opencas-py-tests/test_cas_config_cache_01.py @@ -187,8 +187,10 @@ def test_cache_config_from_line_missing_ioclass_file( "ioclass_file=ioclass.csv,ioclass_file=ioclass.csv", "cleaning_policy=nop,cleaning_policy=acp", "cleaning_policy=", + "clining_polisi=nop", "cleaning_policy=INVALID", "ioclass_file=ioclass.csv, cleaning_policy=nop", + "ioclas_file=ioclass.csv", "cache_line_size=4,cache_line_size=8", "cache_line_size=", "cache_line_size=0", @@ -198,14 +200,20 @@ def test_cache_config_from_line_missing_ioclass_file( "cache_line_size=-1", "cache_line_size=four", "cache_line_size=128", + "cach_lin_siz=4", "promotion_policy=111111", "promotion_policy=", "promotion_policy=dinosaurs", "promotion_policy=Robert'); DROP TABLE Students;--", "promotion_policy=awlays", "promotion_policy=nnhit", + "demolition_policy=nhit", "lazy_startup=yes", "lazy_startup=absolutely", + "hasty_startup=true", + "target_failover_state=no", + "target_failover_state=maybe", + "target_failrover_state=standby", ], ) @mock.patch("os.path.exists") @@ -242,10 +250,12 @@ def test_cache_config_from_line_parameter_validation_01( "ioclass_file=ioclass.csv,cache_line_size=4,cleaning_policy=nop", "promotion_policy=nhit", "promotion_policy=always", + "target_failover_state=standby", + "target_failover_state=active", "lazy_startup=true", "lazy_startup=false", ("ioclass_file=ioclass.csv,cache_line_size=4,cleaning_policy=nop,promotion_policy=always," - "lazy_startup=true"), + "lazy_startup=true,target_failover_state=active"), ], ) @mock.patch("os.path.exists") @@ -416,6 +426,7 @@ def test_cache_config_from_line_cache_id_validation_02( "cache_mode": "wo", "promotion_policy": "always", "cache_line_size": "16", + "lazy_startup": "true" }, { "cache_id": "1", @@ -423,6 +434,7 @@ def test_cache_config_from_line_cache_id_validation_02( "cache_mode": "wo", "promotion_policy": "nhit", "cache_line_size": "16", + "target_failover_state": "active", }, ], ) diff --git a/test/utils_tests/opencas-py-tests/test_helper_functions_01.py b/test/utils_tests/opencas-py-tests/test_helper_functions_01.py index 0e31d36..f0dbf47 100644 --- a/test/utils_tests/opencas-py-tests/test_helper_functions_01.py +++ b/test/utils_tests/opencas-py-tests/test_helper_functions_01.py @@ -74,7 +74,7 @@ def test_cas_settle_cores_didnt_start_02(mock_add, mock_exists, mock_run, mock_l "type": "cache", "id": "1", "disk": "/dev/dummy_cache", - "status": "Active", + "status": "Standby", "write policy": "wt", "device": "-", } @@ -303,7 +303,14 @@ def test_cas_settle_caches_didnt_start_01( mock_config.return_value = Mock( spec_set=opencas.cas_config(), cores=[], - caches={42: opencas.cas_config.cache_config(42, "/dev/dummy", "wt")}, + caches={ + 42: opencas.cas_config.cache_config( + 42, + "/dev/dummy", + "wt", + target_failover_state="standby" + ) + }, ) result = opencas.wait_for_startup(timeout=0, interval=0) @@ -802,10 +809,10 @@ def test_last_resort_add_02(mock_start, mock_add, mock_exists, mock_run, mock_li result = opencas.wait_for_startup(timeout=0, interval=0) - mock_start.assert_any_call(config.caches[1], True) - mock_start.assert_any_call(config.caches[2], True) - mock_add.assert_any_call(config.cores[0], True) - mock_add.assert_any_call(config.cores[1], True) + mock_start.assert_any_call(config.caches[1], load=True) + mock_start.assert_any_call(config.caches[2], load=True) + mock_add.assert_any_call(config.cores[0], try_add=True) + mock_add.assert_any_call(config.cores[1], try_add=True) mock_run.assert_called_with(["udevadm", "settle"]) @@ -883,10 +890,10 @@ def test_last_resort_add_04(mock_start, mock_add, mock_exists, mock_run, mock_li result = opencas.wait_for_startup(timeout=2, interval=0.1) - mock_start.assert_any_call(config.caches[1], True) - mock_start.assert_any_call(config.caches[2], True) - mock_add.assert_any_call(config.cores[0], True) - mock_add.assert_any_call(config.cores[1], True) + mock_start.assert_any_call(config.caches[1], load=True) + mock_start.assert_any_call(config.caches[2], load=True) + mock_add.assert_any_call(config.cores[0], try_add=True) + mock_add.assert_any_call(config.cores[1], try_add=True) mock_run.assert_called_with(["udevadm", "settle"]) @@ -919,11 +926,11 @@ def test_last_resort_add_05(mock_start, mock_add, mock_exists, mock_run, mock_li result = opencas.wait_for_startup(timeout=0.5, interval=0.1) - mock_start.assert_any_call(config.caches[1], True) - mock_start.assert_any_call(config.caches[2], True) + mock_start.assert_any_call(config.caches[1], load=True) + mock_start.assert_any_call(config.caches[2], load=True) assert mock_start.call_count == 2, "start cache was called more than once per device" - mock_add.assert_any_call(config.cores[0], True) - mock_add.assert_any_call(config.cores[1], True) + mock_add.assert_any_call(config.cores[0], try_add=True) + mock_add.assert_any_call(config.cores[1], try_add=True) assert mock_add.call_count == 2, "add core was called more than once per device" mock_run.assert_called_with(["udevadm", "settle"])