|
34 | 34 | import java.util.List;
|
35 | 35 | import java.util.Map;
|
36 | 36 |
|
| 37 | +import static org.elasticsearch.ingest.SamplingService.RANDOM_SAMPLING_FEATURE_FLAG; |
37 | 38 | import static org.hamcrest.Matchers.empty;
|
38 | 39 | import static org.hamcrest.Matchers.equalTo;
|
39 | 40 | import static org.hamcrest.Matchers.greaterThan;
|
40 | 41 | import static org.hamcrest.Matchers.lessThan;
|
41 | 42 | import static org.hamcrest.Matchers.not;
|
42 | 43 | import static org.hamcrest.Matchers.nullValue;
|
| 44 | +import static org.junit.Assume.assumeTrue; |
43 | 45 |
|
44 | 46 | public class SamplingServiceTests extends ESTestCase {
|
45 | 47 |
|
46 | 48 | private static final String TEST_CONDITIONAL_SCRIPT = "ctx?.foo == 'bar'";
|
47 | 49 |
|
48 | 50 | public void testMaybeSample() {
|
| 51 | + assumeTrue("Requires sampling feature flag", RANDOM_SAMPLING_FEATURE_FLAG); |
49 | 52 | SamplingService samplingService = getTestSamplingService();
|
50 | 53 |
|
51 | 54 | // First, test with a project that has no sampling config:
|
@@ -101,6 +104,7 @@ public void testMaybeSample() {
|
101 | 104 | }
|
102 | 105 |
|
103 | 106 | public void testMaybeSampleWithCondition() {
|
| 107 | + assumeTrue("Requires sampling feature flag", RANDOM_SAMPLING_FEATURE_FLAG); |
104 | 108 | SamplingService samplingService = getTestSamplingService();
|
105 | 109 | String indexName = randomIdentifier();
|
106 | 110 | ProjectMetadata.Builder projectBuilder = ProjectMetadata.builder(ProjectId.DEFAULT)
|
@@ -147,6 +151,7 @@ public void testMaybeSampleWithCondition() {
|
147 | 151 | }
|
148 | 152 |
|
149 | 153 | public void testMaybeSampleWithLowRate() {
|
| 154 | + assumeTrue("Requires sampling feature flag", RANDOM_SAMPLING_FEATURE_FLAG); |
150 | 155 | SamplingService samplingService = getTestSamplingService();
|
151 | 156 | String indexName = randomIdentifier();
|
152 | 157 | ProjectMetadata.Builder projectBuilder = ProjectMetadata.builder(ProjectId.DEFAULT)
|
@@ -185,6 +190,7 @@ public void testMaybeSampleWithLowRate() {
|
185 | 190 | }
|
186 | 191 |
|
187 | 192 | public void testMaybeSampleMaxSamples() {
|
| 193 | + assumeTrue("Requires sampling feature flag", RANDOM_SAMPLING_FEATURE_FLAG); |
188 | 194 | SamplingService samplingService = getTestSamplingService();
|
189 | 195 | String indexName = randomIdentifier();
|
190 | 196 | int maxSamples = randomIntBetween(1, 1000);
|
|
0 commit comments