Skip to content

Ldap integration tests#10901

Merged
jon-wei merged 8 commits intoapache:masterfrom
zachjsh:ldap_integration_tests
Feb 23, 2021
Merged

Ldap integration tests#10901
jon-wei merged 8 commits intoapache:masterfrom
zachjsh:ldap_integration_tests

Conversation

@zachjsh
Copy link
Contributor

@zachjsh zachjsh commented Feb 19, 2021

Description

Added integration tests for testing the druid-basic-security extension in ldap mode. Modeled heavily after the existing ITBasicAuthConfigurationTest. Added new test group ldap-security as we need specific common druid properties to be set in order configure druid to use ldap auth z/n

  • Running the osixia/docker-openldap docker image as an ldap server for the tests
  • users and groups are preloaded into the ldap server, as defined in bootstrap.ldif
  • refactored common functionality between ITBasicAuthConfigurationTest and ITBasicAuthLdapConfigurationTest into base class AbstractAuthConfigurationTest

- ./environment-configs/router-custom-check-tls

druid-openldap:
image: osixia/openldap:1.4.0
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This uses MIT license. Do we need to add this to any license file or anything like that?

Copy link
Member

Choose a reason for hiding this comment

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

Since this is only pulled while running the integration tests, I think it can be omitted, since it won't actually ever be included in a source/binary/docker distribution, which is what the license and notice files cover.

-- See the License for the specific language governing permissions and
-- limitations under the License.

INSERT INTO druid_tasks (id, created_date, datasource, payload, status_payload, active) VALUES ('index_auth_test_2030-04-30T01:13:31.893Z', '2030-04-30T01:13:31.893Z', 'auth_test', '{\"id\":\"index_auth_test_2030-04-30T01:13:31.893Z\",\"created_date\":\"2030-04-30T01:13:31.893Z\",\"datasource\":\"auth_test\",\"active\":0}', '{\"id\":\"index_auth_test_2030-04-30T01:13:31.893Z\",\"status\":\"SUCCESS\",\"duration\":1}', 0);
Copy link
Contributor Author

@zachjsh zachjsh Feb 19, 2021

Choose a reason for hiding this comment

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

This is same as security-sample-data.sql . There is a script file that is expecting a file with name {GROUP}-sample-data.sql. maybe can change logic specifically for security or ldap-security group tests to just look for the security-sample-data.sql instead?

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, I checked the test-data dir and it looks like the 3 files below (out of 5) are identical:
high-availability-sample-data.sql
query-retry-sample-data.sql
query-sample-data.sql

I'm not sure at this point how likely it is for these sample data sets to diverge in the future, but it seems like it might be reasonable to change the structure in a way such that the individual groups can specify directly what sample data they need preloaded (and those 3 files, and the security files, could be shared).

That said, I don't think it's a huge deal if we introduce another copy now.

Copy link
Contributor Author

@zachjsh zachjsh Feb 23, 2021

Choose a reason for hiding this comment

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

Left as is. Think fixing this otherwise would require a lot of code churn. If we're going to fix this, I think it should be in another pr.

}

@Test
public void testSystemSchemaAccess() throws Exception
Copy link
Contributor

Choose a reason for hiding this comment

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

This test seems to be doing many things. Can we break it up into smaller tests?

Copy link
Contributor

Choose a reason for hiding this comment

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

Similar comment for other examples in this test. It seems like each time the logger is used, that could be a separate test

Copy link
Contributor Author

Choose a reason for hiding this comment

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

broke up a lot of the tests.

-- See the License for the specific language governing permissions and
-- limitations under the License.

INSERT INTO druid_tasks (id, created_date, datasource, payload, status_payload, active) VALUES ('index_auth_test_2030-04-30T01:13:31.893Z', '2030-04-30T01:13:31.893Z', 'auth_test', '{\"id\":\"index_auth_test_2030-04-30T01:13:31.893Z\",\"created_date\":\"2030-04-30T01:13:31.893Z\",\"datasource\":\"auth_test\",\"active\":0}', '{\"id\":\"index_auth_test_2030-04-30T01:13:31.893Z\",\"status\":\"SUCCESS\",\"duration\":1}', 0);
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, I checked the test-data dir and it looks like the 3 files below (out of 5) are identical:
high-availability-sample-data.sql
query-retry-sample-data.sql
query-sample-data.sql

I'm not sure at this point how likely it is for these sample data sets to diverge in the future, but it seems like it might be reasonable to change the structure in a way such that the individual groups can specify directly what sample data they need preloaded (and those 3 files, and the security files, could be shared).

That said, I don't think it's a huge deal if we introduce another copy now.

objectClass: inetOrgPerson
loginShell: /bin/bash
homeDirectory: /home/admin
uidNumber: 14583100
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add some comments to the file on how the uid/gid values here were determined? Could they ever change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh I think I just took it from some example I found. I think the can be whatever. To make this simpler let me just start from 1 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.

fixed.

{
};

private static final String SYSTEM_SCHEMA_SEGMENTS_RESULTS_RESOURCE =
Copy link
Contributor

Choose a reason for hiding this comment

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

These look identical to the ones in the abstract base class

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed.

{
private static final Logger LOG = new Logger(ITBasicAuthLdapConfigurationTest.class);

private static final String LDAP_AUTHENTICATOR = "ldap";
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you could avoid some test redundancy if you added methods like getAuthenticatorName, getAuthorizerName, getExpectedAvaticaAuthError and had the basic/ldap tests provide implementations for those that returned these strings

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good point.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed.

@jon-wei jon-wei merged commit 553f5c8 into apache:master Feb 23, 2021
@zachjsh zachjsh deleted the ldap_integration_tests branch February 24, 2021 06:41
@clintropolis clintropolis added this to the 0.22.0 milestone Aug 12, 2021
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.

4 participants