Skip to content

Commit 6773a60

Browse files
authored
Remove redundant assertions from ConsistentSamplerTest (#2069)
1 parent f2f65b6 commit 6773a60

File tree

1 file changed

+1
-14
lines changed

1 file changed

+1
-14
lines changed

consistent-sampling/src/test/java/io/opentelemetry/contrib/sampler/consistent56/ConsistentSamplerTest.java

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,6 @@ private static class Output {
8787
this.parentContext = parentContext;
8888
}
8989

90-
boolean getSampledFlag() {
91-
return SamplingDecision.RECORD_AND_SAMPLE.equals(samplingResult.getDecision());
92-
}
93-
9490
OptionalLong getThreshold() {
9591
Span parentSpan = Span.fromContext(parentContext);
9692
OtelTraceState otelTraceState =
@@ -163,7 +159,6 @@ void testMinThresholdWithoutParentRandomValue() {
163159
assertThat(output.samplingResult.getDecision()).isEqualTo(SamplingDecision.RECORD_AND_SAMPLE);
164160
assertThat(output.getThreshold()).hasValue(0);
165161
assertThat(output.getRandomValue()).isNotPresent();
166-
assertThat(output.getSampledFlag()).isTrue();
167162
}
168163

169164
@Test
@@ -181,7 +176,6 @@ void testMinThresholdWithParentRandomValue() {
181176
assertThat(output.samplingResult.getDecision()).isEqualTo(SamplingDecision.RECORD_AND_SAMPLE);
182177
assertThat(output.getThreshold()).hasValue(0);
183178
assertThat(output.getRandomValue()).hasValue(parentRandomValue);
184-
assertThat(output.getSampledFlag()).isTrue();
185179
}
186180

187181
@Test
@@ -194,9 +188,8 @@ void testMaxThreshold() {
194188
Output output = sample(input, sampler);
195189

196190
assertThat(output.samplingResult.getDecision()).isEqualTo(SamplingDecision.DROP);
197-
assertThat(output.getThreshold()).isEmpty();
191+
assertThat(output.getThreshold()).isNotPresent();
198192
assertThat(output.getRandomValue()).isNotPresent();
199-
assertThat(output.getSampledFlag()).isFalse();
200193
}
201194

202195
@Test
@@ -216,7 +209,6 @@ void testParentBasedInConsistentMode() {
216209
assertThat(output.samplingResult.getDecision()).isEqualTo(SamplingDecision.RECORD_AND_SAMPLE);
217210
assertThat(output.getThreshold()).hasValue(parentRandomValue);
218211
assertThat(output.getRandomValue()).hasValue(parentRandomValue);
219-
assertThat(output.getSampledFlag()).isTrue();
220212
}
221213

222214
@Test
@@ -232,7 +224,6 @@ void testParentBasedInLegacyMode() {
232224
assertThat(output.samplingResult.getDecision()).isEqualTo(SamplingDecision.RECORD_AND_SAMPLE);
233225
assertThat(output.getThreshold()).isNotPresent();
234226
assertThat(output.getRandomValue()).isNotPresent();
235-
assertThat(output.getSampledFlag()).isTrue();
236227
}
237228

238229
@Test
@@ -248,7 +239,6 @@ void testHalfThresholdNotSampled() {
248239
assertThat(output.samplingResult.getDecision()).isEqualTo(SamplingDecision.DROP);
249240
assertThat(output.getThreshold()).isNotPresent();
250241
assertThat(output.getRandomValue()).hasValue(0x7FFFFFFFFFFFFFL);
251-
assertThat(output.getSampledFlag()).isFalse();
252242
}
253243

254244
@Test
@@ -264,7 +254,6 @@ void testHalfThresholdSampled() {
264254
assertThat(output.samplingResult.getDecision()).isEqualTo(SamplingDecision.RECORD_AND_SAMPLE);
265255
assertThat(output.getThreshold()).hasValue(0x80000000000000L);
266256
assertThat(output.getRandomValue()).hasValue(0x80000000000000L);
267-
assertThat(output.getSampledFlag()).isTrue();
268257
}
269258

270259
@Test
@@ -279,9 +268,7 @@ void testParentViolatingInvariant() {
279268
Output output = sample(input, sampler);
280269

281270
assertThat(output.samplingResult.getDecision()).isEqualTo(SamplingDecision.RECORD_AND_SAMPLE);
282-
283271
assertThat(output.getThreshold()).hasValue(0x0L);
284272
assertThat(output.getRandomValue()).hasValue(0x80000000000000L);
285-
assertThat(output.getSampledFlag()).isTrue();
286273
}
287274
}

0 commit comments

Comments
 (0)