Fix broken api test for service Meta (logical conflict rom OSS). Add test that would make this much easier to catch in future.
This commit is contained in:
parent
bd5eb8b749
commit
73f2a49ef1
|
@ -175,6 +175,7 @@ func (s *HTTPServer) AgentServices(resp http.ResponseWriter, req *http.Request)
|
||||||
ID: s.ID,
|
ID: s.ID,
|
||||||
Service: s.Service,
|
Service: s.Service,
|
||||||
Tags: s.Tags,
|
Tags: s.Tags,
|
||||||
|
Meta: s.Meta,
|
||||||
Port: s.Port,
|
Port: s.Port,
|
||||||
Address: s.Address,
|
Address: s.Address,
|
||||||
EnableTagOverride: s.EnableTagOverride,
|
EnableTagOverride: s.EnableTagOverride,
|
||||||
|
|
|
@ -56,7 +56,10 @@ func TestAgent_Services(t *testing.T) {
|
||||||
ID: "mysql",
|
ID: "mysql",
|
||||||
Service: "mysql",
|
Service: "mysql",
|
||||||
Tags: []string{"master"},
|
Tags: []string{"master"},
|
||||||
Port: 5000,
|
Meta: map[string]string{
|
||||||
|
"foo": "bar",
|
||||||
|
},
|
||||||
|
Port: 5000,
|
||||||
}
|
}
|
||||||
require.NoError(t, a.State.AddService(srv1, ""))
|
require.NoError(t, a.State.AddService(srv1, ""))
|
||||||
|
|
||||||
|
@ -81,6 +84,7 @@ func TestAgent_Services(t *testing.T) {
|
||||||
val := obj.(map[string]*api.AgentService)
|
val := obj.(map[string]*api.AgentService)
|
||||||
assert.Lenf(t, val, 1, "bad services: %v", obj)
|
assert.Lenf(t, val, 1, "bad services: %v", obj)
|
||||||
assert.Equal(t, 5000, val["mysql"].Port)
|
assert.Equal(t, 5000, val["mysql"].Port)
|
||||||
|
assert.Equal(t, srv1.Meta, val["mysql"].Meta)
|
||||||
assert.NotNil(t, val["mysql"].Connect)
|
assert.NotNil(t, val["mysql"].Connect)
|
||||||
assert.NotNil(t, val["mysql"].Connect.Proxy)
|
assert.NotNil(t, val["mysql"].Connect.Proxy)
|
||||||
assert.Equal(t, prxy1.ExecMode.String(), string(val["mysql"].Connect.Proxy.ExecMode))
|
assert.Equal(t, prxy1.ExecMode.String(), string(val["mysql"].Connect.Proxy.ExecMode))
|
||||||
|
|
Loading…
Reference in New Issue