Exemplo n.º 1
0
    def test_ensure_health_service_called(self):
        host_plugin = self._init_host()

        with patch("azurelinuxagent.common.utils.restutil.http_get",
                   return_value=MockHttpResponse(200)) as patch_http_get:
            with patch(
                    "azurelinuxagent.common.protocol.healthservice.HealthService.report_host_plugin_versions"
            ) as patch_report_versions:
                host_plugin.get_api_versions()
                self.assertEqual(1, patch_http_get.call_count)
                self.assertEqual(1, patch_report_versions.call_count)
Exemplo n.º 2
0
 def http_post_handler(url, _, **__):
     if self.is_telemetry_request(url):
         return MockHttpResponse(
             restutil.httpclient.SERVICE_UNAVAILABLE)
     return None
Exemplo n.º 3
0
 def http_get_handler(url, *_, **__):
     if self.is_host_plugin_health_request(url):
         return MockHttpResponse(status=503)
     return None
Exemplo n.º 4
0
 def http_post_handler(url, _, **__):
     if self.is_health_service_request(url):
         http_post_handler.health_service_posted = True
         return MockHttpResponse(status=200)
     return None
Exemplo n.º 5
0
 def http_put_handler(url, _, **__):
     if self.is_host_plugin_put_logs_request(url):
         http_put_handler.counter += 1
         return MockHttpResponse(status=200)
     return None
 def http_post_handler(url, body, **__):
     if self.is_telemetry_request(url):
         send_telemetry_events_handler.event_calls.append((datetime.now(), body))
         return MockHttpResponse(status=200)
     return None
Exemplo n.º 7
0
 def http_post_handler(url, body, **__):
     if self.is_telemetry_request(url):
         http_post_handler.request_body = body
         return MockHttpResponse(status=200)
     return None