Skip to content

Commit

Permalink
chore: add some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
IronCore864 committed Sep 10, 2024
1 parent a45bee7 commit e0bb83b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
. "github.com/canonical/pebble/tests"
)

// TestMain does extra setup before executing tests.
func TestMain(m *testing.M) {
goBuild := exec.Command("go", "build", "-o", "../pebble", "../cmd/pebble")
if err := goBuild.Run(); err != nil {
Expand Down
3 changes: 3 additions & 0 deletions tests/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
"time"
)

// CreateLayer creates a layer file in the Pebble dir using the name and content given.
func CreateLayer(t *testing.T, pebbleDir string, layerFileName string, layerYAML string) {
t.Helper()

Expand All @@ -44,6 +45,7 @@ func CreateLayer(t *testing.T, pebbleDir string, layerFileName string, layerYAML
}
}

// PebbleRun runs the Pebble daemon and returns a channel for logs.
func PebbleRun(t *testing.T, pebbleDir string) <-chan string {
t.Helper()

Expand Down Expand Up @@ -82,6 +84,7 @@ func PebbleRun(t *testing.T, pebbleDir string) <-chan string {
return logsCh
}

// WaitForLogs reads from the channel (returned by PebbleRun) and checks if all expected logs are found within specified timeout duration.
func WaitForLogs(logsCh <-chan string, expectedLogs []string, timeout time.Duration) error {
receivedLogs := make(map[string]struct{})
start := time.Now()
Expand Down

0 comments on commit e0bb83b

Please sign in to comment.