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

Make regression tests use default authentication #804

Merged
merged 4 commits into from
Jan 25, 2025

Conversation

adutra
Copy link
Contributor

@adutra adutra commented Jan 16, 2025

... and align realm names to use POLARIS consistently.

Using default authenticators with real JWT tokens, the regression tests are better aligned with a production-like setup.

@adutra adutra force-pushed the regtests-default-auth branch from 0ae2b98 to 266e9b3 Compare January 24, 2025 10:06
@adutra adutra changed the title [WIP] Make regression tests use default authentication Make regression tests use default authentication Jan 24, 2025
@adutra adutra marked this pull request as ready for review January 24, 2025 10:08
@adutra
Copy link
Contributor Author

adutra commented Jan 24, 2025

@MonkeyCanCode @flyrain @HonahX with this PR we should get regression tests running with production-like profile. This should supersede #866 and fix #865. Let me know what you think.

@adutra adutra force-pushed the regtests-default-auth branch from 266e9b3 to f83ec9a Compare January 24, 2025 11:08
Copy link
Contributor

@HonahX HonahX left a comment

Choose a reason for hiding this comment

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

@adutra Thanks for updating these!

@@ -55,7 +55,7 @@ if [ -z "${SPARK_HOME}"]; then
export SPARK_HOME=$(realpath ~/${SPARK_DISTRIBUTION})
fi

SPARK_BEARER_TOKEN="${REGTEST_ROOT_BEARER_TOKEN:-principal:root;realm:default-realm}"
SPARK_BEARER_TOKEN="${REGTEST_ROOT_BEARER_TOKEN:-principal:root;realm:POLARIS}"
Copy link
Contributor

Choose a reason for hiding this comment

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

Since the authenticator is default now, do we still need this token default value, principal:root;realm:POLARIS. Seems we will need to run the added script in run.sh to get a token using root credential first before running run_spark_sql.sh.

Additionally, is run_spark_sql.sh expected to work without first running run.sh? If so, may be we should consider adding code to get a token within this script to make it work out-of-box.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

do we still need this token default value

Indeed I thought about removing the default values everywhere, but I wasn't sure whether all these scripts are always executed from the run.sh entrypoint. Do you think we should remove the default values?

may be we should consider adding code to get a token within this script to make it work out-of-box.

Good catch! The script is definitely meant to be executed individually. I will add support for default auth in that script as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will add support for default auth in that script as well.

Done, let me know what you think!

Copy link
Contributor

@HonahX HonahX Jan 24, 2025

Choose a reason for hiding this comment

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

Done, let me know what you think!

Thanks for adding that! Look great!

but I wasn't sure whether all these scripts are always executed from the run.sh entrypoint. Do you think we should remove the default values?

My understanding is that the default values will always fail since default authenticator reject principal:root:realm:* token anyway. We will need to either execute run.sh to store a real token in env or adding the default auth like run_spark_sql.sh to make scripts able to be executed without run.sh.

Keeping default values there will have no affect on tests but I feel it will cause additional work if we want to change realm name for regression test in the future. WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think I agree. Should I remove the default values in this PR or as a follow-up?

Copy link
Contributor

Choose a reason for hiding this comment

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

I am ok with either way. As you pointed out in #865 (comment), we will need some follow-up PRs to clean-up/fix things so I think that could also be a good place to remove these values

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, I took note to open a follow-up PR for that 👍

polaris.realm-context.realms: default-realm,realm1
quarkus.log.file.enable: false
POLARIS_BOOTSTRAP_CREDENTIALS: POLARIS,root,secret
quarkus.log.file.enable: "false"
Copy link
Contributor

Choose a reason for hiding this comment

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

This can also help simplify the docker-compose.yml in getting-started examples: e.g. #868

I am happy to update that PR if this one goes in first : )

Copy link
Contributor

@HonahX HonahX left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for updating these

README.md Outdated Show resolved Hide resolved
@@ -24,7 +24,7 @@ if [ -z "$AWS_CROSS_REGION_TEST_ENABLED" ] || [ "$AWS_CROSS_REGION_TEST_ENABLED"
exit 0
fi

SPARK_BEARER_TOKEN="${REGTEST_ROOT_BEARER_TOKEN:-principal:root;realm:realm1}"
SPARK_BEARER_TOKEN="${REGTEST_ROOT_BEARER_TOKEN:-principal:root;realm:POLARIS}"
Copy link
Contributor

@flyrain flyrain Jan 24, 2025

Choose a reason for hiding this comment

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

Do we need to keep -principal:root;realm:POLARIS as token will be fetched by run.sh? Given the direction that we want to to is to use the default authenticator always for reggresstion test, I think we should remove them to avoid confusion, as principal:root;realm:POLARIS doesn't work for default athenticator.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

With @HonahX we decided to postpone that, but I think you are right: leaving this default value will create confusion. So I went ahead and removed them.

README.md Outdated
@@ -62,11 +62,8 @@ Apache Polaris is built using Gradle with Java 21+ and Docker 27+.
- `./gradlew assemble` - To skip tests.
- `./gradlew test` - To run unit tests and integration tests.
- `./gradlew polarisServerRun` - To run the Polaris server locally, with profile `prod`; the server
Copy link
Contributor

@flyrain flyrain Jan 24, 2025

Choose a reason for hiding this comment

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

I'm not familiar with Quarkus conventions, but "with profile prod" seems a bit odd to me, it is no way close to a prod deployment. Is "with the default profile" more accurate? Or we don't even have to mention it in that case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right. Rephrased.

@flyrain
Copy link
Contributor

flyrain commented Jan 24, 2025

I think we should also remove this line,

The Polaris catalog setup script uses the credential `principal:root;realm:default-realm`. This credential is used so users do not need to fetch credentials from Apache Polaris' console output.
, as we changed the way it works. cc @HonahX

@flyrain flyrain mentioned this pull request Jan 24, 2025
@adutra adutra force-pushed the regtests-default-auth branch from a8a1c40 to f71b14f Compare January 25, 2025 10:52
@adutra
Copy link
Contributor Author

adutra commented Jan 25, 2025

Rebased (to get the tox removal commit) and addressed feedback.

I am now able to run the regression tests both locally and with docker-compose. I am also able to run ./regtests/run_spark_sql.sh and play interactively with a running Polaris server.

Copy link
Contributor

@flyrain flyrain left a comment

Choose a reason for hiding this comment

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

+1

@flyrain flyrain merged commit db3b3b8 into apache:main Jan 25, 2025
5 checks passed
@flyrain
Copy link
Contributor

flyrain commented Jan 25, 2025

Thanks a lot for the fix @adutra ! Thanks for the review @HonahX!

HonahX added a commit to HonahX/polaris that referenced this pull request Jan 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants