Skip to content
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

Add product tests for file password authenticator plugin #1913

Closed
wants to merge 3 commits into from

Conversation

electrum
Copy link
Member

@electrum electrum commented Oct 31, 2019

This is all of #1912 plus product tests.
Only the product tests commit should be reviewed in this PR.

@cla-bot cla-bot bot added the cla-signed label Oct 31, 2019
Copy link
Member

@kokosing kokosing left a comment

Choose a reason for hiding this comment

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

Reviewed two last commits

fi
run_in_application_runner_container \
bash -c "export PRESTO_PASSWORD=$password;
/docker/volumes/conf/docker/files/presto-cli.sh --execute 'SHOW CATALOGS' | grep -iq hive"
Copy link
Member

Choose a reason for hiding this comment

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

I think PRESTO_PASSWORD should be handled inside /docker/volumes/conf/docker/files/presto-cli.sh otherwise things like ./bin/run_presto_cli_on_docker.sh are not going to work for this environment.

I would add PRESTO_PASSWORD env variable to presto-product-tests/conf/docker/fileauth/docker-compose.yml

Copy link
Member

Choose a reason for hiding this comment

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

there is no need to change presto-cli.sh

I would add PRESTO_PASSWORD env variable to presto-product-tests/conf/docker/fileauth/docker-compose.yml

this should suffice

@@ -89,6 +94,10 @@ if [[ ! -f "$DOCKER_CONF_LOCATION/$ENVIRONMENT/compose.sh" ]]; then
usage
fi

if [[ "$ENVIRONMENT" == "fileauth" ]]; then
CLI_ARGUMENTS="--server https://presto-master:8443 --user userCrypt --password --truststore-path /etc/ldap/cacerts.jks --truststore-password testldap"
Copy link
Member

Choose a reason for hiding this comment

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

define this in presto-product-tests/conf/docker/fileauth/docker-compose.yml

Copy link
Member

Choose a reason for hiding this comment

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

it's already there e61633d#diff-26231eb27080877fabe76bdf699c4e39R14

so should be enough to remove it from here

if [ -f "$fileAuthCopy" ]; then
rm -f $fileAuthCopy
fi
cp /docker/volumes/conf/presto/etc/file_auth $fileAuthCopy
Copy link
Member

Choose a reason for hiding this comment

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

I think it would be easier to use volume in presto-product-tests/conf/docker/fileauth/docker-compose.yml

Copy link
Member

Choose a reason for hiding this comment

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

can we have volume with copy-on-write semantics?
(the file is being modified in the PrestoCliFileAuthTests.testAuthTokenCacheUpdate test)

btw, do we need PrestoCliFileAuthTests.testAuthTokenCacheUpdate() as a product test? i think unit test would be sufficient for this

Copy link
Member

Choose a reason for hiding this comment

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

@electrum Shall we get rid of this test? This will also resolve the "file_auth_copy" issues.

@@ -0,0 +1,2 @@
userPBKDF2:1000:5b4240333032306164:f38d165fce8ce42f59d366139ef5d9e1ca1247f0e06e503ee1a611dd9ec40876bb5edb8409f5abe5504aab6628e70cfb3d3a18e99d70357d295002c3d0a308a0
Copy link
Member

Choose a reason for hiding this comment

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

why do we need to copy this?

Copy link
Member

Choose a reason for hiding this comment

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

ie remove the _copy from the repo

Copy link
Member

Choose a reason for hiding this comment

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

I created a copy and use it in the tests to avoid duplicate entries in case of product test failures.
For example, if the product test fails just after adding in the original file (the delete part is not executed), during the next run the add part will again add the same entries leading to duplicate entries.

@@ -0,0 +1,2 @@
userPBKDF2:1000:5b4240333032306164:f38d165fce8ce42f59d366139ef5d9e1ca1247f0e06e503ee1a611dd9ec40876bb5edb8409f5abe5504aab6628e70cfb3d3a18e99d70357d295002c3d0a308a0
userBCrypt:$2y$10$BqTb8hScP5DfcpmHo5PeyugxHz5Ky/qf3wrpD7SNm8sWuA3VlGqsa
Copy link
Member

Choose a reason for hiding this comment

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

how about having this file under presto-product-tests/conf/docker/fileauth/presto-master/etc/presto/file_auth and the using docker volume in presto-product-tests/conf/docker/fileauth/docker-compose.yml?

@@ -0,0 +1,24 @@
#
Copy link
Member

Choose a reason for hiding this comment

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

same comments like for presto-product-tests/conf/presto/etc/file_auth. See #1766

Copy link
Member

Choose a reason for hiding this comment

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

