File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change 44package index
55
66import (
7+ "errors"
78 "io"
89 "io/fs"
910 "log/slog"
@@ -232,6 +233,26 @@ func TestRolodexLocalFile_TestBadFS(t *testing.T) {
232233 assert .Nil (t , fileFS )
233234}
234235
236+ type openErrorDirFS struct {}
237+
238+ func (f * openErrorDirFS ) Open (name string ) (fs.File , error ) {
239+ return nil , errors .New ("open failed" )
240+ }
241+
242+ func TestRolodexLocalFS_ExtractFile_DirFSOpenError (t * testing.T ) {
243+ lfs := & LocalFS {
244+ fsConfig : & LocalFSConfig {
245+ BaseDirectory : "." ,
246+ DirFS : & openErrorDirFS {},
247+ },
248+ logger : slog .New (slog .NewTextHandler (io .Discard , nil )),
249+ }
250+
251+ f , extractErr := lfs .extractFile ("spec.yaml" )
252+ assert .Nil (t , f )
253+ assert .EqualError (t , extractErr , "open failed" )
254+ }
255+
235256func TestNewRolodexLocalFile_BadOffset (t * testing.T ) {
236257 lf := & LocalFile {offset : - 1 }
237258 z , y := io .ReadAll (lf )
You can’t perform that action at this time.
0 commit comments