Skip to content

Conversation

@kfaraz
Copy link
Contributor

@kfaraz kfaraz commented Aug 4, 2025

Main changes

  • Move ITSecurityBasicQuery to BasicAuthMsqTest
  • Add new test BasicAuthIndexingTest which extends IndexTaskTest
  • Add EmbeddedServiceClient to allow creation of a custom client that can talk to various services in an embedded cluster

Other changes

  • Refactor SecurityClient to work with EmbeddedServiceClient
  • Simplify CompactionResourceTestClient to work with EmbeddedServiceClient
  • Bind annotated ServiceClient instances for Coordinator, Overlord and Broker in ServiceClientModule
  • Replace usages of CoordinatorServiceClient with @Coordinator ServiceClient
  • Add resource MsqExportDirectory

This PR has:

  • been self-reviewed.
  • added documentation for new or modified features or behaviors.
  • a release note entry in the PR description.
  • added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
  • added or updated version, license, or notice information in licenses.yaml
  • added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
  • added unit tests or modified existing tests to cover new code paths, ensuring the threshold for code coverage is met.
  • added integration tests.
  • been tested in a test Druid cluster.

@kfaraz kfaraz requested a review from gianm August 4, 2025 07:39
Comment on lines 188 to +191
);
return Objects.requireNonNull(latestSnapshots).getLatestStatus().get(0);
}
catch (Exception e) {

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note test

Invoking
CompactionResourceTestClient.updateCompactionTaskSlot
should be avoided because it has been deprecated.
@cryptoe cryptoe requested a review from capistrant August 5, 2025 04:26
import java.util.function.Function;

/**
* Client to call various basic auth APIs on the Coordinator.
Copy link
Contributor

@uds5501 uds5501 Aug 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dummy suggestion to trigger CI:

Suggested change
* Client to call various basic auth APIs on the Coordinator.
* Client to call various basic auth APIs on the Coordinator for sure.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand this suggestion.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, sorry for the confusion.

I was exploring the idea of trying out an alt account to bypass my GHA issue.
This is a dummy suggestion that I had requested @uds5501 to leave so that we could commit it and hopefully trigger CI. But that didn't work as only committers can commit from the GitHub console.

// Time in ms to sleep after updating role permissions in each test. This intends to give the
// underlying test cluster enough time to sync permissions and be ready when test execution starts.
private static final int SYNC_SLEEP = 10000;
private static final int SYNC_SLEEP = 500;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see the sleep is shorter now, but could it be made unnecessary? 500ms also seems dangerously short for a sleep that is actually required for some reason. It's short enough that some random slowness on the test runner will cause a test to flake.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair point, let me check if there is any metric that we can watch.

String task = createTaskString();
StatusResponseHolder statusResponseHolder = overlordResourceTestClient.submitTaskAndReturnStatusWithAuth(task, USER_1, USER_1_PASSWORD);
Assert.assertEquals(HttpResponseStatus.FORBIDDEN, statusResponseHolder.getStatus());
private Task createExportTask(String taskId)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The direct creation of the controller task is super verbose and a little brittle: this isn't meant to be a reliable Java API and using it creates coupling between this test and the main code.

How about going through SQL instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think the test using this method is unnecessary itself.
There are already tests for verifying the SQL /v2/task endpoint with auth in this class.
And for testing out the taskPost API on OverlordResource, we have BasicAuthIndexingTest.

Should we just remove this altogether?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, you can remove it then. I don't think submitting a controller task adds meaningful testing if the /druid/v2/sql/task endpoint is already being tested. It will submit a task under the hood. And users aren't meant to be submitting controller tasks manually anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, thanks!

import java.util.function.Function;

/**
* Client to call various basic auth APIs on the Coordinator.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand this suggestion.

@kfaraz
Copy link
Contributor Author

kfaraz commented Aug 7, 2025

@gianm, thanks for the review. I have updated the PR based on your feedback.

@Akshat-Jain Akshat-Jain closed this Aug 7, 2025
@Akshat-Jain Akshat-Jain reopened this Aug 7, 2025
@Akshat-Jain Akshat-Jain closed this Aug 7, 2025
@Akshat-Jain Akshat-Jain reopened this Aug 7, 2025
@kfaraz kfaraz merged commit b8417a5 into apache:master Aug 7, 2025
73 checks passed
@kfaraz kfaraz deleted the add_embedded_auth_its branch August 7, 2025 13:13
@cecemei cecemei added this to the 35.0.0 milestone Oct 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants