Skip to content

Commit

Permalink
test: handle zero values in shared config
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Cragun <me@ryan.ec>
  • Loading branch information
ryancragun committed Jan 27, 2025
1 parent 8b28afd commit 571176c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 23 deletions.
35 changes: 16 additions & 19 deletions command/server/config_test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,29 +56,26 @@ func testConfigRaftRetryJoin(t *testing.T) {
retryJoinJSON, err := json.Marshal(retryJoinExpected)
require.NoError(t, err)

expected := &Config{
SharedConfig: &configutil.SharedConfig{
Listeners: []*configutil.Listener{
{
Type: "tcp",
Address: "127.0.0.1:8200",
CustomResponseHeaders: DefaultCustomHeaders,
},
},
DisableMlock: true,
expected := NewConfig()
expected.SharedConfig.Listeners = []*configutil.Listener{
{
Type: "tcp",
Address: "127.0.0.1:8200",
CustomResponseHeaders: DefaultCustomHeaders,
},

Storage: &Storage{
Type: "raft",
Config: map[string]string{
"path": "/storage/path/raft",
"node_id": "raft1",
"retry_join": string(retryJoinJSON),
},
}
expected.SharedConfig.DisableMlock = true
expected.Storage = &Storage{
Type: "raft",
Config: map[string]string{
"path": "/storage/path/raft",
"node_id": "raft1",
"retry_join": string(retryJoinJSON),
},
}
config.Prune()
require.EqualValues(t, expected, config)
require.EqualValues(t, expected.SharedConfig, config.SharedConfig)
require.EqualValues(t, expected.Storage, config.Storage)
})
}
}
Expand Down
7 changes: 3 additions & 4 deletions vault/identity_store_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,16 @@ import (
memdb "github.com/hashicorp/go-memdb"
"github.com/hashicorp/go-secure-stdlib/strutil"
uuid "github.com/hashicorp/go-uuid"
"github.com/stretchr/testify/require"
"google.golang.org/protobuf/types/known/anypb"
"google.golang.org/protobuf/types/known/timestamppb"

"github.com/hashicorp/vault/helper/activationflags"
"github.com/hashicorp/vault/helper/identity"
"github.com/hashicorp/vault/helper/identity/mfa"
"github.com/hashicorp/vault/helper/namespace"
"github.com/hashicorp/vault/helper/storagepacker"
"github.com/hashicorp/vault/sdk/helper/consts"
"github.com/hashicorp/vault/sdk/logical"
"github.com/stretchr/testify/require"
"google.golang.org/protobuf/types/known/anypb"
"google.golang.org/protobuf/types/known/timestamppb"
)

var (
Expand Down

0 comments on commit 571176c

Please sign in to comment.