-
Notifications
You must be signed in to change notification settings - Fork 25.8k
Migrate more security tests to new framework #139871
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
Migrate more security tests to new framework #139871
Conversation
…nternal-java-rest-test plugin
…internal-java-rest-test plugin
|
Pinging @elastic/es-security (Team:Security) |
…rnal-java-rest-test plugin
| } | ||
| } else { | ||
| apply plugin: 'elasticsearch.internal-java-rest-test' | ||
| if (project.parent.name != 'security') { |
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.
All non-security subprojects now use elasticsearch.internal-java-rest-test instead of conditionally using legacy-java-rest-test for security subprojects.
| testImplementation project(':x-pack:plugin:core') | ||
| testImplementation(testArtifact(project(xpackModule('core')))) | ||
| testImplementation project(":test:framework") | ||
| testImplementation project(':test:test-clusters') |
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.
The security parent project's test classes directly import test-clusters types. Without this dependency, compiling src/test/java fails with:
error: package org.elasticsearch.test.cluster does not exist
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.
This change replaces byte-offset file-based tracking with line-count tracking that uses the test cluster API.
This approach is used elsewhere. See x-pack/plugin/security/qa/audit/src/javaRestTest/java/org/elasticsearch/xpack/security/audit/AuditIT.java.
- Update x-pack/qa/security-setup-password-tests to use internal-java-rest-test plugin - Update x-pack/qa/security-example-spi-extension to use internal-java-rest-test plugin - Update x-pack/plugin/sql/qa/server/security to use internal-java-rest-test plugin
Summary of tests targeted:
CustomRealmIT
x-pack/qa/security-example-spi-extensionlegacy-java-rest-test→internal-java-rest-testAbstractPasswordToolTestCase
x-pack/qa/security-setup-password-testslegacy-java-rest-test→internal-java-rest-testSqlSecurityTestCase
x-pack/plugin/sql/qa/server/securitylegacy-java-rest-test→internal-java-rest-testgetCluster().getNodeLog(0, LogType.AUDIT)used elsewhereSqlSecurityTestCasearchitecture diagram with relevant changes:graph TB subgraph gradle [Gradle Build Files] parentBuild[server/build.gradle] securityBuild[security/build.gradle] withSslBuild[with-ssl/build.gradle] withoutSslBuild[without-ssl/build.gradle] end subgraph java [Java Test Classes] clusterConfig[SqlSecurityTestCluster] testCase[SqlSecurityTestCase] testClasses[16 *IT.java classes] end subgraph framework [Test Clusters Framework] elasticsearchCluster[ElasticsearchCluster] logType[LogType.AUDIT] resource[Resource.fromClasspath] end parentBuild -->|applies internal-java-rest-test| securityBuild securityBuild -->|testImplementation| framework withSslBuild -->|tests.ssl.enabled not set| clusterConfig withoutSslBuild -->|tests.ssl.enabled=false| clusterConfig clusterConfig -->|creates| elasticsearchCluster clusterConfig -->|loads roles.yml| resource testCase -->|uses| clusterConfig testCase -->|reads audit via| logType testClasses -->|extend| testCase