@@ -5,7 +5,8 @@ import * as chai from "chai";
5
5
import * as chaiAsPromised from "chai-as-promised" ;
6
6
chai . use ( chaiAsPromised ) ;
7
7
const expect = chai . expect ;
8
- import { MAX_TIME_OUT , createMockedConnectionString , createMockedKeyValue , createMockedTokenCredential , mockAppConfigurationClientListConfigurationSettings , restoreMocks , sleepInMs } from "./utils/testHelper.js" ;
8
+ import { MAX_TIME_OUT , createMockedConnectionString , createMockedKeyValue , createMockedTokenCredential , mockAppConfigurationClientListConfigurationSettings , restoreMocks , sinon , sleepInMs } from "./utils/testHelper.js" ;
9
+ import { ConfigurationClientManager } from "../src/ConfigurationClientManager.js" ;
9
10
import { load } from "./exportedApi.js" ;
10
11
11
12
class HttpRequestHeadersPolicy {
@@ -75,6 +76,19 @@ describe("request tracing", function () {
75
76
expect ( correlationContext . includes ( "UsesKeyVault" ) ) . eq ( true ) ;
76
77
} ) ;
77
78
79
+ it ( "should have replica count in correlation-context header" , async ( ) => {
80
+ const replicaCount = 2 ;
81
+ sinon . stub ( ConfigurationClientManager . prototype , "getReplicaCount" ) . returns ( replicaCount ) ;
82
+ try {
83
+ await load ( createMockedConnectionString ( fakeEndpoint ) , { clientOptions } ) ;
84
+ } catch ( e ) { /* empty */ }
85
+ expect ( headerPolicy . headers ) . not . undefined ;
86
+ const correlationContext = headerPolicy . headers . get ( "Correlation-Context" ) ;
87
+ expect ( correlationContext ) . not . undefined ;
88
+ expect ( correlationContext . includes ( `ReplicaCount=${ replicaCount } ` ) ) . eq ( true ) ;
89
+ sinon . restore ( ) ;
90
+ } ) ;
91
+
78
92
it ( "should detect env in correlation-context header" , async ( ) => {
79
93
process . env . NODE_ENV = "development" ;
80
94
try {
0 commit comments