Skip to content

Commit

Permalink
Adding test (thanks @DylanGuedes!)
Browse files Browse the repository at this point in the history
Signed-off-by: Danny Kopping <danny.kopping@grafana.com>
  • Loading branch information
Danny Kopping committed Oct 29, 2021
1 parent 5b2684b commit 1c38089
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions pkg/loki/config_wrapper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -993,3 +993,25 @@ query_scheduler:
assert.Equal(t, config.Ingester.LifecyclerConfig.InfNames, []string{"eth0", "en0", defaultIface})
})
}

func TestLoopbackAppendingToFrontendV2(t *testing.T) {
defaultIface, err := loki_net.LoopbackInterfaceName()
assert.NoError(t, err)
assert.NotEmpty(t, defaultIface)

t.Run("by default, loopback should be in FrontendV2 interface names", func(t *testing.T) {
config, _, err := configWrapperFromYAML(t, minimalConfig, []string{})
assert.NoError(t, err)
assert.Equal(t, []string{"eth0", "en0", defaultIface}, config.Frontend.FrontendV2.InfNames)
})

t.Run("loopback shouldn't be in FrontendV2 interface names if set by user", func(t *testing.T) {
yamlContent := `frontend:
instance_interface_names:
- otheriface`

config, _, err := configWrapperFromYAML(t, yamlContent, []string{})
assert.NoError(t, err)
assert.Equal(t, []string{"otheriface"}, config.Frontend.FrontendV2.InfNames)
})
}

0 comments on commit 1c38089

Please sign in to comment.