-
Notifications
You must be signed in to change notification settings - Fork 0
Mirror upstream elastic/elasticsearch#133811 for AI review (snapshot of HEAD tree) #143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,37 @@ | ||||||||||||||||||
/* | ||||||||||||||||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||||||||||||||||||
* or more contributor license agreements. Licensed under the "Elastic License | ||||||||||||||||||
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side | ||||||||||||||||||
* Public License v 1"; you may not use this file except in compliance with, at | ||||||||||||||||||
* your election, the "Elastic License 2.0", the "GNU Affero General Public | ||||||||||||||||||
* License v3.0 only", or the "Server Side Public License, v 1". | ||||||||||||||||||
*/ | ||||||||||||||||||
|
||||||||||||||||||
package org.elasticsearch.gradle.internal.info; | ||||||||||||||||||
|
||||||||||||||||||
import org.gradle.api.provider.ValueSource; | ||||||||||||||||||
import org.gradle.api.provider.ValueSourceParameters; | ||||||||||||||||||
|
||||||||||||||||||
import java.util.Locale; | ||||||||||||||||||
import java.util.Random; | ||||||||||||||||||
|
||||||||||||||||||
public abstract class TestSeedValueSource implements ValueSource<String, ValueSourceParameters.None> { | ||||||||||||||||||
|
||||||||||||||||||
@Override | ||||||||||||||||||
public ValueSourceParameters.None getParameters() { | ||||||||||||||||||
return null; | ||||||||||||||||||
} | ||||||||||||||||||
Comment on lines
+20
to
+23
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Return the Using the provided singleton clarifies intent and avoids any accidental null-handling edge cases inside Gradle’s value source plumbing. @Override
public ValueSourceParameters.None getParameters() {
- return null;
+ return ValueSourceParameters.None.INSTANCE;
} 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
|
||||||||||||||||||
|
||||||||||||||||||
@Override | ||||||||||||||||||
public String obtain() { | ||||||||||||||||||
String testSeedProperty = System.getProperty("tests.seed"); | ||||||||||||||||||
final String testSeed; | ||||||||||||||||||
if (testSeedProperty == null) { | ||||||||||||||||||
long seed = new Random(System.currentTimeMillis()).nextLong(); | ||||||||||||||||||
testSeed = Long.toUnsignedString(seed, 16).toUpperCase(Locale.ROOT); | ||||||||||||||||||
} else { | ||||||||||||||||||
testSeed = testSeedProperty; | ||||||||||||||||||
} | ||||||||||||||||||
return testSeed; | ||||||||||||||||||
} | ||||||||||||||||||
} |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -12,9 +12,7 @@ dependencies { | |||||
javaRestTestImplementation project(':x-pack:plugin:security') | ||||||
} | ||||||
|
||||||
boolean literalUsername = buildParams.random.nextBoolean() | ||||||
|
||||||
tasks.named("javaRestTest").configure { | ||||||
usesDefaultDistribution("to be triaged") | ||||||
systemProperty 'test.literalUsername', literalUsername | ||||||
systemProperty 'test.literalUsername', buildParams.random.map{r -> r.nextBoolean()}.get() | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't eagerly resolve the random provider. Calling - systemProperty 'test.literalUsername', buildParams.random.map{ r -> r.nextBoolean() }.get()
+ systemPropertyProviders.put('test.literalUsername', buildParams.random.map { r -> Boolean.toString(r.nextBoolean()) }) 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
|
||||||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,7 @@ restResources { | |
} | ||
|
||
// randomise between sniff and proxy modes | ||
boolean proxyMode = buildParams.random.nextBoolean() | ||
var proxyModeProvider = buildParams.random.map{r -> r.nextBoolean()} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix Groovy variable declaration
-var proxyModeProvider = buildParams.random.map{r -> r.nextBoolean()}
+def proxyModeProvider = buildParams.random.map { r -> r.nextBoolean() } 🤖 Prompt for AI Agents
|
||
|
||
def fulfillingCluster = testClusters.register('fulfilling-cluster') { | ||
setting 'xpack.security.enabled', 'true' | ||
|
@@ -57,7 +57,7 @@ def queryingCluster = testClusters.register('querying-cluster') { | |
user username: "test_user", password: "x-pack-test-password" | ||
setting 'xpack.ml.enabled', 'false' | ||
setting 'cluster.remote.my_remote_cluster.skip_unavailable', 'false' | ||
if (proxyMode) { | ||
if (proxyModeProvider.get()) { | ||
setting 'cluster.remote.my_remote_cluster.mode', 'proxy' | ||
setting 'cluster.remote.my_remote_cluster.proxy_address', { | ||
"\"${fulfillingCluster.get().getAllTransportPortURI().get(0)}\"" | ||
|
@@ -79,7 +79,7 @@ tasks.register('querying-cluster', RestIntegTestTask) { | |
useCluster fulfillingCluster | ||
useCluster queryingCluster | ||
systemProperty 'tests.rest.suite', 'querying_cluster' | ||
if (proxyMode) { | ||
if (proxyModeProvider.get()) { | ||
systemProperty 'tests.rest.blacklist', [ | ||
'querying_cluster/10_basic/Add persistent remote cluster based on the preset cluster', | ||
'querying_cluster/20_info/Add persistent remote cluster based on the preset cluster and check remote info', | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -19,7 +19,7 @@ restResources { | |||||
} | ||||||
|
||||||
// randomise between sniff and proxy modes | ||||||
boolean proxyMode = buildParams.random.nextBoolean() | ||||||
var proxyModeProvider = buildParams.random.map{r -> r.nextBoolean()} | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Replace
-var proxyModeProvider = buildParams.random.map{r -> r.nextBoolean()}
+def proxyModeProvider = buildParams.random.map { r -> r.nextBoolean() } 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
|
||||||
|
||||||
def fulfillingCluster = testClusters.register('fulfilling-cluster') { | ||||||
setting 'xpack.security.enabled', 'true' | ||||||
|
@@ -43,7 +43,7 @@ def queryingCluster = testClusters.register('querying-cluster') { | |||||
setting 'cluster.remote.connections_per_cluster', "1" | ||||||
user username: "test_user", password: "x-pack-test-password" | ||||||
|
||||||
if (proxyMode) { | ||||||
if (proxyModeProvider.get()) { | ||||||
setting 'cluster.remote.my_remote_cluster.mode', 'proxy' | ||||||
setting 'cluster.remote.my_remote_cluster.proxy_address', { | ||||||
"\"${fulfillingCluster.get().getAllTransportPortURI().get(0)}\"" | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,7 @@ tasks.register("copyCerts", Sync) { | |
} | ||
|
||
// randomise between sniff and proxy modes | ||
boolean proxyMode = buildParams.random.nextBoolean() | ||
var proxyModeProvider = buildParams.random.map{r -> r.nextBoolean()} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use Groovy DSL scripts cannot declare variables with -var proxyModeProvider = buildParams.random.map{r -> r.nextBoolean()}
+def proxyModeProvider = buildParams.random.map { r -> r.nextBoolean() } 🤖 Prompt for AI Agents
|
||
|
||
def fulfillingCluster = testClusters.register('fulfilling-cluster') { | ||
setting 'xpack.security.enabled', 'true' | ||
|
@@ -66,7 +66,7 @@ def queryingCluster = testClusters.register('querying-cluster') { | |
setting 'cluster.remote.connections_per_cluster', "1" | ||
user username: "test_user", password: "x-pack-test-password" | ||
|
||
if (proxyMode) { | ||
if (proxyModeProvider.get()) { | ||
setting 'cluster.remote.my_remote_cluster.mode', 'proxy' | ||
setting 'cluster.remote.my_remote_cluster.proxy_address', { | ||
"\"${fulfillingCluster.get().getAllTransportPortURI().get(0)}\"" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Guard against empty seed lists before indexing
If neither
test
nortest2
emits theTESTSEED=[…]
line,seeds1[0]
/seeds2[0]
will throwIndexOutOfBoundsException
. Please assert the lists are non-empty before indexing, e.g.!seeds1.isEmpty()
/!seeds2.isEmpty()
.🤖 Prompt for AI Agents