Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Longw/metadata e2e test #1266

Merged
merged 15 commits into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ spec:
value: {{ .Values.amalogs.sidecarscraping | quote }}
- name: ENABLE_CUSTOM_METRICS
value: {{ .Values.amalogs.enableCustomMetrics | quote }}
{{ if .Values.amalogs.ISTEST }}
- name: AZMON_KUBERNETES_METADATA_ENABLED
value: "true"
{{- end }}
volumeMounts:
# Uncomment when telegraf upgraded to 1.28.5 or higher
# {{- if .Values.amalogs.enableServiceAccountTimeBoundToken }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ spec:
value: {{ .Values.Azure.proxySettings.isCustomCert | quote }}
- name: ENABLE_CUSTOM_METRICS
value: {{ .Values.amalogs.enableCustomMetrics | quote }}
{{ if .Values.amalogs.ISTEST }}
- name: AZMON_KUBERNETES_METADATA_ENABLED
value: "true"
{{- end }}
- name: HOSTNAME
valueFrom:
fieldRef:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ spec:
value: {{ .Values.Azure.proxySettings.isCustomCert | quote }}
- name: ENABLE_CUSTOM_METRICS
value: {{ .Values.amalogs.enableCustomMetrics | quote }}
{{ if .Values.amalogs.ISTEST }}
- name: AZMON_CLUSTER_COLLECT_ALL_KUBE_EVENTS
value: "true"
{{- end }}
- name: HOSTNAME
valueFrom:
fieldRef:
Expand Down
4 changes: 3 additions & 1 deletion test/e2e/src/common/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@
CONTAINER_PERF_MEMORY_WS_USAGE_QUERY = "Perf | where ObjectName == 'K8SContainer' | where CounterName == 'memoryWorkingSetBytes' | where TimeGenerated > ago({0}) | count"
CONTAINER_PERF_RESTART_TIME_EPOCH_QUERY = "Perf | where ObjectName == 'K8SContainer' | where CounterName == 'restartTimeEpoch' | where TimeGenerated > ago({0}) | count"
# container log
CONTAINER_LOG_QUERY = "ContainerLog | where TimeGenerated > ago({0}) | count"
CONTAINER_LOG_V2_QUERY = "ContainerLogV2 | where TimeGenerated > ago({0}) | count"
CONTAINER_LOG_V2_K8S_METADATA_QUERY = "ContainerLogV2 | where TimeGenerated > ago({0}) | where KubernetesMetadata != "" | count"

# insights metrics
INSIGHTS_METRICS_QUERY = "InsightsMetrics | where TimeGenerated > ago({0}) | count"

Expand Down
19 changes: 15 additions & 4 deletions test/e2e/src/tests/test_e2e_workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,16 +319,27 @@ def test_e2e_workflows(env_dict):
if not rowCount:
pytest.fail("rowCount should be greater than for cluster: {0} for workflow: {1} ".format(clusterResourceId, 'CONTAINER_PERF_RESTART_TIME_EPOCH'))

# Container log
query = constants.CONTAINER_LOG_QUERY.format(queryTimeInterval)
# Container log v2
query = constants.CONTAINER_LOG_V2_QUERY.format(queryTimeInterval)
params = { 'query': query}
result = requests.get(queryUrl, params=params, headers=Headers)
if not result:
pytest.fail("log analytics query response shouldnt be null or empty for workflow: {0}".format('CONTAINER_LOG'))
pytest.fail("log analytics query response shouldnt be null or empty for workflow: {0}".format('CONTAINER_LOG_V2'))

rowCount = result.json()['tables'][0]['rows'][0][0]
if not rowCount:
pytest.fail("rowCount should be greater than for cluster: {0} for workflow: {1} ".format(clusterResourceId, 'CONTAINER_LOG'))
pytest.fail("rowCount should be greater than for cluster: {0} for workflow: {1} ".format(clusterResourceId, 'CONTAINER_LOG_V2'))

# Container log v2 Kubernetes Metadata
query = constants.CONTAINER_LOG_V2_K8S_METADATA_QUERY.format(queryTimeInterval)
params = { 'query': query}
result = requests.get(queryUrl, params=params, headers=Headers)
if not result:
pytest.fail("log analytics query response shouldnt be null or empty for workflow: {0}".format('CONTAINER_LOG_V2_K8S_METADATA'))

rowCount = result.json()['tables'][0]['rows'][0][0]
if not rowCount:
pytest.fail("rowCount should be greater than for cluster: {0} for workflow: {1} ".format(clusterResourceId, 'CONTAINER_LOG_V2_K8S_METADATA'))

# InsightsMetrics
query = constants.INSIGHTS_METRICS_QUERY.format(queryTimeInterval)
Expand Down
Loading