Skip to content

Commit 8befa1a

Browse files
authored
Refactor unit tests for xray sampler (#65)
*Issue #, if available:* *Description of changes:* - Remove [methods introduced for testing](0746004), use workaround to access private vars By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
1 parent de675cb commit 8befa1a

File tree

5 files changed

+74
-108
lines changed

5 files changed

+74
-108
lines changed

aws-distro-opentelemetry-node-autoinstrumentation/src/sampler/aws-xray-remote-sampler.ts

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -66,38 +66,10 @@ export class AwsXRayRemoteSampler implements Sampler {
6666
this.startSamplingTargetsPoller();
6767
}
6868

69-
public getRulePoller(): NodeJS.Timer | undefined {
70-
return this.rulePoller;
71-
}
72-
73-
public getRulePollingIntervalMillis(): number {
74-
return this.rulePollingIntervalMillis;
75-
}
76-
77-
public getTargetPollingInterval(): number {
78-
return this.targetPollingInterval;
79-
}
80-
8169
public getDefaultTargetPollingInterval(): number {
8270
return DEFAULT_TARGET_POLLING_INTERVAL_SECONDS;
8371
}
8472

85-
public getSamplingClient(): AwsXraySamplingClient {
86-
return this.samplingClient;
87-
}
88-
89-
public getRuleCache(): RuleCache {
90-
return this.ruleCache;
91-
}
92-
93-
public getClientId(): string {
94-
return this.clientId;
95-
}
96-
97-
public getAwsProxyEndpoint(): string {
98-
return this.awsProxyEndpoint;
99-
}
100-
10173
public shouldSample(
10274
context: Context,
10375
traceId: string,

aws-distro-opentelemetry-node-autoinstrumentation/src/sampler/rule-cache.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,6 @@ export class RuleCache {
2828
this.lastUpdatedEpochMillis = Date.now();
2929
}
3030

31-
public getRuleAppliers(): SamplingRuleApplier[] {
32-
return this.ruleAppliers;
33-
}
34-
35-
public getSamplerResource(): Resource {
36-
return this.samplerResource;
37-
}
38-
3931
public isExpired(): boolean {
4032
const nowInMillis: number = Date.now();
4133
return nowInMillis > this.lastUpdatedEpochMillis + RULE_CACHE_TTL_MILLIS;

aws-distro-opentelemetry-node-autoinstrumentation/test/aws-opentelemetry-configurator.test.ts

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ import {
2727
customBuildSamplerFromEnv,
2828
} from '../src/aws-opentelemetry-configurator';
2929
import { AwsSpanMetricsProcessor } from '../src/aws-span-metrics-processor';
30+
import { OTLPUdpSpanExporter } from '../src/otlp-udp-exporter';
3031
import { setAwsDefaultEnvironmentVariables } from '../src/register';
3132
import { AwsXRayRemoteSampler } from '../src/sampler/aws-xray-remote-sampler';
3233
import { AwsXraySamplingClient } from '../src/sampler/aws-xray-sampling-client';
3334
import { GetSamplingRulesResponse } from '../src/sampler/remote-sampler.types';
34-
import { OTLPUdpSpanExporter } from '../src/otlp-udp-exporter';
3535

3636
// Tests AwsOpenTelemetryConfigurator after running Environment Variable setup in register.ts
3737
describe('AwsOpenTelemetryConfiguratorTest', () => {
@@ -117,8 +117,8 @@ describe('AwsOpenTelemetryConfiguratorTest', () => {
117117
const sampler = customBuildSamplerFromEnv(Resource.empty());
118118

119119
expect(sampler).toBeInstanceOf(AwsXRayRemoteSampler);
120-
expect((sampler as AwsXRayRemoteSampler).getAwsProxyEndpoint()).toEqual('http://localhost:2000');
121-
expect((sampler as AwsXRayRemoteSampler).getRulePollingIntervalMillis()).toEqual(300000); // ms
120+
expect((sampler as any).awsProxyEndpoint).toEqual('http://localhost:2000');
121+
expect((sampler as any).rulePollingIntervalMillis).toEqual(300000); // ms
122122

123123
clearInterval((sampler as any).rulePoller);
124124
clearInterval((sampler as any).targetPoller);
@@ -132,12 +132,12 @@ describe('AwsOpenTelemetryConfiguratorTest', () => {
132132
const sampler = customBuildSamplerFromEnv(Resource.empty());
133133

134134
expect(sampler).toBeInstanceOf(AwsXRayRemoteSampler);
135-
expect((sampler as AwsXRayRemoteSampler).getAwsProxyEndpoint()).toEqual('http://asdfghjkl:2000');
136-
expect((sampler as AwsXRayRemoteSampler).getRulePollingIntervalMillis()).toEqual(600000); // ms
137-
expect(((sampler as AwsXRayRemoteSampler).getSamplingClient() as any).getSamplingRulesEndpoint).toEqual(
135+
expect((sampler as any).awsProxyEndpoint).toEqual('http://asdfghjkl:2000');
136+
expect((sampler as any).rulePollingIntervalMillis).toEqual(600000); // ms
137+
expect(((sampler as any).samplingClient as any).getSamplingRulesEndpoint).toEqual(
138138
'http://asdfghjkl:2000/GetSamplingRules'
139139
);
140-
expect(((sampler as AwsXRayRemoteSampler).getSamplingClient() as any).samplingTargetsEndpoint).toEqual(
140+
expect(((sampler as any).samplingClient as any).samplingTargetsEndpoint).toEqual(
141141
'http://asdfghjkl:2000/SamplingTargets'
142142
);
143143

@@ -155,12 +155,12 @@ describe('AwsOpenTelemetryConfiguratorTest', () => {
155155
const sampler = customBuildSamplerFromEnv(Resource.empty());
156156

157157
expect(sampler).toBeInstanceOf(AwsXRayRemoteSampler);
158-
expect((sampler as AwsXRayRemoteSampler).getAwsProxyEndpoint()).toEqual('http://asdfghjkl:2000');
159-
expect((sampler as AwsXRayRemoteSampler).getRulePollingIntervalMillis()).toEqual(300000); // default value
160-
expect(((sampler as AwsXRayRemoteSampler).getSamplingClient() as any).getSamplingRulesEndpoint).toEqual(
158+
expect((sampler as any).awsProxyEndpoint).toEqual('http://asdfghjkl:2000');
159+
expect((sampler as any).rulePollingIntervalMillis).toEqual(300000); // default value
160+
expect(((sampler as any).samplingClient as any).getSamplingRulesEndpoint).toEqual(
161161
'http://asdfghjkl:2000/GetSamplingRules'
162162
);
163-
expect(((sampler as AwsXRayRemoteSampler).getSamplingClient() as any).samplingTargetsEndpoint).toEqual(
163+
expect(((sampler as any).samplingClient as any).samplingTargetsEndpoint).toEqual(
164164
'http://asdfghjkl:2000/SamplingTargets'
165165
);
166166

@@ -187,12 +187,12 @@ describe('AwsOpenTelemetryConfiguratorTest', () => {
187187
let sampler = customBuildSamplerFromEnv(Resource.empty());
188188

189189
expect(sampler).toBeInstanceOf(AwsXRayRemoteSampler);
190-
expect((sampler as AwsXRayRemoteSampler).getAwsProxyEndpoint()).toEqual('http://lo=cal=host=:2000');
191-
expect((sampler as AwsXRayRemoteSampler).getRulePollingIntervalMillis()).toEqual(600000);
192-
expect(((sampler as AwsXRayRemoteSampler).getSamplingClient() as any).getSamplingRulesEndpoint).toEqual(
190+
expect((sampler as any).awsProxyEndpoint).toEqual('http://lo=cal=host=:2000');
191+
expect((sampler as any).rulePollingIntervalMillis).toEqual(600000);
192+
expect(((sampler as any).samplingClient as any).getSamplingRulesEndpoint).toEqual(
193193
'http://lo=cal=host=:2000/GetSamplingRules'
194194
);
195-
expect(((sampler as AwsXRayRemoteSampler).getSamplingClient() as any).samplingTargetsEndpoint).toEqual(
195+
expect(((sampler as any).samplingClient as any).samplingTargetsEndpoint).toEqual(
196196
'http://lo=cal=host=:2000/SamplingTargets'
197197
);
198198

@@ -201,12 +201,12 @@ describe('AwsOpenTelemetryConfiguratorTest', () => {
201201
sampler = customBuildSamplerFromEnv(Resource.empty());
202202

203203
expect(sampler).toBeInstanceOf(AwsXRayRemoteSampler);
204-
expect((sampler as AwsXRayRemoteSampler).getAwsProxyEndpoint()).toEqual('http://localhost:2000');
205-
expect((sampler as AwsXRayRemoteSampler).getRulePollingIntervalMillis()).toEqual(550000);
206-
expect(((sampler as AwsXRayRemoteSampler).getSamplingClient() as any).getSamplingRulesEndpoint).toEqual(
204+
expect((sampler as any).awsProxyEndpoint).toEqual('http://localhost:2000');
205+
expect((sampler as any).rulePollingIntervalMillis).toEqual(550000);
206+
expect(((sampler as any).samplingClient as any).getSamplingRulesEndpoint).toEqual(
207207
'http://localhost:2000/GetSamplingRules'
208208
);
209-
expect(((sampler as AwsXRayRemoteSampler).getSamplingClient() as any).samplingTargetsEndpoint).toEqual(
209+
expect(((sampler as any).samplingClient as any).samplingTargetsEndpoint).toEqual(
210210
'http://localhost:2000/SamplingTargets'
211211
);
212212

aws-distro-opentelemetry-node-autoinstrumentation/test/sampler/aws-xray-remote-sampler.test.ts

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ describe('AwsXrayRemoteSampler', () => {
2121
it('testCreateRemoteSamplerWithEmptyResource', () => {
2222
const sampler: AwsXRayRemoteSampler = new AwsXRayRemoteSampler({ resource: Resource.EMPTY });
2323

24-
expect(sampler.getRulePoller()).not.toBeFalsy();
25-
expect(sampler.getRulePollingIntervalMillis()).toEqual(300 * 1000);
26-
expect(sampler.getSamplingClient()).not.toBeFalsy();
27-
expect(sampler.getRuleCache()).not.toBeFalsy();
28-
expect(sampler.getClientId()).toMatch(/[a-f0-9]{24}/);
24+
expect((sampler as any).rulePoller).not.toBeFalsy();
25+
expect((sampler as any).rulePollingIntervalMillis).toEqual(300 * 1000);
26+
expect((sampler as any).samplingClient).not.toBeFalsy();
27+
expect((sampler as any).ruleCache).not.toBeFalsy();
28+
expect((sampler as any).clientId).toMatch(/[a-f0-9]{24}/);
2929
});
3030

3131
it('testCreateRemoteSamplerWithPopulatedResource', () => {
@@ -35,12 +35,12 @@ describe('AwsXrayRemoteSampler', () => {
3535
});
3636
const sampler = new AwsXRayRemoteSampler({ resource: resource });
3737

38-
expect(sampler.getRulePoller()).not.toBeFalsy();
39-
expect(sampler.getRulePollingIntervalMillis()).toEqual(300 * 1000);
40-
expect(sampler.getSamplingClient()).not.toBeFalsy();
41-
expect(sampler.getRuleCache()).not.toBeFalsy();
42-
expect(sampler.getRuleCache().getSamplerResource().attributes).toEqual(resource.attributes);
43-
expect(sampler.getClientId()).toMatch(/[a-f0-9]{24}/);
38+
expect((sampler as any).rulePoller).not.toBeFalsy();
39+
expect((sampler as any).rulePollingIntervalMillis).toEqual(300 * 1000);
40+
expect((sampler as any).samplingClient).not.toBeFalsy();
41+
expect((sampler as any).ruleCache).not.toBeFalsy();
42+
expect(((sampler as any).ruleCache as any).samplerResource.attributes).toEqual(resource.attributes);
43+
expect((sampler as any).clientId).toMatch(/[a-f0-9]{24}/);
4444
});
4545

4646
it('testCreateRemoteSamplerWithAllFieldsPopulated', () => {
@@ -54,13 +54,13 @@ describe('AwsXrayRemoteSampler', () => {
5454
pollingInterval: 120, // seconds
5555
});
5656

57-
expect(sampler.getRulePoller()).not.toBeFalsy();
58-
expect(sampler.getRulePollingIntervalMillis()).toEqual(120 * 1000);
59-
expect(sampler.getSamplingClient()).not.toBeFalsy();
60-
expect(sampler.getRuleCache()).not.toBeFalsy();
61-
expect(sampler.getRuleCache().getSamplerResource().attributes).toEqual(resource.attributes);
62-
expect(sampler.getAwsProxyEndpoint()).toEqual('http://abc.com');
63-
expect(sampler.getClientId()).toMatch(/[a-f0-9]{24}/);
57+
expect((sampler as any).rulePoller).not.toBeFalsy();
58+
expect((sampler as any).rulePollingIntervalMillis).toEqual(120 * 1000);
59+
expect((sampler as any).samplingClient).not.toBeFalsy();
60+
expect((sampler as any).ruleCache).not.toBeFalsy();
61+
expect(((sampler as any).ruleCache as any).samplerResource.attributes).toEqual(resource.attributes);
62+
expect((sampler as any).awsProxyEndpoint).toEqual('http://abc.com');
63+
expect((sampler as any).clientId).toMatch(/[a-f0-9]{24}/);
6464
});
6565

6666
it('testUpdateSamplingRulesAndTargetsWithPollersAndShouldSampled', done => {
@@ -81,7 +81,7 @@ describe('AwsXrayRemoteSampler', () => {
8181
});
8282

8383
setTimeout(() => {
84-
expect(sampler.getRuleCache().getRuleAppliers()[0].samplingRule.RuleName).toEqual('test');
84+
expect(((sampler as any).ruleCache as any).ruleAppliers[0].samplingRule.RuleName).toEqual('test');
8585
expect(
8686
sampler.shouldSample(context.active(), '1234', 'name', SpanKind.CLIENT, { abc: '1234' }, []).decision
8787
).toEqual(SamplingDecision.NOT_RECORD);
@@ -123,7 +123,7 @@ describe('AwsXrayRemoteSampler', () => {
123123
});
124124

125125
setTimeout(() => {
126-
expect(sampler.getRuleCache().getRuleAppliers()[0].samplingRule.RuleName).toEqual('test');
126+
expect(((sampler as any).ruleCache as any).ruleAppliers[0].samplingRule.RuleName).toEqual('test');
127127
expect(sampler.shouldSample(context.active(), '1234', 'name', SpanKind.CLIENT, attributes, []).decision).toEqual(
128128
SamplingDecision.NOT_RECORD
129129
);
@@ -138,7 +138,9 @@ describe('AwsXrayRemoteSampler', () => {
138138
sampled++;
139139
}
140140
}
141-
expect((sampler.getRuleCache().getRuleAppliers()[0] as any).reservoirSampler._root.quota).toEqual(100000);
141+
expect((((sampler as any).ruleCache as any).ruleAppliers[0] as any).reservoirSampler._root.quota).toEqual(
142+
100000
143+
);
142144
expect(sampled).toEqual(100000);
143145
// reset function
144146
(AwsXRayRemoteSampler.prototype as any).getDefaultTargetPollingInterval = tmp;
@@ -166,7 +168,7 @@ describe('AwsXrayRemoteSampler', () => {
166168
});
167169

168170
setTimeout(() => {
169-
expect(sampler.getRuleCache().getRuleAppliers()[0].samplingRule.RuleName).toEqual('test');
171+
expect(((sampler as any).ruleCache as any).ruleAppliers[0].samplingRule.RuleName).toEqual('test');
170172
expect(sampler.shouldSample(context.active(), '1234', 'name', SpanKind.CLIENT, attributes, []).decision).toEqual(
171173
SamplingDecision.NOT_RECORD
172174
);

aws-distro-opentelemetry-node-autoinstrumentation/test/sampler/rule-cache.test.ts

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
// SPDX-License-Identifier: Apache-2.0
33

4+
import { Resource } from '@opentelemetry/resources';
45
import { expect } from 'expect';
56
import * as sinon from 'sinon';
6-
import { Resource } from '@opentelemetry/resources';
77
import { RuleCache } from '../../src/sampler/rule-cache';
88
import { SamplingRule } from '../../src/sampler/sampling-rule';
99
import { SamplingRuleApplier } from '../../src/sampler/sampling-rule-applier';
@@ -33,7 +33,7 @@ describe('RuleCache', () => {
3333
cache.updateRules([defaultRule]);
3434

3535
// Expect default rule to exist
36-
expect(cache.getRuleAppliers().length).toEqual(1);
36+
expect((cache as any).ruleAppliers.length).toEqual(1);
3737

3838
// Set up incoming rules
3939
const rule1 = createRule('low', 200, 0, 0.0);
@@ -47,13 +47,13 @@ describe('RuleCache', () => {
4747
cache.updateRules(rules);
4848

4949
// Default rule should be removed because it doesn't exist in the new list
50-
expect(cache.getRuleAppliers().length).toEqual(rules.length);
51-
expect(cache.getRuleAppliers()[0].samplingRule.RuleName).toEqual('high');
52-
expect(cache.getRuleAppliers()[1].samplingRule.RuleName).toEqual('A');
53-
expect(cache.getRuleAppliers()[2].samplingRule.RuleName).toEqual('Abc');
54-
expect(cache.getRuleAppliers()[3].samplingRule.RuleName).toEqual('ab');
55-
expect(cache.getRuleAppliers()[4].samplingRule.RuleName).toEqual('abc');
56-
expect(cache.getRuleAppliers()[5].samplingRule.RuleName).toEqual('low');
50+
expect((cache as any).ruleAppliers.length).toEqual(rules.length);
51+
expect((cache as any).ruleAppliers[0].samplingRule.RuleName).toEqual('high');
52+
expect((cache as any).ruleAppliers[1].samplingRule.RuleName).toEqual('A');
53+
expect((cache as any).ruleAppliers[2].samplingRule.RuleName).toEqual('Abc');
54+
expect((cache as any).ruleAppliers[3].samplingRule.RuleName).toEqual('ab');
55+
expect((cache as any).ruleAppliers[4].samplingRule.RuleName).toEqual('abc');
56+
expect((cache as any).ruleAppliers[5].samplingRule.RuleName).toEqual('low');
5757
});
5858

5959
it('testRuleCacheExpirationLogic', () => {
@@ -79,40 +79,40 @@ describe('RuleCache', () => {
7979

8080
cache.updateRules(ruleAppliers);
8181

82-
const ruleAppliersCopy = cache.getRuleAppliers();
82+
const ruleAppliersCopy = (cache as any).ruleAppliers;
8383

8484
const newRule3 = createRule('new_rule_3', 5, 0, 0.0);
8585
const newRuleAppliers = [rule1, rule2, newRule3];
8686
cache.updateRules(newRuleAppliers);
8787

8888
// Check rule cache is still correct length and has correct rules
89-
expect(cache.getRuleAppliers().length).toEqual(3);
90-
expect(cache.getRuleAppliers()[0].samplingRule.RuleName).toEqual('rule_1');
91-
expect(cache.getRuleAppliers()[1].samplingRule.RuleName).toEqual('new_rule_3');
92-
expect(cache.getRuleAppliers()[2].samplingRule.RuleName).toEqual('rule_2');
89+
expect((cache as any).ruleAppliers.length).toEqual(3);
90+
expect((cache as any).ruleAppliers[0].samplingRule.RuleName).toEqual('rule_1');
91+
expect((cache as any).ruleAppliers[1].samplingRule.RuleName).toEqual('new_rule_3');
92+
expect((cache as any).ruleAppliers[2].samplingRule.RuleName).toEqual('rule_2');
9393

9494
// Assert before and after of rule cache
95-
expect(ruleAppliersCopy[0]).toEqual(cache.getRuleAppliers()[0]);
96-
expect(ruleAppliersCopy[1]).toEqual(cache.getRuleAppliers()[2]);
97-
expect(ruleAppliersCopy[2]).not.toEqual(cache.getRuleAppliers()[1]);
95+
expect(ruleAppliersCopy[0]).toEqual((cache as any).ruleAppliers[0]);
96+
expect(ruleAppliersCopy[1]).toEqual((cache as any).ruleAppliers[2]);
97+
expect(ruleAppliersCopy[2]).not.toEqual((cache as any).ruleAppliers[1]);
9898
});
9999

100100
it('testUpdateRulesRemovesOlderRule', () => {
101101
// Set up default rule in rule cache
102102
const cache = new RuleCache(new Resource({}));
103-
expect(cache.getRuleAppliers().length).toEqual(0);
103+
expect((cache as any).ruleAppliers.length).toEqual(0);
104104

105105
const rule1 = createRule('first_rule', 200, 0, 0.0);
106106
const rules = [rule1];
107107
cache.updateRules(rules);
108-
expect(cache.getRuleAppliers().length).toEqual(1);
109-
expect(cache.getRuleAppliers()[0].samplingRule.RuleName).toEqual('first_rule');
108+
expect((cache as any).ruleAppliers.length).toEqual(1);
109+
expect((cache as any).ruleAppliers[0].samplingRule.RuleName).toEqual('first_rule');
110110

111111
const replacement_rule1 = createRule('second_rule', 200, 0, 0.0);
112112
const replacementRules = [replacement_rule1];
113113
cache.updateRules(replacementRules);
114-
expect(cache.getRuleAppliers().length).toEqual(1);
115-
expect(cache.getRuleAppliers()[0].samplingRule.RuleName).toEqual('second_rule');
114+
expect((cache as any).ruleAppliers.length).toEqual(1);
115+
expect((cache as any).ruleAppliers[0].samplingRule.RuleName).toEqual('second_rule');
116116
});
117117

118118
it('testUpdateSamplingTargets', () => {
@@ -121,11 +121,11 @@ describe('RuleCache', () => {
121121
const cache = new RuleCache(new Resource({}));
122122
cache.updateRules([rule1, rule2]);
123123

124-
expect((cache.getRuleAppliers()[0] as any).reservoirSampler._root.quota).toEqual(1);
125-
expect((cache.getRuleAppliers()[0] as any).fixedRateSampler._root._ratio).toEqual(rule2.samplingRule.FixedRate);
124+
expect(((cache as any).ruleAppliers[0] as any).reservoirSampler._root.quota).toEqual(1);
125+
expect(((cache as any).ruleAppliers[0] as any).fixedRateSampler._root._ratio).toEqual(rule2.samplingRule.FixedRate);
126126

127-
expect((cache.getRuleAppliers()[1] as any).reservoirSampler._root.quota).toEqual(1);
128-
expect((cache.getRuleAppliers()[1] as any).fixedRateSampler._root._ratio).toEqual(rule1.samplingRule.FixedRate);
127+
expect(((cache as any).ruleAppliers[1] as any).reservoirSampler._root.quota).toEqual(1);
128+
expect(((cache as any).ruleAppliers[1] as any).fixedRateSampler._root._ratio).toEqual(rule1.samplingRule.FixedRate);
129129

130130
const time = Date.now() / 1000;
131131
const target1 = {
@@ -156,12 +156,12 @@ describe('RuleCache', () => {
156156
expect(nextPollingInterval).toEqual(target2.Interval);
157157

158158
// Ensure cache is still of length 2
159-
expect(cache.getRuleAppliers().length).toEqual(2);
159+
expect((cache as any).ruleAppliers.length).toEqual(2);
160160

161-
expect((cache.getRuleAppliers()[0] as any).reservoirSampler._root.quota).toEqual(target2.ReservoirQuota);
162-
expect((cache.getRuleAppliers()[0] as any).fixedRateSampler._root._ratio).toEqual(target2.FixedRate);
163-
expect((cache.getRuleAppliers()[1] as any).reservoirSampler._root.quota).toEqual(target1.ReservoirQuota);
164-
expect((cache.getRuleAppliers()[1] as any).fixedRateSampler._root._ratio).toEqual(target1.FixedRate);
161+
expect(((cache as any).ruleAppliers[0] as any).reservoirSampler._root.quota).toEqual(target2.ReservoirQuota);
162+
expect(((cache as any).ruleAppliers[0] as any).fixedRateSampler._root._ratio).toEqual(target2.FixedRate);
163+
expect(((cache as any).ruleAppliers[1] as any).reservoirSampler._root.quota).toEqual(target1.ReservoirQuota);
164+
expect(((cache as any).ruleAppliers[1] as any).fixedRateSampler._root._ratio).toEqual(target1.FixedRate);
165165

166166
const [refreshSamplingRulesAfter, _] = cache.updateTargets(targetMap, time + 1);
167167
expect(refreshSamplingRulesAfter).toBe(true);

0 commit comments

Comments
 (0)