Skip to content

Commit efcd71b

Browse files
committed
Allow chaining of FileSystem methods
1 parent 2e1be45 commit efcd71b

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

pkg/integration/components/file_system.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,25 @@ type FileSystem struct {
1010
}
1111

1212
// This does _not_ check the files panel, it actually checks the filesystem
13-
func (self *FileSystem) PathPresent(path string) {
13+
func (self *FileSystem) PathPresent(path string) *FileSystem {
1414
self.assertWithRetries(func() (bool, string) {
1515
_, err := os.Stat(path)
1616
return err == nil, fmt.Sprintf("Expected path '%s' to exist, but it does not", path)
1717
})
18+
return self
1819
}
1920

2021
// This does _not_ check the files panel, it actually checks the filesystem
21-
func (self *FileSystem) PathNotPresent(path string) {
22+
func (self *FileSystem) PathNotPresent(path string) *FileSystem {
2223
self.assertWithRetries(func() (bool, string) {
2324
_, err := os.Stat(path)
2425
return os.IsNotExist(err), fmt.Sprintf("Expected path '%s' to not exist, but it does", path)
2526
})
27+
return self
2628
}
2729

2830
// Asserts that the file at the given path has the given content
29-
func (self *FileSystem) FileContent(path string, matcher *TextMatcher) {
31+
func (self *FileSystem) FileContent(path string, matcher *TextMatcher) *FileSystem {
3032
self.assertWithRetries(func() (bool, string) {
3133
_, err := os.Stat(path)
3234
if os.IsNotExist(err) {
@@ -46,4 +48,5 @@ func (self *FileSystem) FileContent(path string, matcher *TextMatcher) {
4648

4749
return true, ""
4850
})
51+
return self
4952
}

0 commit comments

Comments
 (0)