Skip to content

Commit

Permalink
backport of commit 3f63499
Browse files Browse the repository at this point in the history
  • Loading branch information
tgross committed Aug 24, 2022
1 parent ee5401c commit 70f71fd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
8 changes: 7 additions & 1 deletion nomad/structs/config/vault.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,15 @@ func (c *VaultConfig) Equals(b *VaultConfig) bool {
if c.TLSKeyFile != b.TLSKeyFile {
return false
}
if c.TLSSkipVerify != b.TLSSkipVerify {

if c.TLSSkipVerify == nil || b.TLSSkipVerify == nil {
if c.TLSSkipVerify != b.TLSSkipVerify {
return false
}
} else if *c.TLSSkipVerify != *b.TLSSkipVerify {
return false
}

if c.TLSServerName != b.TLSServerName {
return false
}
Expand Down
9 changes: 3 additions & 6 deletions nomad/structs/config/vault_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ import (
"testing"
"time"

"github.com/stretchr/testify/require"

"github.com/hashicorp/nomad/ci"
"github.com/hashicorp/nomad/helper/pointer"
"github.com/shoenig/test/must"
)

func TestVaultConfig_Merge(t *testing.T) {
Expand Down Expand Up @@ -102,8 +101,7 @@ func TestVaultConfig_Equals(t *testing.T) {
TLSServerName: "1",
}

// TODO: must.Equals(t, c, c2) should work here?
require.True(t, c.Equals(c2))
must.Equals(t, c1, c2)

c3 := &VaultConfig{
Enabled: pointer.Of(true),
Expand Down Expand Up @@ -139,6 +137,5 @@ func TestVaultConfig_Equals(t *testing.T) {
TLSServerName: "1",
}

// TODO: must.NotEquals(t, c3, c4) should work here?
require.False(t, c3.Equals(c4))
must.NotEquals(t, c3, c4)
}

0 comments on commit 70f71fd

Please sign in to comment.