This repository was archived by the owner on Jan 22, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Fix AppendVec test breakage... #7693
Merged
Merged
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 hidden or 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 |
|---|---|---|
|
|
@@ -567,6 +567,7 @@ pub mod tests { | |
| let file = get_append_vec_path("test_append_vec_set_file_bad_size"); | ||
| let path = &file.path; | ||
| let mut av = AppendVec::new_empty_map(0); | ||
| assert_eq!(av.accounts(0).len(), 0); | ||
|
|
||
| let _data = OpenOptions::new() | ||
| .read(true) | ||
|
|
@@ -680,18 +681,6 @@ pub mod tests { | |
| ); | ||
| } | ||
|
|
||
| #[test] | ||
| fn test_set_file_empty_data() { | ||
|
Contributor
Author
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. |
||
| let file = get_append_vec_path("test_set_file_empty_data"); | ||
| let path = &file.path; | ||
| let mut av = AppendVec::new(&path, true, 1024 * 1024); | ||
|
|
||
| assert_eq!(av.accounts(0).len(), 0); | ||
|
|
||
| let result = av.set_file(path); | ||
| assert_matches!(result, Ok(_)); | ||
| } | ||
|
|
||
| #[test] | ||
| fn test_set_file_crafted_data_len() { | ||
| let file = get_append_vec_path("test_set_file_crafted_data_len"); | ||
|
|
@@ -713,6 +702,7 @@ pub mod tests { | |
| assert_eq!(account.meta.data_len, crafted_data_len); | ||
|
|
||
| av.flush().unwrap(); | ||
| av.file_size = 0; | ||
| let result = av.set_file(path); | ||
| assert_matches!(result, Err(ref message) if message.to_string() == *"incorrect layout/length"); | ||
| } | ||
|
|
@@ -736,6 +726,7 @@ pub mod tests { | |
| assert_matches!(accounts.first(), None); | ||
|
|
||
| av.flush().unwrap(); | ||
| av.file_size = 0; | ||
| let result = av.set_file(path); | ||
| assert_matches!(result, Err(ref message) if message.to_string() == *"incorrect layout/length"); | ||
| } | ||
|
|
@@ -788,6 +779,7 @@ pub mod tests { | |
| } | ||
|
|
||
| av.flush().unwrap(); | ||
| av.file_size = 0; | ||
| let result = av.set_file(path); | ||
| assert_matches!(result, Err(ref message) if message.to_string() == *"incorrect layout/length"); | ||
| } | ||
|
|
||
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.
Carry over only this assertion from now unified test: https://github.com/solana-labs/solana/pull/7693/files#diff-657d1e7648a9fb74cb1582a9c48beb4bR566