@kokosing If I follow #1766 here will it affect the existing tests?

Copy link
Member

Choose a reason for hiding this comment

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

What do you mean? In general #1766 should not affect tests, but it is more about tests infra (file locations etc)

@@ -0,0 +1,3 @@
password-authenticator.name=file
Copy link
Member

Choose a reason for hiding this comment

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

same as above

http-server.https.enabled=true
http-server.https.keystore.path=/etc/openldap/certs/coordinator.jks
http-server.https.keystore.key=testldap
http-server.authentication.type=PASSWORD
Copy link
Member

Choose a reason for hiding this comment

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

missing new line before EOF (same for other files)

@Override
public Requirement getRequirements(Configuration configuration)
{
return compose(immutableTable(NATION));
Copy link
Member

Choose a reason for hiding this comment

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

compose looks unnecessary

Copy link
Member

Choose a reason for hiding this comment

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

Yes. Need to remove this.

fi
run_in_application_runner_container \
bash -c "export PRESTO_PASSWORD=$password;
/docker/volumes/conf/docker/files/presto-cli.sh --execute 'SHOW CATALOGS' | grep -iq hive"
Copy link
Member

Choose a reason for hiding this comment

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

there is no need to change presto-cli.sh

I would add PRESTO_PASSWORD env variable to presto-product-tests/conf/docker/fileauth/docker-compose.yml

this should suffice

@@ -89,6 +94,10 @@ if [[ ! -f "$DOCKER_CONF_LOCATION/$ENVIRONMENT/compose.sh" ]]; then
usage
fi

if [[ "$ENVIRONMENT" == "fileauth" ]]; then
CLI_ARGUMENTS="--server https://presto-master:8443 --user userCrypt --password --truststore-path /etc/ldap/cacerts.jks --truststore-password testldap"
Copy link
Member

Choose a reason for hiding this comment

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

it's already there e61633d#diff-26231eb27080877fabe76bdf699c4e39R14

so should be enough to remove it from here

if [ -f "$fileAuthCopy" ]; then
rm -f $fileAuthCopy
fi
cp /docker/volumes/conf/presto/etc/file_auth $fileAuthCopy
Copy link
Member

Choose a reason for hiding this comment

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

can we have volume with copy-on-write semantics?
(the file is being modified in the PrestoCliFileAuthTests.testAuthTokenCacheUpdate test)

btw, do we need PrestoCliFileAuthTests.testAuthTokenCacheUpdate() as a product test? i think unit test would be sufficient for this

@@ -0,0 +1,2 @@
userPBKDF2:1000:5b4240333032306164:f38d165fce8ce42f59d366139ef5d9e1ca1247f0e06e503ee1a611dd9ec40876bb5edb8409f5abe5504aab6628e70cfb3d3a18e99d70357d295002c3d0a308a0
Copy link
Member

Choose a reason for hiding this comment

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

ie remove the _copy from the repo

@@ -0,0 +1,9 @@
databases:
hive:
host: hadoop-master
Copy link
Member

Choose a reason for hiding this comment

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

redundant, default

hive:
host: hadoop-master
presto:
host: presto-master
Copy link
Member

Choose a reason for hiding this comment

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

redundant, default

however, don't you need to use presto-master.docker.cluster here, like other product tests with SSL do?

host: hadoop-master
presto:
host: presto-master
configured_hdfs_user: hive
Copy link
Member

Choose a reason for hiding this comment

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

redundant, default

@findepi
Copy link
Member

findepi commented Nov 4, 2019

Which product test suite runs these tests?

@rupamk
Copy link
Member

rupamk commented Nov 9, 2019

test suite runs these tests?

presto-product-tests/bin/run_on_docker.sh fileauth -t io.prestosql.tests.cli.PrestoCliFileAuthTests

2019-10-11 06:14:14 INFO: Completed 6 tests
2019-10-11 06:14:14 INFO: 6 SUCCEEDED / 0 FAILED / 0 SKIPPED
2019-10-11 06:14:14 INFO: Tests execution took 1 minutes and 3 seconds

@findepi
Copy link
Member

findepi commented Nov 9, 2019

test suite runs these tests?

presto-product-tests/bin/run_on_docker.sh fileauth -t io.prestosql.tests.cli.PrestoCliFileAuthTests

Is fileauth env registered in any suite files? I mean the *suite-* files here: https://github.com/prestosql/presto/tree/0a031808c33c5fa0a371890410c5bad47989bce3/presto-product-tests/bin

@electrum electrum closed this Sep 25, 2020
@electrum electrum deleted the password-tests branch September 25, 2020 00:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

4 participants