Skip to content

Commit

Permalink
fix nil assertions for empty map
Browse files Browse the repository at this point in the history
  • Loading branch information
drewbailey committed Jan 21, 2021
1 parent 29938df commit b1c5848
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions nomad/job_endpoint_hook_connect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -412,12 +412,12 @@ func TestJobEndpointConnect_gatewayProxyIsDefault(t *testing.T) {
func TestJobEndpointConnect_gatewayBindAddresses(t *testing.T) {
t.Run("nil", func(t *testing.T) {
result := gatewayBindAddresses(nil)
require.Nil(t, result)
require.Empty(t, result)
})

t.Run("no listeners", func(t *testing.T) {
result := gatewayBindAddresses(&structs.ConsulIngressConfigEntry{Listeners: nil})
require.Nil(t, result)
require.Empty(t, result)
})

t.Run("simple", func(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion nomad/structs/services_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ func TestConsulConnect_GatewayProxy_CopyEquals(t *testing.T) {
c := &ConsulGatewayProxy{
ConnectTimeout: helper.TimeToPtr(1 * time.Second),
EnvoyGatewayBindTaggedAddresses: false,
EnvoyGatewayBindAddresses: nil,
EnvoyGatewayBindAddresses: make(map[string]*ConsulGatewayBindAddress),
}

require.NoError(t, c.Validate())
Expand Down

0 comments on commit b1c5848

Please sign in to comment.