Skip to content

Commit

Permalink
test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
narrieta committed Sep 20, 2022
1 parent 91e8ac4 commit 3928dbd
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 61 deletions.
4 changes: 0 additions & 4 deletions azurelinuxagent/common/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
49 changes: 0 additions & 49 deletions tests/ga/test_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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")

Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
8 changes: 0 additions & 8 deletions tests/protocol/test_extensions_goal_state_from_vm_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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('''{
Expand Down

0 comments on commit 3928dbd

Please sign in to comment.