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

Release 3.36.0 : Fixes Client Telemetry Release Test #4132

Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -4,11 +4,9 @@

namespace Microsoft.Azure.Cosmos.SDK.EmulatorTests
{
using System;
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.Azure.Cosmos.Fluent;
using Microsoft.Azure.Cosmos.Telemetry;
using Microsoft.VisualStudio.TestTools.UnitTesting;

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,17 @@ namespace Microsoft.Azure.Cosmos.SDK.EmulatorTests
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.Azure.Cosmos.Tracing;
using Microsoft.Azure.Cosmos.Telemetry;
using Microsoft.Azure.Cosmos.Handler;
using Microsoft.Azure.Documents;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json;
using Documents.Rntbd;
using System.Globalization;
using System.Linq;
using Cosmos.Util;
using Microsoft.Azure.Cosmos.Telemetry.Models;

public abstract class ClientTelemetryTestsBase : BaseCosmosClientHelper
{
protected static readonly Uri telemetryServiceEndpoint = new Uri("http://dummy.telemetry.service/api/url");
protected static readonly Uri telemetryServiceEndpoint = new Uri("https://tools.cosmos.azure.com/api/clienttelemetry/trace");
sourabh1007 marked this conversation as resolved.
Show resolved Hide resolved

private static readonly List<string> preferredRegionList = new List<string>
{
Expand Down Expand Up @@ -71,7 +69,7 @@ public virtual void TestInitialize()
{
RequestCallBack = (request, cancellation) =>
{
if (request.RequestUri.AbsoluteUri.Equals(telemetryServiceEndpoint.AbsoluteUri))
if (request.RequestUri.AbsoluteUri.Contains(telemetryServiceEndpoint.PathAndQuery))
{
string jsonObject = request.Content.ReadAsStringAsync().GetAwaiter().GetResult();

Expand All @@ -84,7 +82,7 @@ public virtual void TestInitialize()
},
ResponseIntercepter = (response) =>
{
if (response.RequestMessage != null && response.RequestMessage.RequestUri.AbsoluteUri.Equals(telemetryServiceEndpoint.AbsoluteUri))
if (response.RequestMessage != null && response.RequestMessage.RequestUri.AbsoluteUri.Contains(telemetryServiceEndpoint.PathAndQuery))
{
Assert.AreEqual(HttpStatusCode.NoContent, response.StatusCode);
}
Expand All @@ -93,7 +91,7 @@ public virtual void TestInitialize()
},
ExceptionIntercepter = (request, exception) =>
{
if (request.RequestUri.AbsoluteUri.Equals(telemetryServiceEndpoint.AbsoluteUri))
if (request.RequestUri.AbsoluteUri.Contains(telemetryServiceEndpoint.PathAndQuery))
{
this.isClientTelemetryAPICallFailed = true;
}
Expand All @@ -110,7 +108,7 @@ public virtual void TestInitialize()
return Task.FromResult(result);
}

if (request.RequestUri.AbsoluteUri.Equals(telemetryServiceEndpoint.AbsoluteUri))
if (request.RequestUri.AbsoluteUri.Contains(telemetryServiceEndpoint.PathAndQuery))
{
string jsonObject = request.Content.ReadAsStringAsync().GetAwaiter().GetResult();

Expand All @@ -124,15 +122,15 @@ public virtual void TestInitialize()
},
ResponseIntercepter = (response) =>
{
if (response.RequestMessage != null && response.RequestMessage.RequestUri.AbsoluteUri.Equals(telemetryServiceEndpoint.AbsoluteUri))
if (response.RequestMessage != null && response.RequestMessage.RequestUri.AbsoluteUri.Contains(telemetryServiceEndpoint.PathAndQuery))
{
Assert.AreEqual(HttpStatusCode.NoContent, response.StatusCode);
}
return Task.FromResult(response);
},
ExceptionIntercepter = (request, exception) =>
{
if (request.RequestUri.AbsoluteUri.Equals(telemetryServiceEndpoint.AbsoluteUri))
if (request.RequestUri.AbsoluteUri.Contains(telemetryServiceEndpoint.PathAndQuery))
{
this.isClientTelemetryAPICallFailed = true;
}
Expand Down
Loading