Skip to content

Commit

Permalink
Make server tests more robust
Browse files Browse the repository at this point in the history
  • Loading branch information
bep committed May 5, 2023
1 parent f2b74d0 commit a5566b9
Show file tree
Hide file tree
Showing 5 changed files with 263 additions and 281 deletions.
12 changes: 11 additions & 1 deletion commandsnew/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package commandsnew
import (
"bytes"
"context"
"encoding/json"
"errors"
"fmt"
"io"
Expand Down Expand Up @@ -1448,10 +1449,19 @@ func (c *serverCommand) serve() error {
// Write a .ready file to disk to signal ready status.
// This is where the test is run from.
fmt.Println("=======> READY <========")
testInfo := map[string]any{
"baseURLs": srv.baseURLs,
}

dir := os.Getenv("WORK")
if dir != "" {
readyFile := filepath.Join(dir, ".ready")
err := ioutil.WriteFile(readyFile, []byte("ready"), 0777)
// encode the test info as JSON into the .ready file.
b, err := json.Marshal(testInfo)
if err != nil {
return err
}
err = ioutil.WriteFile(readyFile, b, 0777)
if err != nil {
return err
}
Expand Down
Loading

0 comments on commit a5566b9

Please sign in to comment.