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

Sftp writes should truncate 154 #155

Merged
merged 7 commits into from
Jan 31, 2024
Merged

Conversation

funkyshu
Copy link
Member

No description provided.

@c2fo-cibot c2fo-cibot bot added the size/XL Denotes a PR that changes 500-999 lines label Jan 30, 2024
@@ -914,7 +861,7 @@ func (s *vfsTestSuite) File(baseLoc vfs.Location) {
// gs-specific test cases
func (s *vfsTestSuite) gsList(baseLoc vfs.Location) {
/*
test scenario:
test description:
Copy link
Member Author

Choose a reason for hiding this comment

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

Only moved contents of this file to common.go.

@funkyshu funkyshu requested a review from AnthonyRoss January 30, 2024 22:26
"github.com/c2fo/vfs/v6/vfssimple"
)

type OSWrapper struct {
Copy link
Member Author

Choose a reason for hiding this comment

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

OSWrapper implements ReadWriteSeekCloseURINamer used by this test to generically test io functionality for vfs.File implemenations. However, I needed a baseline to model the tests on so this basically provides an unix os file interface (outside of the os backend) to ensure we're following those io behaviors.

false,
"new text",
},
}
Copy link
Member Author

Choose a reason for hiding this comment

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

These tests cases use a mini-DSL to perform read/write/seek/close functions in various sequences. It was surprising how little the SFTP implementation had a to change to match the tests. Basically, only changes to a couple of flags and (making Read() and Write() use RW (vs read-only or write-only), and the conditional Truncate.

Copy link
Contributor

Choose a reason for hiding this comment

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

Nice! I like the repeatable nature of this.

Copy link
Contributor

Choose a reason for hiding this comment

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

I might be missing some context around how these get executed. Is it expected that contributors add test cases here, or do we expect contributors to run this test suite specifically? Our README doc doesn't really call out how to perform integration tests.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I actually built these tests as part of a different PR for S3 streaming (vs saving to memory) but needed to "know" how to handle various sequences first. My intent is to add each backend to the CI (with gh secrets). Locally, you can run it the same way you do with the earlier (spaghetti-like) backend integration tests.
See https://github.com/C2FO/vfs/blob/master/backend/testsuite/doc.go

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (0b59a4f) 71.60% compared to head (60c2b27) 71.66%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #155      +/-   ##
==========================================
+ Coverage   71.60%   71.66%   +0.06%     
==========================================
  Files          40       40              
  Lines        4628     4638      +10     
==========================================
+ Hits         3314     3324      +10     
  Misses       1043     1043              
  Partials      271      271              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@funkyshu funkyshu merged commit d995180 into master Jan 31, 2024
8 checks passed
@funkyshu funkyshu deleted the sftp_writes_should_truncate_154 branch January 31, 2024 00:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/XL Denotes a PR that changes 500-999 lines
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants