Skip to content

Commit

Permalink
test(general): Increase timeout to check for generated TLS cert (kopi…
Browse files Browse the repository at this point in the history
…a#3696)

* add debug messages

* increase wait time for tls cert

* add error messages for easier debugging

* Update tests/tools/kopiarunner/kopia_snapshotter.go

Co-authored-by: Nick <nick@kasten.io>

* add comment

---------

Co-authored-by: Nick <nick@kasten.io>
  • Loading branch information
chaitalisg and redgoat650 committed Mar 5, 2024
1 parent 44f5767 commit c07fb8b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
7 changes: 5 additions & 2 deletions tests/tools/kopiarunner/kopia_snapshotter.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const (
noCheckForUpdatesFlag = "--no-check-for-updates"
noProgressFlag = "--no-progress"
parallelFlag = "--parallel"
retryCount = 180
retryCount = 900
retryInterval = 1 * time.Second
waitingForServerString = "waiting for server to start"
serverControlPassword = "abcdef"
Expand Down Expand Up @@ -395,11 +395,14 @@ func (ks *KopiaSnapshotter) ConnectOrCreateRepoWithServer(serverAddr string, arg
var cmdErr error

if cmd, cmdErr = ks.CreateServer(serverAddr, serverArgs...); cmdErr != nil {
return nil, "", cmdErr
return nil, "", errors.Wrap(cmdErr, "CreateServer failed")
}

if err := certKeyExist(context.TODO(), tlsCertFile, tlsKeyFile); err != nil {
if buf, ok := cmd.Stderr.(*bytes.Buffer); ok {
// If the STDERR buffer does not contain any obvious error output,
// it is possible the async server creation above is taking a long time
// to open the repository, and we timed out waiting for it to write the TLS certs.
log.Print("failure in certificate generation:", buf.String())
}

Expand Down
5 changes: 3 additions & 2 deletions tests/tools/kopiarunner/kopiarun.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ package kopiarunner

import (
"bytes"
"errors"
"log"
"os"
"os/exec"
"path/filepath"
"strings"

"github.com/pkg/errors"
)

const (
Expand Down Expand Up @@ -88,7 +89,7 @@ func (kr *Runner) RunAsync(args ...string) (*exec.Cmd, error) {

err := c.Start()
if err != nil {
return nil, err
return nil, errors.Wrap(err, "Run async failed for "+kr.Exe)
}

return c, nil
Expand Down

0 comments on commit c07fb8b

Please sign in to comment.