Skip to content

Commit

Permalink
[application-insights] az monitor app-insights web-test: Fix issue …
Browse files Browse the repository at this point in the history
…for header property display (#5809)

* az monitor app-insights web-test: Fix issue for header property create and display.

* clean code
  • Loading branch information
kairu-ms authored Jan 28, 2023
1 parent 6bc6184 commit 9904386
Show file tree
Hide file tree
Showing 86 changed files with 440 additions and 14,651 deletions.
8 changes: 6 additions & 2 deletions src/application-insights/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@
Release History
===============
0.1.18
++++++++++++++++++
* `az monitor app-insights web-test`: Fix issue for header property create and display.

0.1.17
++++++++++++++++++
* `az monitor app-insights component connect-webapp`: Support cross resource groups.
* `az monitor app-insights component connect-function`: Support cross resource groups.
* `az monitor app-insights component connect-webapp`: Support cross resource groups.
* `az monitor app-insights component connect-function`: Support cross resource groups.

0.1.16
++++++++++++++++++
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"azext.minCliCoreVersion": "2.0.79",
"azext.minCliCoreVersion": "2.38.0",
"azext.isPreview": true
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@
# --------------------------------------------------------------------------------------------

# pylint: disable=line-too-long
import unittest

from azure.cli.testsdk import ScenarioTest


class ApplicationInsightsDataClientTests(ScenarioTest):
"""Test class for Application Insights data client."""
@unittest.skip("ResourceNotAvailable")
def test_query_execute(self):
"""Tests data plane query capabilities for Application Insights."""
self.cmd('az monitor app-insights query --apps 578f0e27-12e9-4631-bc02-50b965da2633 f4963800-c77d-40a3-8b0b-448678904c33 --analytics-query "availabilityResults | distinct name | order by name asc"', checks=[
Expand All @@ -23,11 +26,13 @@ def test_query_execute(self):
assert len(query_guid['tables'][0]['rows']) == 37
assert isinstance(query_guid['tables'][0]['rows'][0][1], (int, float, complex))

@unittest.skip("ResourceNotAvailable")
def test_query_execute_with_different_offset(self):
"""Tests data plane query capabilities for Application Insights."""
self.cmd('az monitor app-insights query --apps db709f0e-cb4e-4f43-ba80-05e10d6a4447 --analytics-query "availabilityResults | distinct name | order by name asc" --offset P3DT12H')
self.cmd('az monitor app-insights query --apps db709f0e-cb4e-4f43-ba80-05e10d6a4447 --analytics-query "availabilityResults | distinct name | order by name asc" --offset 3d12h1m')

@unittest.skip("ResourceNotAvailable")
def test_metrics_show(self):
self.cmd('az monitor app-insights metrics show --app 578f0e27-12e9-4631-bc02-50b965da2633 --metrics requests/duration --aggregation count sum --start-time 2019-03-06 00:31 +00:00 --end-time 2019-03-06 01:31 +00:00', checks=[
self.check('value."requests/duration".count', 0),
Expand All @@ -38,6 +43,7 @@ def test_metrics_show(self):
assert isinstance(result["value"]["availabilityResults/count"]['sum'], (int, float, complex))
assert result["value"]["availabilityResults/count"]['sum'] == azure_result["value"]["availabilityResults/count"]['sum']

@unittest.skip("ResourceNotAvailable")
def test_metrics_get_metadata(self):
self.cmd('az monitor app-insights metrics get-metadata --app 578f0e27-12e9-4631-bc02-50b965da2633', checks=[
self.check('dimensions."availabilityResult/location".displayName', 'Run location'),
Expand All @@ -46,6 +52,7 @@ def test_metrics_get_metadata(self):
self.check('metrics."users/count".supportedGroupBy.all[0]', 'trace/severityLevel')
])

@unittest.skip("ResourceNotAvailable")
def test_events_show(self):
self.cmd('az monitor app-insights events show --app 578f0e27-12e9-4631-bc02-50b965da2633 --type availabilityResults --event 792aeac4-3f9a-11e9-bbeb-376e4a601afa --start-time 2019-03-05 23:00:00 +00:00 --end-time 2019-03-05 23:05:00 +00:00', checks=[
self.check('value[0].ai.appId', '578f0e27-12e9-4631-bc02-50b965da2633'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -540,3 +540,21 @@ def test_appinsights_webtest_crud(self, resource_group_location):
]
)
self.cmd("monitor app-insights web-test delete -n {name} -g {rg} --yes")

self.cmd(
"monitor app-insights web-test create -n {name} -l {loc} -g {rg} "
"--enabled true --frequency 900 --web-test-kind {kind} --locations Id={location_id1} --defined-web-test-name {name} "
"--http-verb {http_verb} --request-body {request_body} --request-url {request_url} --retry-enabled true --synthetic-monitor-id {name} --timeout 120 "
"--ssl-lifetime-check 100 --ssl-check true --headers key=x-ms-test value=123 --tags {tag}=Resource",
checks=[
self.check("webTestName", "{name}"),
self.check("type", "microsoft.insights/webtests")
]
)
self.cmd(
"monitor app-insights web-test list -g {rg} --component-name {app_name}",
checks=[
self.check("length(@)", 1),
self.check("@[0].webTestName", "{name}")
]
)

This file was deleted.

Loading

0 comments on commit 9904386

Please sign in to comment.