refactor(consulcatalog): enhance tests.
This commit is contained in:
parent
1fe6a8b04d
commit
06d528a2bd
1 changed files with 16 additions and 13 deletions
|
@ -350,10 +350,11 @@ func TestCatalogProviderGetIntAttribute(t *testing.T) {
|
||||||
expected int
|
expected int
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
desc: "should return default value when empty name",
|
desc: "should return default value when empty name",
|
||||||
name: "",
|
name: "",
|
||||||
tags: []string{"traefik.foo=10"},
|
tags: []string{"traefik.foo=10"},
|
||||||
expected: 0,
|
defaultValue: 666,
|
||||||
|
expected: 666,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
desc: "should return default value when empty tags",
|
desc: "should return default value when empty tags",
|
||||||
|
@ -400,10 +401,11 @@ func TestCatalogProviderGetInt64Attribute(t *testing.T) {
|
||||||
expected int64
|
expected int64
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
desc: "should return default value when empty name",
|
desc: "should return default value when empty name",
|
||||||
name: "",
|
name: "",
|
||||||
tags: []string{"traefik.foo=10"},
|
tags: []string{"traefik.foo=10"},
|
||||||
expected: 0,
|
defaultValue: 666,
|
||||||
|
expected: 666,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
desc: "should return default value when empty tags",
|
desc: "should return default value when empty tags",
|
||||||
|
@ -450,10 +452,11 @@ func TestCatalogProviderGetBoolAttribute(t *testing.T) {
|
||||||
expected bool
|
expected bool
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
desc: "should return default value when empty name",
|
desc: "should return default value when empty name",
|
||||||
name: "",
|
name: "",
|
||||||
tags: []string{"traefik.foo=10"},
|
tags: []string{"traefik.foo=true"},
|
||||||
expected: false,
|
defaultValue: true,
|
||||||
|
expected: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
desc: "should return default value when empty tags",
|
desc: "should return default value when empty tags",
|
||||||
|
@ -992,7 +995,7 @@ func TestCatalogProviderGetHealthCheck(t *testing.T) {
|
||||||
t.Run(test.desc, func(t *testing.T) {
|
t.Run(test.desc, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
result := p.getHeathCheck(test.tags)
|
result := p.getHealthCheck(test.tags)
|
||||||
|
|
||||||
assert.Equal(t, test.expected, result)
|
assert.Equal(t, test.expected, result)
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue