From abb700097ff9bcccda1da7370be0f0c5807ebdfa Mon Sep 17 00:00:00 2001 From: Andy Kwok Date: Thu, 9 Jan 2025 10:58:55 -0800 Subject: [PATCH] Remove debug Signed-off-by: Andy Kwok --- integ-test/build.gradle | 58 +++++++------------ .../sql/security/CrossClusterSearchIT.java | 2 - 2 files changed, 21 insertions(+), 39 deletions(-) diff --git a/integ-test/build.gradle b/integ-test/build.gradle index 97c25571e2..f174b8b727 100644 --- a/integ-test/build.gradle +++ b/integ-test/build.gradle @@ -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" @@ -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" } @@ -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')) @@ -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 } @@ -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' @@ -445,7 +441,6 @@ task integJdbcTest(type: RestIntegTestTask) { task integTestWithGeo(type: RestIntegTestTask) { - println("----------Starting cluster with Geo") useCluster testClusters.integTestWithGeo useCluster testClusters.remoteIntegTestWithGeo @@ -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" } @@ -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}" @@ -507,7 +493,6 @@ 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' } @@ -515,7 +500,6 @@ task integTestWithGeo(type: RestIntegTestTask) { // 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' } } diff --git a/integ-test/src/test/java/org/opensearch/sql/security/CrossClusterSearchIT.java b/integ-test/src/test/java/org/opensearch/sql/security/CrossClusterSearchIT.java index fd604939c5..4ea826272c 100644 --- a/integ-test/src/test/java/org/opensearch/sql/security/CrossClusterSearchIT.java +++ b/integ-test/src/test/java/org/opensearch/sql/security/CrossClusterSearchIT.java @@ -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"}]> }