code
stringlengths
3
6.57k
manifest.uris.append("https://nowhere.msft/agent/{0}".format(i)
self.agent_manifests.append(manifest)
create_packages(self)
ExtHandlerPackageList()
len(self.versions)
ExtHandlerPackage(str(version)
range(0, 5)
format(i)
package.uris.append(package_uri)
self.agent_packages.versions.append(package)
get_protocol(self)
get_vmagent_manifests(self)
ResourceGoneError()
get_vmagent_pkgs(self, manifest)
ResourceGoneError()
update_goal_state(self)
ResponseMock(Mock)
__init__(self, status=restutil.httpclient.OK, response=None, reason=None)
Mock.__init__(self)
read(self)
TimeMock(Mock)
__init__(self, time_increment=1)
Mock.__init__(self)
time.time()
sleep(self, n)
time(self)
TryUpdateGoalStateTestCase(HttpRequestPredicates, AgentTestCase)
UpdateHandler._try_update_goal_state()
test_it_should_return_true_on_success(self)
get_update_handler()
mock_wire_protocol(mockwiredata.DATA_FILE)
self.assertTrue(update_handler._try_update_goal_state(protocol)
test_it_should_return_false_on_failure(self)
mock_wire_protocol(mockwiredata.DATA_FILE)
http_get_handler(url, *_, **__)
self.is_goal_state_request(url)
HttpError('Exception to fake an error retrieving the goal state')
protocol.set_http_handlers(http_get_handler=http_get_handler)
get_update_handler()
self.assertFalse(update_handler._try_update_goal_state(protocol)
test_it_should_update_the_goal_state(self)
get_update_handler()
mock_wire_protocol(mockwiredata.DATA_FILE)
protocol.mock_wire_data.set_incarnation(12345)
update_handler._try_update_goal_state(protocol)
self.assertEqual(protocol.get_incarnation()
updated (received unexpected incarnation)
update_handler._try_update_goal_state(protocol)
self.assertEqual(protocol.get_incarnation()
updated (received unexpected incarnation)
protocol.mock_wire_data.set_incarnation(6789)
update_handler._try_update_goal_state(protocol)
self.assertEqual(protocol.get_incarnation()
updated (received unexpected incarnation)
test_it_should_log_errors_only_when_the_error_state_changes(self)
mock_wire_protocol(mockwiredata.DATA_FILE)
http_get_handler(url, *_, **__)
self.is_goal_state_request(url)
HttpError('Exception to fake an error retrieving the goal state')
protocol.set_http_handlers(http_get_handler=http_get_handler)
create_log_and_telemetry_mocks()
patch("azurelinuxagent.ga.update.logger", autospec=True)
patch("azurelinuxagent.ga.update.add_event")
str(c)
calls_to_strings(calls)
re.match(regex, c)
filter_calls(logger.method_calls, regex)
logger_calls(r'call.warn\(.*An error occurred while retrieving the goal state.*')
logger_calls(r'call.periodic_warn\(.*Attempts to retrieve the goal state are failing.*')
logger_calls(r'call.info\(.*Retrieving the goal state recovered from previous errors.*')
filter_calls(add_event.mock_calls, regex)
telemetry_calls(r".*op='FetchGoalState'.*")
get_update_handler()
create_log_and_telemetry_mocks()
as (logger, add_event)
update_handler._try_update_goal_state(protocol)
logger_calls()
self.assertTrue(len(lc)
format(lc)
telemetry_calls()
self.assertTrue(len(tc)
format(tc)
create_log_and_telemetry_mocks()
as (logger, add_event)
update_handler._try_update_goal_state(protocol)
warnings()
periodic_warnings()
self.assertEqual(1, len(w)
format(w)
self.assertEqual(1, len(pw)
format(pw)
goal_state_events()
self.assertTrue(len(gs)
event (success=false)
format(gs)
create_log_and_telemetry_mocks()
as (logger, add_event)
update_handler._try_update_goal_state(protocol)
update_handler._try_update_goal_state(protocol)
update_handler._try_update_goal_state(protocol)