Skip to content

Commit

Permalink
Remove debug
Browse files Browse the repository at this point in the history
Signed-off-by: Andy Kwok <[email protected]>
  • Loading branch information
andy-k-improving committed Jan 9, 2025
1 parent 153e62a commit abb7000
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 39 deletions.
58 changes: 21 additions & 37 deletions integ-test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ ext {

getSecurityPluginDownloadLink = { ->
var repo = "https://aws.oss.sonatype.org/content/repositories/snapshots/org/opensearch/plugin/" +
"opensearch-security/$opensearch_build_snapshot/"
"opensearch-security/$opensearch_build_snapshot/"
var metadataFile = Paths.get(projectDir.toString(), "build", "maven-metadata.xml").toAbsolutePath().toFile()
download.run {
src repo + "maven-metadata.xml"
Expand All @@ -89,8 +89,6 @@ ext {
def metadata = new XmlParser().parse(metadataFile)
def GeoSnapshotVersion = metadata.versioning.snapshotVersions[0].snapshotVersion[0].value[0].text()

println("-----Downloading: " + repo + "geospatial-${GeoSnapshotVersion}.zip")

return repo + "geospatial-${GeoSnapshotVersion}.zip"
}

Expand All @@ -99,9 +97,7 @@ ext {
File downloadedGeoPlugin = Paths.get(projectAbsPath, 'bin', 'opensearch-geospatial-snapshot.zip').toFile()
configureSecurityPlugin = { OpenSearchCluster cluster ->

println("---------Stpe: configureSecurityPlugin")
cluster.getNodes().forEach { node ->
println("---------Step: Runtime node: $node")
var creds = node.getCredentials()
if (creds.isEmpty()) {
creds.add(Map.of('useradd', 'admin', '-p', 'admin'))
Expand Down Expand Up @@ -140,25 +136,25 @@ ext {
cluster.extraConfigFile file, local
}
[
// config copied from security plugin demo configuration
'plugins.security.ssl.transport.pemcert_filepath' : 'esnode.pem',
'plugins.security.ssl.transport.pemkey_filepath' : 'esnode-key.pem',
'plugins.security.ssl.transport.pemtrustedcas_filepath' : 'root-ca.pem',
'plugins.security.ssl.transport.enforce_hostname_verification' : 'false',
// https is disabled to simplify test debugging
'plugins.security.ssl.http.enabled' : 'false',
'plugins.security.ssl.http.pemcert_filepath' : 'esnode.pem',
'plugins.security.ssl.http.pemkey_filepath' : 'esnode-key.pem',
'plugins.security.ssl.http.pemtrustedcas_filepath' : 'root-ca.pem',
'plugins.security.allow_unsafe_democertificates' : 'true',

'plugins.security.allow_default_init_securityindex' : 'true',
'plugins.security.authcz.admin_dn' : 'CN=kirk,OU=client,O=client,L=test,C=de',
'plugins.security.audit.type' : 'internal_opensearch',
'plugins.security.enable_snapshot_restore_privilege' : 'true',
'plugins.security.check_snapshot_restore_write_privileges' : 'true',
'plugins.security.restapi.roles_enabled' : '["all_access", "security_rest_api_access"]',
'plugins.security.system_indices.enabled' : 'true'
// config copied from security plugin demo configuration
'plugins.security.ssl.transport.pemcert_filepath' : 'esnode.pem',
'plugins.security.ssl.transport.pemkey_filepath' : 'esnode-key.pem',
'plugins.security.ssl.transport.pemtrustedcas_filepath' : 'root-ca.pem',
'plugins.security.ssl.transport.enforce_hostname_verification' : 'false',
// https is disabled to simplify test debugging
'plugins.security.ssl.http.enabled' : 'false',
'plugins.security.ssl.http.pemcert_filepath' : 'esnode.pem',
'plugins.security.ssl.http.pemkey_filepath' : 'esnode-key.pem',
'plugins.security.ssl.http.pemtrustedcas_filepath' : 'root-ca.pem',
'plugins.security.allow_unsafe_democertificates' : 'true',

'plugins.security.allow_default_init_securityindex' : 'true',
'plugins.security.authcz.admin_dn' : 'CN=kirk,OU=client,O=client,L=test,C=de',
'plugins.security.audit.type' : 'internal_opensearch',
'plugins.security.enable_snapshot_restore_privilege' : 'true',
'plugins.security.check_snapshot_restore_write_privileges' : 'true',
'plugins.security.restapi.roles_enabled' : '["all_access", "security_rest_api_access"]',
'plugins.security.system_indices.enabled' : 'true'
].forEach { name, value ->
cluster.setting name, value
}
Expand Down Expand Up @@ -340,7 +336,7 @@ stopPrometheus.mustRunAfter startPrometheus

task integJdbcTest(type: RestIntegTestTask) {
testClusters.findAll {c -> c.clusterName == "integJdbcTest"}.first().
plugin ":opensearch-sql-plugin"
plugin ":opensearch-sql-plugin"

useJUnitPlatform()
dependsOn ':opensearch-sql-plugin:bundlePlugin'
Expand Down Expand Up @@ -445,7 +441,6 @@ task integJdbcTest(type: RestIntegTestTask) {


task integTestWithGeo(type: RestIntegTestTask) {
println("----------Starting cluster with Geo")
useCluster testClusters.integTestWithGeo
useCluster testClusters.remoteIntegTestWithGeo

Expand All @@ -466,7 +461,6 @@ task integTestWithGeo(type: RestIntegTestTask) {
testLogging {
events "passed", "skipped", "failed"
}
println("---------- After test")
afterTest { desc, result ->
logger.quiet "${desc.className}.${desc.name}: ${result.resultType} ${(result.getEndTime() - result.getStartTime())/1000}s"
}
Expand All @@ -480,23 +474,15 @@ task integTestWithGeo(type: RestIntegTestTask) {
// Tell the test JVM if the cluster JVM is running under a debugger so that tests can use longer timeouts for
// requests. The 'doFirst' delays reading the debug setting on the cluster till execution time.
doFirst {
println("---------- Do first")
systemProperty 'cluster.debug', getDebug()
getClusters().forEach { cluster ->

println("---------Runtime area: ")
String allTransportSocketURI = cluster.nodes.stream().flatMap { node ->
node.getAllTransportPortURI().stream()
}.collect(Collectors.joining(","))
String allHttpSocketURI = cluster.nodes.stream().flatMap { node ->
node.getAllHttpSocketURI().stream()
}.collect(Collectors.joining(","))
println("-----------Cluster detail: ")
println(allHttpSocketURI)
println(allTransportSocketURI)
cluster.nodes.forEach {
println(it)
}

systemProperty "tests.rest.${cluster.name}.http_hosts", "${-> allHttpSocketURI}"
systemProperty "tests.rest.${cluster.name}.transport_hosts", "${-> allTransportSocketURI}"
Expand All @@ -507,15 +493,13 @@ task integTestWithGeo(type: RestIntegTestTask) {
systemProperty "password", "admin"
}

println("----------Before debug")
if (System.getProperty("test.debug") != null) {
jvmArgs '-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:5005'
}

// NOTE: this IT config discovers only junit5 (jupiter) tests.
// https://github.com/opensearch-project/sql/issues/1974
filter {
println("----------Inside filter")
includeTestsMatching 'org.opensearch.sql.security.CrossClusterSearchIT'
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,6 @@ public void testGeoIpEnrichment() {
rows("Test user - USA", "10.1.1.1", Map.of("country", "USA", "city", "Seattle")),
rows("Test user - Canada", "127.1.1.1", Map.of("country", "Canada", "city", "Vancouver")));

// Expected: iterable with items [[Test user - USA, 10.1.1.1, x], [Test user - Canada, 127.1.1.1, x]] in any order
// but: not matched: <["Test user - USA","10.1.1.1",{"country":"USA","city":"Seattle"}]>
}


Expand Down

0 comments on commit abb7000

Please sign in to comment.