-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor shared/testutil/spectest.go (#8800)
* Refactor shared/testutil/spectest * update operations * update epoch_processing * rename spectest.go
- Loading branch information
Showing
37 changed files
with
312 additions
and
266 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package testutil | ||
|
||
import ( | ||
"io/ioutil" | ||
"path" | ||
|
||
"github.com/bazelbuild/rules_go/go/tools/bazel" | ||
) | ||
|
||
// BazelDirectoryNonEmpty returns true if directory exists and is not empty. | ||
func BazelDirectoryNonEmpty(filePath string) (bool, error) { | ||
p, err := bazel.Runfile(filePath) | ||
if err != nil { | ||
return false, err | ||
} | ||
fs, err := ioutil.ReadDir(p) | ||
if err != nil { | ||
return false, err | ||
} | ||
return len(fs) > 0, nil | ||
} | ||
|
||
// BazelFileBytes returns the byte array of the bazel file path given. | ||
func BazelFileBytes(filePaths ...string) ([]byte, error) { | ||
filepath, err := bazel.Runfile(path.Join(filePaths...)) | ||
if err != nil { | ||
return nil, err | ||
} | ||
fileBytes, err := ioutil.ReadFile(filepath) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return fileBytes, nil | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.