-
Notifications
You must be signed in to change notification settings - Fork 25.7k
add MS Graph third party tests to periodic tests job #130380
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
Merged
richard-dennehy
merged 4 commits into
elastic:main
from
richard-dennehy:ms-graph-thirdparty-tests
Jul 7, 2025
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
33553e9
add MS Graph third party tests to periodic tests job
richard-dennehy 140c703
update periodic pipeline config
richard-dennehy c75fd21
fix inconsistent group ID env var name
richard-dennehy 0215fbc
Merge branch 'main' into ms-graph-thirdparty-tests
richard-dennehy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,6 +17,7 @@ | |
| import org.elasticsearch.common.settings.SecureString; | ||
| import org.elasticsearch.common.settings.Settings; | ||
| import org.elasticsearch.common.util.concurrent.ThreadContext; | ||
| import org.elasticsearch.core.Booleans; | ||
| import org.elasticsearch.core.PathUtils; | ||
| import org.elasticsearch.test.TestTrustStore; | ||
| import org.elasticsearch.test.XContentTestUtils; | ||
|
|
@@ -51,11 +52,12 @@ | |
|
|
||
| public class MicrosoftGraphAuthzPluginIT extends ESRestTestCase { | ||
|
|
||
| private static final String TENANT_ID = "tenant-id"; | ||
| private static final String CLIENT_ID = "client_id"; | ||
| private static final String CLIENT_SECRET = "client_secret"; | ||
| private static final String USERNAME = "Thor"; | ||
| private static final String EXPECTED_GROUP = "test_group"; | ||
| private static final String TENANT_ID = System.getProperty("test.ms_graph.tenant_id"); | ||
| private static final String CLIENT_ID = System.getProperty("test.ms_graph.client_id"); | ||
| private static final String CLIENT_SECRET = System.getProperty("test.ms_graph.client_secret"); | ||
| private static final String USERNAME = System.getProperty("test.ms_graph.username"); | ||
| private static final String EXPECTED_GROUP = System.getProperty("test.ms_graph.group_id"); | ||
| private static final Boolean USE_FIXTURE = Booleans.parseBoolean(System.getProperty("test.ms_graph.fixture")); | ||
|
|
||
| private static final List<MicrosoftGraphHttpFixture.TestUser> TEST_USERS = List.of( | ||
| new MicrosoftGraphHttpFixture.TestUser( | ||
|
|
@@ -90,12 +92,14 @@ public class MicrosoftGraphAuthzPluginIT extends ESRestTestCase { | |
| ); | ||
|
|
||
| @ClassRule | ||
| public static TestRule ruleChain = RuleChain.outerRule(graphFixture).around(trustStore).around(cluster); | ||
| public static TestRule ruleChain = USE_FIXTURE | ||
| ? RuleChain.outerRule(graphFixture).around(trustStore).around(cluster) | ||
| : RuleChain.outerRule(cluster); | ||
|
|
||
| private static final String IDP_ENTITY_ID = "http://idp.example.org/"; | ||
|
|
||
| private static ElasticsearchCluster initTestCluster() { | ||
| return ElasticsearchCluster.local() | ||
| final var clusterBuilder = ElasticsearchCluster.local() | ||
| .module("analysis-common") | ||
| .setting("xpack.security.enabled", "true") | ||
| .setting("xpack.license.self_generated.type", "trial") | ||
|
|
@@ -118,15 +122,22 @@ private static ElasticsearchCluster initTestCluster() { | |
| .setting("xpack.security.authc.realms.microsoft_graph.microsoft_graph1.client_id", CLIENT_ID) | ||
| .keystore("xpack.security.authc.realms.microsoft_graph.microsoft_graph1.client_secret", CLIENT_SECRET) | ||
| .setting("xpack.security.authc.realms.microsoft_graph.microsoft_graph1.tenant_id", TENANT_ID) | ||
| .setting("xpack.security.authc.realms.microsoft_graph.microsoft_graph1.graph_host", () -> graphFixture.getBaseUrl() + "/v1.0") | ||
| .setting("xpack.security.authc.realms.microsoft_graph.microsoft_graph1.access_token_host", graphFixture::getBaseUrl) | ||
| .setting("logger.org.elasticsearch.xpack.security.authz.microsoft", "TRACE") | ||
| .setting("logger.com.microsoft", "TRACE") | ||
| .setting("logger.com.azure", "TRACE") | ||
| .systemProperty("javax.net.ssl.trustStore", () -> trustStore.getTrustStorePath().toString()) | ||
| .systemProperty("javax.net.ssl.trustStoreType", "jks") | ||
| .systemProperty("tests.azure.credentials.disable_instance_discovery", "true") | ||
| .build(); | ||
| .setting("logger.com.azure", "TRACE"); | ||
|
|
||
| if (USE_FIXTURE) { | ||
| clusterBuilder.setting( | ||
| "xpack.security.authc.realms.microsoft_graph.microsoft_graph1.graph_host", | ||
| () -> graphFixture.getBaseUrl() + "/v1.0" | ||
| ) | ||
| .setting("xpack.security.authc.realms.microsoft_graph.microsoft_graph1.access_token_host", graphFixture::getBaseUrl) | ||
|
Comment on lines
+131
to
+134
Contributor
Author
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. these settings have the correct default values, so the third party test shouldn't override them |
||
| .systemProperty("javax.net.ssl.trustStore", () -> trustStore.getTrustStorePath().toString()) | ||
| .systemProperty("javax.net.ssl.trustStoreType", "jks") | ||
| .systemProperty("tests.azure.credentials.disable_instance_discovery", "true"); | ||
| } | ||
|
|
||
| return clusterBuilder.build(); | ||
| } | ||
|
|
||
| private static String getIDPMetadata() { | ||
|
|
@@ -210,6 +221,7 @@ public void testAuthenticationSuccessful() throws Exception { | |
| } | ||
|
|
||
| public void testConcurrentAuthentication() throws Exception { | ||
| assumeTrue("This needs the test server as the real account only has one user configured", USE_FIXTURE); | ||
| final var concurrentLogins = 3; | ||
|
|
||
| final var resultsListener = new PlainActionFuture<Collection<Map<String, Object>>>(); | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
using a similar pattern to other third party tests
elasticsearch/modules/repository-azure/build.gradle
Lines 254 to 272 in e11d89d