-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Update migration sharness tests for new migrations #8053
Conversation
test/sharness/t0066-migration.sh
Outdated
test_expect_code 1 ipfs daemon > daemon_out 2> daemon_err | ||
test_expect_code 1 bash -c "echo n | ipfs daemon > daemon_out 2> daemon_err" |
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.
Why has this part of the test changed? Isn't the prompt for auto-migration code still the same?
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.
The prompt is the same, but needed to echo n
to answer the prompt so that it would not just hang. Needed the bash -c ...
to handle the pipe in the command.
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.
After retesting, I do not know why this change seemed necessary. Changed back to original.
@@ -10,16 +10,27 @@ test_description="Test migrations auto update prompt" | |||
|
|||
test_init_ipfs | |||
|
|||
# Create fake migration binaries instead of letting ipfs download from network | |||
# To test downloading and running actual binaries, comment out this test. |
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.
We weren't testing real binaries here before, right? So this is just a heads up for developers/testers.
Not that it's strictly necessary (as it can cause CI flakiness, slow downs, etc.), but do we happen to already have any integration tests that handle the end-to-end workflow here?
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.
Correct, before we were also testing a fake migration binary (mocked fs-repo-migrations). No that we do not have one fs-repo-migration, but have separate migration executables, I make fake versions of those now.
The actual migrations are tested in fs-repo-migrations sharness tests. This part tests that the go-ipfs will actually run the migrations.
The part that is missing from a complete end-to-end test is testing go-ipfs downloading migrations from the network.
test/sharness/t0066-migration.sh
Outdated
' | ||
|
||
# Daemon exits with 1 after the prompt gets "n" when asking to migrate. |
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.
It's not getting "n" anymore, just waiting right?
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.
yes. attention to detail, thank you. Test description is sufficient, no comment needed.
test/sharness/t0066-migration.sh
Outdated
test_expect_success "ipfs daemon --migrate=true runs migration" ' | ||
test_expect_code 1 ipfs daemon --migrate=true > true_out | ||
test_expect_code 1 ipfs daemon --migrate=true > true_out 2>&1 |
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.
What is this change doing for us?
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.
That was needed because PR #8054 was not merged yet. Some of the output was now going to stderr that was expected to go to stdout. That made a subsequent test, that scanned true_out
fail, but for the wrong reasons.
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.
If I rebase on top of #8054, then that change can go away.
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.
Sounds good, let's rebase now that the bug is fixed and keep it as is. Then it looks like we're ready to merge 😄
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.
Done. All tests passing.
With the new migrations, go-ipfs no longer uses fs-repo-migrations to do repo migrations, and was downloading real migration binaries from the network and running them. This caused failure, but was not caught because the test was expecting `ipfs daemon --migrate` to fail for other reasons. This PR fixes the migration tests by creating the appropriate fake migration binaries in the PATH so that those get run and avoid downloading the real ones. This also fixes a test that was previously marked broken.
4f9e574
to
66db9a1
Compare
With the new migrations, go-ipfs no longer uses
fs-repo-migrations
to do repo migrations, and was downloading real migration binaries from the network and running them. This caused failure, but was not caught because the test was expectingipfs daemon --migrate
to fail for other reasons.This PR fixes the migration tests by creating the appropriate fake migration binaries in the
PATH
so that those are run instead of downloading the real ones. This also fixes a test that was previously marked broken.