From 3928dbd1796d9d9a898f6516b43c35aa0d080dd0 Mon Sep 17 00:00:00 2001 From: Norberto Arrieta Date: Tue, 20 Sep 2022 11:46:51 -0700 Subject: [PATCH] test fixes --- azurelinuxagent/common/conf.py | 4 -- tests/ga/test_update.py | 49 ------------------- ..._extensions_goal_state_from_vm_settings.py | 8 --- 3 files changed, 61 deletions(-) diff --git a/azurelinuxagent/common/conf.py b/azurelinuxagent/common/conf.py index 8664d77b8..bd101f617 100644 --- a/azurelinuxagent/common/conf.py +++ b/azurelinuxagent/common/conf.py @@ -559,10 +559,6 @@ def get_cgroup_monitor_expiry_time(conf=__conf__): """ cgroups monitoring for pilot extensions disabled after expiry time - NOTE: This option is experimental and may be removed in later versions of the Agent. - """ - cgroups monitoring for pilot extensions disabled after expiry time - NOTE: This option is experimental and may be removed in later versions of the Agent. """ return conf.get("Debug.CgroupMonitorExpiryTime", "2022-03-31") diff --git a/tests/ga/test_update.py b/tests/ga/test_update.py index 7489ed9ad..cd5595569 100644 --- a/tests/ga/test_update.py +++ b/tests/ga/test_update.py @@ -1322,7 +1322,6 @@ def test_run_latest_creates_only_one_signal_handler(self, mock_signal): self._test_run_latest() self.assertEqual(0, mock_signal.call_count) - # @skip_if_predicate_true(lambda: True, "This test has a dependency on the agent version being 9.9.* and breaks when updating the agent version during release") def test_get_latest_agent_should_return_latest_agent_even_on_bad_error_json(self): dst_ver = self.prepare_agents() # Add a malformed error.json file in all existing agents @@ -1709,7 +1708,6 @@ def test_it_should_set_dns_tcp_iptable_if_drop_available_accept_unavailable(self with patch('azurelinuxagent.common.conf.enable_firewall', return_value=True): with patch.object(osutil, '_enable_firewall', True): # drop rule is present -# <<<<<<< HEAD mock_iptables.set_command( AddFirewallRules.get_wire_non_root_drop_rule(AddFirewallRules.CHECK_COMMAND, mock_iptables.destination, @@ -1743,21 +1741,6 @@ def test_it_should_set_dns_tcp_iptable_if_drop_available_accept_unavailable(self self.assertEqual(len(filtered_mock_iptable_calls), 3, "Incorrect number of calls to iptables: [{0}]".format( mock_iptables.command_calls)) -# ======= -# mock_iptables.set_command(osutil.get_firewall_drop_command(mock_iptables.wait, AddFirewallRules.CHECK_COMMAND, mock_iptables.destination), exit_code=0) -# # non root tcp iptable rule is absent -# mock_iptables.set_command(osutil.get_accept_tcp_rule(mock_iptables.wait, AddFirewallRules.CHECK_COMMAND, mock_iptables.destination), exit_code=1) -# update_handler.run(debug=True) -# -# drop_check_command = TestOSUtil._command_to_string(osutil.get_firewall_drop_command(mock_iptables.wait, AddFirewallRules.CHECK_COMMAND, mock_iptables.destination)) -# accept_tcp_check_rule = TestOSUtil._command_to_string(osutil.get_accept_tcp_rule(mock_iptables.wait, AddFirewallRules.CHECK_COMMAND, mock_iptables.destination)) -# accept_tcp_insert_rule = TestOSUtil._command_to_string(osutil.get_accept_tcp_rule(mock_iptables.wait, AddFirewallRules.INSERT_COMMAND, mock_iptables.destination)) -# -# # Filtering the mock iptable command calls with only the once related to this test. -# filtered_mock_iptable_calls = [cmd for cmd in mock_iptables.command_calls if cmd in [drop_check_command, accept_tcp_check_rule, accept_tcp_insert_rule]] -# -# self.assertEqual(len(filtered_mock_iptable_calls), 3, "Incorrect number of calls to iptables: [{0}]".format(mock_iptables.command_calls)) -# >>>>>>> master self.assertEqual(filtered_mock_iptable_calls[0], drop_check_command, "The first command should check the drop rule") self.assertEqual(filtered_mock_iptable_calls[1], accept_tcp_check_rule, @@ -1772,7 +1755,6 @@ def test_it_should_not_set_dns_tcp_iptable_if_drop_unavailable(self): with patch('azurelinuxagent.common.conf.enable_firewall', return_value=True): with patch.object(osutil, '_enable_firewall', True): # drop rule is not available -# <<<<<<< HEAD mock_iptables.set_command( AddFirewallRules.get_wire_non_root_drop_rule(AddFirewallRules.CHECK_COMMAND, mock_iptables.destination, @@ -1801,20 +1783,6 @@ def test_it_should_not_set_dns_tcp_iptable_if_drop_unavailable(self): self.assertEqual(len(filtered_mock_iptable_calls), 1, "Incorrect number of calls to iptables: [{0}]".format( mock_iptables.command_calls)) -# ======= -# mock_iptables.set_command(osutil.get_firewall_drop_command(mock_iptables.wait, AddFirewallRules.CHECK_COMMAND, mock_iptables.destination), exit_code=1) -# -# update_handler.run(debug=True) -# -# drop_check_command = TestOSUtil._command_to_string(osutil.get_firewall_drop_command(mock_iptables.wait, AddFirewallRules.CHECK_COMMAND, mock_iptables.destination)) -# accept_tcp_check_rule = TestOSUtil._command_to_string(osutil.get_accept_tcp_rule(mock_iptables.wait, AddFirewallRules.CHECK_COMMAND, mock_iptables.destination)) -# accept_tcp_insert_rule = TestOSUtil._command_to_string(osutil.get_accept_tcp_rule(mock_iptables.wait, AddFirewallRules.INSERT_COMMAND, mock_iptables.destination)) -# -# # Filtering the mock iptable command calls with only the once related to this test. -# filtered_mock_iptable_calls = [cmd for cmd in mock_iptables.command_calls if cmd in [drop_check_command, accept_tcp_check_rule, accept_tcp_insert_rule]] -# -# self.assertEqual(len(filtered_mock_iptable_calls), 1, "Incorrect number of calls to iptables: [{0}]".format(mock_iptables.command_calls)) -# >>>>>>> master self.assertEqual(filtered_mock_iptable_calls[0], drop_check_command, "The first command should check the drop rule") @@ -1825,7 +1793,6 @@ def test_it_should_not_set_dns_tcp_iptable_if_drop_and_accept_available(self): with patch('azurelinuxagent.common.conf.enable_firewall', return_value=True): with patch.object(osutil, '_enable_firewall', True): # drop rule is available -# <<<<<<< HEAD mock_iptables.set_command( AddFirewallRules.get_wire_non_root_drop_rule(AddFirewallRules.CHECK_COMMAND, mock_iptables.destination, @@ -1859,22 +1826,6 @@ def test_it_should_not_set_dns_tcp_iptable_if_drop_and_accept_available(self): self.assertEqual(len(filtered_mock_iptable_calls), 2, "Incorrect number of calls to iptables: [{0}]".format( mock_iptables.command_calls)) -# ======= -# mock_iptables.set_command(osutil.get_firewall_drop_command(mock_iptables.wait, AddFirewallRules.CHECK_COMMAND, mock_iptables.destination), exit_code=0) -# # non root tcp iptable rule is available -# mock_iptables.set_command(osutil.get_accept_tcp_rule(mock_iptables.wait, AddFirewallRules.CHECK_COMMAND, mock_iptables.destination), exit_code=0) -# -# update_handler.run(debug=True) -# -# drop_check_command = TestOSUtil._command_to_string(osutil.get_firewall_drop_command(mock_iptables.wait, AddFirewallRules.CHECK_COMMAND, mock_iptables.destination)) -# accept_tcp_check_rule = TestOSUtil._command_to_string(osutil.get_accept_tcp_rule(mock_iptables.wait, AddFirewallRules.CHECK_COMMAND, mock_iptables.destination)) -# accept_tcp_insert_rule = TestOSUtil._command_to_string(osutil.get_accept_tcp_rule(mock_iptables.wait, AddFirewallRules.INSERT_COMMAND, mock_iptables.destination)) -# -# # Filtering the mock iptable command calls with only the once related to this test. -# filtered_mock_iptable_calls = [cmd for cmd in mock_iptables.command_calls if cmd in [drop_check_command, accept_tcp_check_rule, accept_tcp_insert_rule]] -# -# self.assertEqual(len(filtered_mock_iptable_calls), 2, "Incorrect number of calls to iptables: [{0}]".format(mock_iptables.command_calls)) -# >>>>>>> master self.assertEqual(filtered_mock_iptable_calls[0], drop_check_command, "The first command should check the drop rule") self.assertEqual(filtered_mock_iptable_calls[1], accept_tcp_check_rule, diff --git a/tests/protocol/test_extensions_goal_state_from_vm_settings.py b/tests/protocol/test_extensions_goal_state_from_vm_settings.py index 8a7d4c89a..8cdfa81bf 100644 --- a/tests/protocol/test_extensions_goal_state_from_vm_settings.py +++ b/tests/protocol/test_extensions_goal_state_from_vm_settings.py @@ -108,14 +108,6 @@ def test_its_source_channel_should_be_host_ga_plugin(self): self.assertEqual(GoalStateChannel.HostGAPlugin, extensions_goal_state.channel, "The channel is incorrect") - def test_create_from_vm_settings_should_parse_missing_status_upload_blob_as_none(self): - vm_settings_text = fileutil.read_file(os.path.join(data_dir, "hostgaplugin/vm_settings-no_status_upload_blob.json")) - vm_settings = ExtensionsGoalStateFactory.create_from_vm_settings("123", vm_settings_text) - - self.assertIsNone(vm_settings.status_upload_blob, "Expected status upload blob to be None") - self.assertEqual("BlockBlob", vm_settings.status_upload_blob_type, "Expected status upload blob to be Block") - - class CaseFoldedDictionaryTestCase(AgentTestCase): def test_it_should_retrieve_items_ignoring_case(self): dictionary = json.loads('''{