|
1 | 1 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
2 | 2 | # SPDX-License-Identifier: Apache-2.0
|
| 3 | +import time |
3 | 4 | from typing import Dict, List
|
4 | 5 |
|
5 | 6 | from mock_collector_client import ResourceScopeMetric
|
6 | 7 | from requests import Response
|
| 8 | +from typing_extensions import override |
7 | 9 |
|
8 | 10 | import amazon.utils.application_signals_constants as constants
|
9 |
| -from amazon.django.django_test import DjangoTest |
| 11 | +from amazon.base.contract_test_base import ContractTestBase |
10 | 12 | from opentelemetry.proto.common.v1.common_pb2 import AnyValue
|
11 | 13 | from opentelemetry.proto.metrics.v1.metrics_pb2 import Metric, NumberDataPoint
|
12 | 14 |
|
13 | 15 |
|
14 |
| -class RuntimeMetricsTest(DjangoTest): |
| 16 | +class RuntimeMetricsTest(ContractTestBase): |
| 17 | + @override |
| 18 | + def is_runtime_enabled(self) -> str: |
| 19 | + return "true" |
| 20 | + |
| 21 | + @override |
| 22 | + @staticmethod |
| 23 | + def get_application_image_name() -> str: |
| 24 | + return "aws-application-signals-tests-django-app" |
| 25 | + |
| 26 | + @override |
| 27 | + def get_application_wait_pattern(self) -> str: |
| 28 | + return "Quit the server with CONTROL-C." |
| 29 | + |
| 30 | + @override |
| 31 | + def get_application_extra_environment_variables(self): |
| 32 | + return {"DJANGO_SETTINGS_MODULE": "django_server.settings"} |
15 | 33 |
|
16 | 34 | def test_runtime_succeeds(self) -> None:
|
17 | 35 | self.mock_collector_client.clear_signals()
|
18 | 36 | response: Response = self.send_request("GET", "success")
|
19 | 37 | self.assertEqual(200, response.status_code)
|
| 38 | + time.sleep(60) |
20 | 39 |
|
21 | 40 | metrics: List[ResourceScopeMetric] = self.mock_collector_client.get_metrics(
|
22 | 41 | {
|
|
0 commit comments