File tree Expand file tree Collapse file tree 2 files changed +8
-13
lines changed
server/src/test/java/org/elasticsearch/cluster/metadata Expand file tree Collapse file tree 2 files changed +8
-13
lines changed Original file line number Diff line number Diff line change @@ -63,14 +63,16 @@ protected DataStreamLifecycle.Template mutateInstance(DataStreamLifecycle.Templa
6363 downsamplingRounds = randomValueOtherThan (downsamplingRounds , DataStreamLifecycleTemplateTests ::randomDownsamplingRounds );
6464 if (downsamplingRounds .get () != null ) {
6565 lifecycleTarget = DataStreamLifecycle .LifecycleType .DATA ;
66+ } else {
67+ downsamplingMethod = ResettableValue .undefined ();
6668 }
6769 }
6870 case 4 -> {
69- if (downsamplingRounds .get () == null ) {
71+ downsamplingMethod = randomValueOtherThan (downsamplingMethod , DataStreamLifecycleTemplateTests ::randomDownsamplingMethod );
72+ if (downsamplingMethod .get () != null && downsamplingRounds .get () == null ) {
7073 downsamplingRounds = ResettableValue .create (DataStreamLifecycleTests .randomDownsamplingRounds ());
7174 lifecycleTarget = DataStreamLifecycle .LifecycleType .DATA ;
7275 }
73- downsamplingMethod = randomValueOtherThan (downsamplingMethod , DataStreamLifecycleTemplateTests ::randomDownsamplingMethod );
7476 }
7577 default -> throw new AssertionError ("Illegal randomisation branch" );
7678 }
@@ -219,7 +221,7 @@ public static DataStreamLifecycle.Template randomDataLifecycleTemplate() {
219221 downsamplingRounds ,
220222 downsamplingRounds .get () == null
221223 ? randomBoolean () ? ResettableValue .undefined () : ResettableValue .reset ()
222- : ResettableValue . undefined ()
224+ : randomDownsamplingMethod ()
223225 );
224226 }
225227
Original file line number Diff line number Diff line change 1212import org .elasticsearch .action .admin .indices .rollover .RolloverConditions ;
1313import org .elasticsearch .action .admin .indices .rollover .RolloverConfiguration ;
1414import org .elasticsearch .action .admin .indices .rollover .RolloverConfigurationTests ;
15- import org .elasticsearch .action .downsample .DownsampleConfig ;
1615import org .elasticsearch .action .downsample .DownsampleConfigTests ;
1716import org .elasticsearch .common .Strings ;
1817import org .elasticsearch .common .io .stream .Writeable ;
@@ -100,18 +99,12 @@ protected DataStreamLifecycle mutateInstance(DataStreamLifecycle instance) throw
10099 }
101100 }
102101 case 3 -> {
103- // We need to enable downsampling in order to add a non value downsampling method
104- if (downsamplingRounds == null ) {
102+ // We need to enable downsampling in order to add a non-value downsampling method
103+ downsamplingMethod = randomValueOtherThan (downsamplingMethod , DownsampleConfigTests ::randomSamplingMethod );
104+ if (downsamplingMethod != null && downsamplingRounds == null ) {
105105 downsamplingRounds = randomDownsamplingRounds ();
106106 lifecycleTarget = DataStreamLifecycle .LifecycleType .DATA ;
107107 }
108- if (downsamplingMethod == null ) {
109- downsamplingMethod = randomFrom (DownsampleConfig .SamplingMethod .values ());
110- } else if (downsamplingMethod == DownsampleConfig .SamplingMethod .AGGREGATE ) {
111- downsamplingMethod = randomBoolean () ? null : DownsampleConfig .SamplingMethod .LAST_VALUE ;
112- } else {
113- downsamplingMethod = randomBoolean () ? null : DownsampleConfig .SamplingMethod .AGGREGATE ;
114- }
115108 }
116109 default -> enabled = enabled == false ;
117110 }
You can’t perform that action at this time.
0 commit comments