-
Notifications
You must be signed in to change notification settings - Fork 179
add-go-fuse-to-inject-filesystem-error #583
base: master
Are you sure you want to change the base?
add-go-fuse-to-inject-filesystem-error #583
Conversation
that looks really cool, can you try to implement one full test. |
Thanks for your accept, can you give some advice about a rename relation test case? |
9d9c978
to
c1334fe
Compare
the most simple one I can think of is something like:
|
c1334fe
to
a19b6c9
Compare
do you think this will also allow injecting an error on |
I have added two test cases in compact_test.go files, please help to check it. |
Of course, almost filesystem's error can be injected by this way and do not change any real code. |
Signed-off-by: qiffang <[email protected]>
Signed-off-by: qiffang <[email protected]>
Signed-off-by: qiffang <[email protected]>
Signed-off-by: qiffang <[email protected]>
791d089
to
2472c78
Compare
Signed-off-by: qiffang <[email protected]>
b882862
to
ec0a5e0
Compare
Signed-off-by: qiffang <[email protected]>
Signed-off-by: qiffang <[email protected]>
…ub.com/qiffang/tsdb into add-go-fuse-to-inject-filesystem-error
Signed-off-by: qiffang <[email protected]>
would you mind fixing the travis tests. Looks like some dependency issues so should be an easy fix. |
Signed-off-by: qiffang <[email protected]>
…ub.com/qiffang/tsdb into add-go-fuse-to-inject-filesystem-error
…ub.com/qiffang/tsdb into add-go-fuse-to-inject-filesystem-error Signed-off-by: qiffang <[email protected]>
…ub.com/qiffang/tsdb into add-go-fuse-to-inject-filesystem-error
I have uploaded go.mod(Previously, i do not known tsdb do this check)
In my environment, it works well |
I guess you need to check with the travis team for the proper way to use fuse with travis. They might have some support IRC channel or maybe open an issue on github. |
Fuse is a pretty big requirement for a unittest, that's not going to be runnable in many places. |
Thanks for your response, I plan to use it for injecting various file system error in testcases. |
before suggesting it as a solution I did check and some travis posts suggest that it should be supported in travis, but of course if there is any other alternative happy to use something easyer. @simonpasquier @SuperQ maybe you can give some ideas? |
This case fail for now, so i have to wait #636? |
Signed-off-by: qiffang <[email protected]>
Signed-off-by: qiffang <[email protected]>
yes |
Got it and do you have any suggestions for this pull request? |
Signed-off-by: qiffang <[email protected]>
testutil/fuse/fuse.go
Outdated
func (s *Server) forceMount() (err error) { | ||
delay := time.Duration(0) | ||
for try := 0; try < 5; try++ { | ||
err = syscall.Unmount(s.mountpoint, flag) |
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.
There is no problem to call unmountFlag() few times. This is no requirement for high performance here and I think the compiler would be smart enough to translate this into a single call.
#636 is merged so you can merge it here to pass the test. |
@krasi-georgiev , I do not think golang compiler can translate this into a single call. As you said, it is no requirement for high performance here and i will remove the flag variables. |
Signed-off-by: qiffang <[email protected]>
Signed-off-by: qiffang <[email protected]>
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.
LGTM with these last few nits.
Signed-off-by: qiffang <[email protected]>
@codesome , @bwplotka this is ready for your review. long story short is that many bugs are caused by some file system errors and with this PR we will be able to write tests that inject fs errors and ensure that tsdb database state is left in a recoverable state. Since this uses fuse the tests are optional and meant to run mainly on the CI and targeting linux. it already caught a bug which I fixed in: #636 Next good test would be to ensure that tsdb recovers nicely when running out of space . like the bug I fixed in #582 |
Signed-off-by: qiffang <[email protected]>
@qiffang while waiting for a review do you want to write a test for #582. Something like -
|
Hi @krasi-georgiev , I think it is better to do it in a separate PR. |
@qiffang failing tests. @bwplotka , @codesome , @gouthamve would you mind having a look at this PR. |
Signed-off-by: qiffang <[email protected]>
@@ -316,7 +318,7 @@ func TestFailedDelete(t *testing.T) { | |||
testutil.Ok(t, server.Close()) | |||
}() | |||
|
|||
expHash, err := testutil.DirHash(original) | |||
expHash, err := dirHash(original) |
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 not use testutil.DirHash
?
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.
ping @qiffang
BackGround
Base the issue - Tests with injected file system errors. #579
We can use go-fuse to inject file system, but it is too complex for the user.
In this pull request, I provide a HOOKFS way.
Function
You can implement Hookxxx interface to implement your purposes(For now, only provide HookOnRename interface, if you think it is ok, i will implement other hooks, for example HookOnOpenDir and so on)
Then Inject hook implement to HookServer
Example
QA
Add test CreateBlock logic and OpenBlock logic with new way
After all test cases gone, please call "fusermount -u $mountpoint"
There is a complete example in hook_test.go file.
If you think this way is ok, I will implement more hooks.
Thanks