|
| 1 | +--- |
| 2 | +setup: |
| 3 | + - requires: |
| 4 | + cluster_features: [ "random_sampling" ] |
| 5 | + reason: requires feature 'random_sampling' to delete random samples |
| 6 | + |
| 7 | +--- |
| 8 | +teardown: |
| 9 | + - do: |
| 10 | + indices.delete: |
| 11 | + index: "*test*" |
| 12 | + ignore_unavailable: true |
| 13 | + allow_no_indices: true |
| 14 | + |
| 15 | +--- |
| 16 | +"Test Delete existing sampling configuration": |
| 17 | + - do: |
| 18 | + indices.create: |
| 19 | + index: test-delete-index |
| 20 | + body: |
| 21 | + settings: |
| 22 | + number_of_shards: 1 |
| 23 | + |
| 24 | + # First create a sampling configuration |
| 25 | + - do: |
| 26 | + indices.put_sample_configuration: |
| 27 | + index: test-delete-index |
| 28 | + body: |
| 29 | + rate: 0.5 |
| 30 | + max_samples: 100 |
| 31 | + max_size: "10mb" |
| 32 | + time_to_live: "1h" |
| 33 | + |
| 34 | + - match: { acknowledged: true } |
| 35 | + |
| 36 | + # Now delete the sampling configuration |
| 37 | + - do: |
| 38 | + indices.delete_sample_configuration: |
| 39 | + index: test-delete-index |
| 40 | + |
| 41 | + - match: { acknowledged: true } |
| 42 | + |
| 43 | +--- |
| 44 | +"Delete sampling configuration for non-existent index": |
| 45 | + - do: |
| 46 | + catch: missing |
| 47 | + indices.delete_sample_configuration: |
| 48 | + index: non-existent-index |
| 49 | + |
| 50 | +--- |
| 51 | +"Delete non-existent sampling configuration": |
| 52 | + - do: |
| 53 | + indices.create: |
| 54 | + index: test-no-config-index |
| 55 | + |
| 56 | + # Try to delete configuration that doesn't exist |
| 57 | + - do: |
| 58 | + catch: missing |
| 59 | + indices.delete_sample_configuration: |
| 60 | + index: test-no-config-index |
| 61 | + |
| 62 | +--- |
| 63 | +"Delete sampling configuration with custom timeouts": |
| 64 | + - do: |
| 65 | + indices.create: |
| 66 | + index: test-timeout-index |
| 67 | + |
| 68 | + # Create a sampling configuration |
| 69 | + - do: |
| 70 | + indices.put_sample_configuration: |
| 71 | + index: test-timeout-index |
| 72 | + body: |
| 73 | + rate: 0.3 |
| 74 | + max_samples: 50 |
| 75 | + |
| 76 | + - match: { acknowledged: true } |
| 77 | + |
| 78 | + # Delete with custom timeouts |
| 79 | + - do: |
| 80 | + indices.delete_sample_configuration: |
| 81 | + index: test-timeout-index |
| 82 | + master_timeout: "2m" |
| 83 | + timeout: "45s" |
| 84 | + |
| 85 | + - match: { acknowledged: true } |
| 86 | + |
| 87 | +--- |
| 88 | +"Delete one configuration leaves others intact": |
| 89 | + - do: |
| 90 | + indices.create: |
| 91 | + index: test-multi-index-1 |
| 92 | + |
| 93 | + - do: |
| 94 | + indices.create: |
| 95 | + index: test-multi-index-2 |
| 96 | + |
| 97 | + # Create sampling configurations for both indices |
| 98 | + - do: |
| 99 | + indices.put_sample_configuration: |
| 100 | + index: test-multi-index-1 |
| 101 | + body: |
| 102 | + rate: 0.4 |
| 103 | + max_samples: 40 |
| 104 | + |
| 105 | + - match: { acknowledged: true } |
| 106 | + |
| 107 | + - do: |
| 108 | + indices.put_sample_configuration: |
| 109 | + index: test-multi-index-2 |
| 110 | + body: |
| 111 | + rate: 0.6 |
| 112 | + max_samples: 60 |
| 113 | + |
| 114 | + - match: { acknowledged: true } |
| 115 | + |
| 116 | + # Delete configuration for first index only |
| 117 | + - do: |
| 118 | + indices.delete_sample_configuration: |
| 119 | + index: test-multi-index-1 |
| 120 | + |
| 121 | + - match: { acknowledged: true } |
| 122 | + |
| 123 | + # Verify second index configuration still exists by trying to delete it |
| 124 | + - do: |
| 125 | + indices.delete_sample_configuration: |
| 126 | + index: test-multi-index-2 |
| 127 | + |
| 128 | + - match: { acknowledged: true } |
| 129 | + |
| 130 | +--- |
| 131 | +"Delete then attempt to delete again": |
| 132 | + - do: |
| 133 | + indices.create: |
| 134 | + index: test-double-delete-index |
| 135 | + |
| 136 | + # Create configuration |
| 137 | + - do: |
| 138 | + indices.put_sample_configuration: |
| 139 | + index: test-double-delete-index |
| 140 | + body: |
| 141 | + rate: 0.7 |
| 142 | + max_samples: 70 |
| 143 | + |
| 144 | + - match: { acknowledged: true } |
| 145 | + |
| 146 | + # First delete should succeed |
| 147 | + - do: |
| 148 | + indices.delete_sample_configuration: |
| 149 | + index: test-double-delete-index |
| 150 | + |
| 151 | + - match: { acknowledged: true } |
| 152 | + |
| 153 | + # Second delete should fail |
| 154 | + - do: |
| 155 | + catch: missing |
| 156 | + indices.delete_sample_configuration: |
| 157 | + index: test-double-delete-index |
| 158 | + |
| 159 | +--- |
| 160 | +"Delete and recreate workflow": |
| 161 | + - do: |
| 162 | + indices.create: |
| 163 | + index: test-recreate-index |
| 164 | + |
| 165 | + # Create initial configuration |
| 166 | + - do: |
| 167 | + indices.put_sample_configuration: |
| 168 | + index: test-recreate-index |
| 169 | + body: |
| 170 | + rate: 0.2 |
| 171 | + max_samples: 20 |
| 172 | + |
| 173 | + - match: { acknowledged: true } |
| 174 | + |
| 175 | + # Delete the configuration |
| 176 | + - do: |
| 177 | + indices.delete_sample_configuration: |
| 178 | + index: test-recreate-index |
| 179 | + |
| 180 | + - match: { acknowledged: true } |
| 181 | + |
| 182 | + # Recreate with different configuration |
| 183 | + - do: |
| 184 | + indices.put_sample_configuration: |
| 185 | + index: test-recreate-index |
| 186 | + body: |
| 187 | + rate: 0.9 |
| 188 | + max_samples: 90 |
| 189 | + max_size: "20mb" |
| 190 | + |
| 191 | + - match: { acknowledged: true } |
| 192 | + |
| 193 | + # Delete the new configuration |
| 194 | + - do: |
| 195 | + indices.delete_sample_configuration: |
| 196 | + index: test-recreate-index |
| 197 | + |
| 198 | + - match: { acknowledged: true } |
0 commit comments