-
Notifications
You must be signed in to change notification settings - Fork 366
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
Fix export test esti job #7635
Merged
Merged
Fix export test esti job #7635
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,24 +2,31 @@ | |
|
||
REPOSITORY=${REPOSITORY:-example} | ||
|
||
|
||
run_cmd_and_validate() { | ||
echo $1 | ||
echo "Running: $2" | ||
newVariable=$(eval $2) | ||
if [[ $? != "0" ]] | ||
then | ||
echo "FAILED!" && exit 1 | ||
fi | ||
echo "Output:" | ||
echo $newVariable | ||
} | ||
Comment on lines
+6
to
+16
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Like 😎 |
||
|
||
# Run Export without previous commit | ||
echo "Current working directory: ${WORKING_DIRECTORY}" | ||
echo "upload file_one" | ||
docker compose exec -T lakefs lakectl fs upload lakefs://${REPOSITORY}/main/a/file_one.txt --source /local/file_one.txt | ||
echo "res $?" | ||
run_cmd_and_validate "upload file_one" "docker compose exec -T lakefs lakectl fs upload lakefs://${REPOSITORY}/main/a/file_one.txt --source /local/file_one.txt" | ||
|
||
echo "export no previous commit" | ||
docker compose --project-directory ${WORKING_DIRECTORY} run --rm lakefs-export ${REPOSITORY} ${EXPORT_LOCATION} --branch="main" | ||
echo "res $?" | ||
run_cmd_and_validate "export no previous commit" "docker compose --project-directory ${WORKING_DIRECTORY} run --rm lakefs-export ${REPOSITORY} ${EXPORT_LOCATION} --branch=main" | ||
|
||
# Validate export | ||
lakectl_out=$(mktemp) | ||
s3_out=$(mktemp) | ||
trap 'rm -f -- $s3_out $lakectl_out' INT TERM EXIT | ||
|
||
echo "ls" | ||
docker compose exec -T lakefs lakectl fs ls --recursive --no-color lakefs://${REPOSITORY}/main/ | awk '{print $8}' | sort > ${lakectl_out} | ||
echo "res $?" | ||
|
||
n=$(grep -o "/" <<< ${EXPORT_LOCATION} | wc -l) | ||
|
||
|
@@ -30,37 +37,28 @@ else | |
n=$((n-1)) | ||
fi | ||
|
||
echo "aws ls" | ||
aws s3 ls --recursive ${EXPORT_LOCATION} | awk '{print $4}'| cut -d/ -f ${n}- | grep -v EXPORT_ | sort > ${s3_out} | ||
echo "res $?" | ||
|
||
echo $(cat $lakectl_out) | ||
echo $(cat $s3_out) | ||
|
||
if ! diff ${lakectl_out} ${s3_out}; then | ||
echo "export location and lakefs should contain same objects" | ||
exit 1 | ||
fi | ||
|
||
# Run Export with previous commit - add file and also delete an existing file | ||
echo "export previous commit" | ||
docker compose exec -T lakefs lakectl fs upload lakefs://${REPOSITORY}/main/a/file_two.txt --source /local/file_two.txt | ||
echo "res $?" | ||
docker compose exec -T lakefs lakectl fs rm lakefs://${REPOSITORY}/main/a/file_one.txt | ||
echo "res $?" | ||
docker compose exec -T lakefs lakectl commit lakefs://${REPOSITORY}/main --message="removed file_one and added file_two" | ||
echo "res $?" | ||
|
||
docker compose --project-directory ${WORKING_DIRECTORY} run --rm lakefs-export ${REPOSITORY} ${EXPORT_LOCATION} --branch="main" --prev_commit_id="some_commit" | ||
echo "res $?" | ||
run_cmd_and_validate "upload file_two" "docker compose exec -T lakefs lakectl fs upload lakefs://${REPOSITORY}/main/a/file_two.txt --source /local/file_two.txt" | ||
run_cmd_and_validate "delete file_one" "docker compose exec -T lakefs lakectl fs rm lakefs://${REPOSITORY}/main/a/file_one.txt" | ||
run_cmd_and_validate "commit changes" "docker compose exec -T lakefs lakectl commit lakefs://${REPOSITORY}/main --message='removed file_one and added file_two'" | ||
run_cmd_and_validate "export previous commit" "docker compose --project-directory ${WORKING_DIRECTORY} run --rm lakefs-export ${REPOSITORY} ${EXPORT_LOCATION} --branch=main --prev_commit_id='some_commit'" | ||
|
||
# Validate sync | ||
lakectl_out=$(mktemp) | ||
s3_out=$(mktemp) | ||
trap 'rm -f -- $s3_out $lakectl_out' INT TERM EXIT | ||
|
||
echo "ls" | ||
docker compose exec -T lakefs lakectl fs ls --recursive --no-color lakefs://${REPOSITORY}/main/ | awk '{print $8}' | sort > ${lakectl_out} | ||
echo "res $?" | ||
|
||
echo "aws ls" | ||
aws s3 ls --recursive ${EXPORT_LOCATION} | awk '{print $4}'| cut -d/ -f ${n}- | grep -v EXPORT_ | sort > ${s3_out} | ||
|
||
if ! diff ${lakectl_out} ${s3_out}; then | ||
|
@@ -69,13 +67,13 @@ if ! diff ${lakectl_out} ${s3_out}; then | |
fi | ||
|
||
# Run Export with commit_id reference | ||
echo "export with commit_id" | ||
docker compose exec -T lakefs lakectl fs upload lakefs://${REPOSITORY}/main/a/file_three.txt --source /local/file_three.txt | ||
echo "res $?" | ||
run_cmd_and_validate "upload file_three" "docker compose exec -T lakefs lakectl fs upload lakefs://${REPOSITORY}/main/a/file_three.txt --source /local/file_three.txt" | ||
|
||
commit_id=$(docker compose exec -T lakefs lakectl commit lakefs://${REPOSITORY}/main --message="added file_three" | sed -n 4p | awk '{print $2}') | ||
|
||
docker compose --project-directory ${WORKING_DIRECTORY} run --rm lakefs-export ${REPOSITORY} ${EXPORT_LOCATION} --commit_id="$commit_id" | ||
echo "res $?" | ||
# We should not validate the exit code - since it is erroneous | ||
echo "run export" | ||
docker compose --project-directory ${WORKING_DIRECTORY} run --rm lakefs-export ${REPOSITORY} ${EXPORT_LOCATION} --commit_id=$commit_id | ||
|
||
echo "commit_id $commit_id" | ||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not blocking on this, sharing my thoughts though:
This solves the problem, and because we run it in later steps it works to overcome the dependencies, but we regarding the docker-compose file it's wrong to remove these dependencies.
Did we try using project names?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand the concern, however: