Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions cli/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,16 @@ func TestServer(t *testing.T) {
go func() {
errCh <- inv.WithContext(ctx).Run()
}()
pty.ExpectMatch("Using an ephemeral deployment directory")
matchCh1 := make(chan string, 1)
go func() {
matchCh1 <- pty.ExpectMatchContext(ctx, "Using an ephemeral deployment directory")
}()
select {
case err := <-errCh:
require.NoError(t, err)
case <-matchCh1:
// OK!
}
Comment on lines +211 to +213
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you have the matched string here, why not move the assertions from L214-220 in here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to keep modifications to the existing test to a minimum.

rootDirLine := pty.ReadLine(ctx)
rootDir := strings.TrimPrefix(rootDirLine, "Using an ephemeral deployment directory")
rootDir = strings.TrimSpace(rootDir)
Expand All @@ -210,7 +219,17 @@ func TestServer(t *testing.T) {
require.NotEmpty(t, rootDir)
require.DirExists(t, rootDir)

pty.ExpectMatchContext(ctx, "View the Web UI")
matchCh2 := make(chan string, 1)
go func() {
// The "View the Web UI" log is a decent indicator that the server was successfully started.
matchCh2 <- pty.ExpectMatchContext(ctx, "View the Web UI")
}()
select {
case err := <-errCh:
require.NoError(t, err)
case <-matchCh2:
// OK!
}

cancelFunc()
<-errCh
Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy