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

Stop failing acceptance tests if their directories already exist #1588

Merged
merged 2 commits into from
Jan 14, 2021

Conversation

teor2345
Copy link
Contributor

Motivation

After PR #1560, the cached sapling tests started failing, because the acceptance test utility functions were too strict about existing directories.

Solution

Fixes:

  • ignore existing directories
  • consistently create missing config and state directories as needed
  • only ignore NotFound errors when deleting the previous config in replace_config

Cleanup:

  • refactor the common config writing code into a separate function

The code in this pull request has:

  • Documentation Comments
  • Passes Existing Unit Tests
  • We won't know if the cached sapling tests pass until we merge this PR

Review

@dconnolly knows the most about this code, so she should review it eventually.

This bug is causing failures on main, so it's pretty urgent, I hope @yaahc can do a quick review.

Related Issues

Makes it harder to test sync issues like #1586

Also:
  * consistently create missing config and state directories
  * refactor the common config writing code into a separate function
  * only ignore NotFound errors in replace_config
@teor2345 teor2345 added C-bug Category: This is a bug A-rust Area: Updates to Rust code A-infrastructure Area: Infrastructure changes C-cleanup Category: This is a cleanup labels Jan 14, 2021
@teor2345 teor2345 added this to the 2021 Sprint 1 milestone Jan 14, 2021
@teor2345 teor2345 requested review from dconnolly and yaahc January 14, 2021 00:56
@teor2345 teor2345 self-assigned this Jan 14, 2021
@dconnolly
Copy link
Contributor

Duplicated this branch into the zebra base repo and manually triggered the Test workflow on it: https://github.com/ZcashFoundation/zebra/actions/runs/484232685

yaahc
yaahc previously approved these changes Jan 14, 2021
@teor2345
Copy link
Contributor Author

teor2345 commented Jan 14, 2021

Duplicated this branch into the zebra base repo and manually triggered the Test workflow on it: https://github.com/ZcashFoundation/zebra/actions/runs/484232685

Oops, this new code doesn't work, because it overwrites the configured state directory, adding a "state" directory to the provided path.

I'll go rewrite the utility functions so we have a "just write the config and don't mess with it" function.

@teor2345
Copy link
Contributor Author

We also had a testnet failure, that's not surprising, we'll fix that by deploying more testnet nodes.

... and use it in the cached sapling acceptance tests.

Enforce config immutability using the type system.
@@ -784,7 +826,7 @@ fn create_cached_database_height(network: Network, height: Height) -> Result<()>

let dir = PathBuf::from("/zebrad-cache");
let mut child = dir
.with_config(config)?
.with_exact_config(&config)?
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dconnolly @yaahc this is the actual fix, all the rest is refactoring and type system enforcement

.write_config_helper(config)
}

fn with_exact_config(self, config: &ZebradConfig) -> Result<Self> {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the new utility function, all the rest is refactoring and type system enforcement

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh and better documentation

@teor2345
Copy link
Contributor Author

@dconnolly can you do another manual run?

@teor2345
Copy link
Contributor Author

teor2345 commented Jan 14, 2021

Hmm yeah looks like testnet is a bit sad right now

Jan 14 13:25:43.604 WARN {zebrad="92d95d4b" net="Test"}:sync: zebrad::components::sync: error downloading and verifying block e=Elapsed(())

@dconnolly
Copy link
Contributor

@teor2345 teor2345 merged commit 8a7b023 into ZcashFoundation:main Jan 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-infrastructure Area: Infrastructure changes A-rust Area: Updates to Rust code C-bug Category: This is a bug C-cleanup Category: This is a cleanup
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants