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

Update migration sharness tests for new migrations #8053

Merged
merged 5 commits into from
Apr 15, 2021

Conversation

gammazero
Copy link
Contributor

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 are run instead of downloading the real ones. This also fixes a test that was previously marked broken.

Comment on lines 43 to 62
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"
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.
Copy link
Contributor

@aschmahmann aschmahmann Apr 14, 2021

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?

Copy link
Contributor Author

@gammazero gammazero Apr 14, 2021

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.

'

# Daemon exits with 1 after the prompt gets "n" when asking to migrate.
Copy link
Contributor

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?

Copy link
Contributor Author

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_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
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

Copy link
Contributor

@aschmahmann aschmahmann Apr 15, 2021

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 😄

Copy link
Contributor Author

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.
@gammazero gammazero force-pushed the fix/migration-sharness-tests branch from 4f9e574 to 66db9a1 Compare April 15, 2021 15:35
@aschmahmann aschmahmann merged commit 0ae9b2b into master Apr 15, 2021
@aschmahmann aschmahmann deleted the fix/migration-sharness-tests branch April 15, 2021 18:47
@aschmahmann aschmahmann mentioned this pull request May 14, 2021
71 tasks
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.

2 participants