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 export-dir, source and target databases dynamic to enable parallel runs #2019

Merged
merged 26 commits into from
Jan 9, 2025

Conversation

shubham-yb
Copy link
Contributor

@shubham-yb shubham-yb commented Dec 1, 2024

  • Added a dynamically named export dir for each test
  • Added the provision to create a different source db for each Oracle test

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@shubham-yb shubham-yb marked this pull request as ready for review December 9, 2024 03:57
@shubham-yb shubham-yb requested review from sanyamsinghal, priyanshi-yb and makalaaneesh and removed request for priyanshi-yb December 31, 2024 10:33
if [[ "${SOURCE_DB_TYPE}" == "postgresql" || "${SOURCE_DB_TYPE}" == "mysql" ]]; then
export SOURCE_DB_NAME=${SOURCE_DB_NAME:-"${NORMALIZED_TEST_NAME}_fallb"}
elif [[ "${SOURCE_DB_TYPE}" == "oracle" ]]; then
export SOURCE_DB_SCHEMA=${SOURCE_DB_SCHEMA:-"${NORMALIZED_TEST_NAME:0:10}_fallb"} && export SOURCE_DB_SCHEMA=${SOURCE_DB_SCHEMA^^}
Copy link
Collaborator

Choose a reason for hiding this comment

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

why :0:10 ? pls add a comment.
what is ^^?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Using ^^ to make the schema uppercase

@@ -18,7 +18,7 @@ export REPO_ROOT="${PWD}"
export SCRIPTS="${REPO_ROOT}/migtests/scripts"
export TESTS_DIR="${REPO_ROOT}/migtests/tests"
export TEST_DIR="${TESTS_DIR}/${TEST_NAME}"
export EXPORT_DIR=${EXPORT_DIR:-"${TEST_DIR}/export-dir"}
export NORMALIZED_TEST_NAME="$(echo "$TEST_NAME" | tr '/-' '_')"
Copy link
Collaborator

Choose a reason for hiding this comment

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

where do we get TEST_NAME from to begin with?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

TEST_NAME is passed during the test invocation.
The general pattern is TEST_SCRIPT TEST_NAME
example: run_test.sh pg/datatypes

@@ -37,6 +37,20 @@ else
source ${SCRIPTS}/${SOURCE_DB_TYPE}/env.sh
fi

export EXPORT_DIR=${EXPORT_DIR:-"${TEST_DIR}/${NORMALIZED_TEST_NAME}_live_export-dir"}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks like this code is the same for all tests?
if so, can we write this logic in functions.sh? (for determining exportDir, setting SOURCE_DB_NAME, etc.

@shubham-yb
Copy link
Contributor Author

Copy link
Collaborator

@makalaaneesh makalaaneesh left a comment

Choose a reason for hiding this comment

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

LGTM! pls remove the commented code before merging.

migtests/scripts/functions.sh Show resolved Hide resolved
oracle)
# Limit schema name to 10 characters for Oracle/Debezium due to 30 character limit
export SOURCE_DB_SCHEMA=${SOURCE_DB_SCHEMA:-"${NORMALIZED_TEST_NAME:0:10}_${test_suffix}"}
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: you can do the truncate 0:10 also above when generating NORMALIZED_TEST_NAME.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Keeping it specific to Oracle for now. The longer export-dir name brought out some issues. It'll be good to have that test case.

@shubham-yb shubham-yb merged commit 95cc498 into main Jan 9, 2025
66 of 67 checks passed
@shubham-yb shubham-yb deleted the shubham/unique-export-dir branch January 9, 2025 09:55
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