Skip to content

Commit

Permalink
Fix nightly tests and debug (#14970)
Browse files Browse the repository at this point in the history
* adding env var

* add fixes

* fixing debug

* removing umask from tests
  • Loading branch information
akshya96 authored and Matt Schultz committed May 2, 2022
1 parent 214e893 commit 4a8bb39
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
4 changes: 2 additions & 2 deletions command/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ import (
"strconv"
"strings"
"sync"
"syscall"
"time"

"github.com/hashicorp/go-hclog"
"github.com/hashicorp/go-secure-stdlib/gatedwriter"
"github.com/hashicorp/go-secure-stdlib/strutil"
"github.com/hashicorp/vault/api"
"github.com/hashicorp/vault/helper/osutil"
"github.com/hashicorp/vault/sdk/helper/jsonutil"
"github.com/hashicorp/vault/sdk/helper/logging"
"github.com/hashicorp/vault/sdk/version"
Expand Down Expand Up @@ -963,7 +963,7 @@ func (c *DebugCommand) persistCollection(collection []map[string]interface{}, ou

func (c *DebugCommand) compress(dst string) error {
if runtime.GOOS != "windows" {
defer syscall.Umask(syscall.Umask(0o077))
defer osutil.Umask(osutil.Umask(0o077))
}

tgz := archiver.NewTarGz()
Expand Down
3 changes: 2 additions & 1 deletion command/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"testing"
"time"

"github.com/hashicorp/vault/sdk/helper/consts"
"github.com/hashicorp/vault/sdk/physical"
physInmem "github.com/hashicorp/vault/sdk/physical/inmem"
"github.com/mitchellh/cli"
Expand Down Expand Up @@ -115,7 +116,7 @@ func TestServer_ReloadListener(t *testing.T) {
defer os.RemoveAll(td)

wg := &sync.WaitGroup{}

os.Setenv(consts.VaultDisableFilePermissionsCheckEnv, "true")
// Setup initial certs
inBytes, _ := ioutil.ReadFile(wd + "reload_foo.pem")
ioutil.WriteFile(td+"/reload_cert.pem", inBytes, 0o777)
Expand Down
5 changes: 5 additions & 0 deletions helper/osutil/fileinfo_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,8 @@ func FileUidMatch(info fs.FileInfo, path string, uid int) (err error) {
}
return err
}

// Sets new umask and returns old umask
func Umask(newmask int) int {
return syscall.Umask(newmask)
}
5 changes: 5 additions & 0 deletions helper/osutil/fileinfo_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,8 @@ import (
func FileUidMatch(info fs.FileInfo, path string, uid int) error {
return nil
}

// Umask does nothing for windows for now
func Umask(newmask int) int {
return 0
}

0 comments on commit 4a8bb39

Please sign in to comment.