From 73f2a49ef18b0955479692133b71d88d1761268c Mon Sep 17 00:00:00 2001 From: Paul Banks Date: Sat, 12 May 2018 11:27:44 +0100 Subject: [PATCH] Fix broken api test for service Meta (logical conflict rom OSS). Add test that would make this much easier to catch in future. --- agent/agent_endpoint.go | 1 + agent/agent_endpoint_test.go | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/agent/agent_endpoint.go b/agent/agent_endpoint.go index 6a5126fa2..0342d1fd4 100644 --- a/agent/agent_endpoint.go +++ b/agent/agent_endpoint.go @@ -175,6 +175,7 @@ func (s *HTTPServer) AgentServices(resp http.ResponseWriter, req *http.Request) ID: s.ID, Service: s.Service, Tags: s.Tags, + Meta: s.Meta, Port: s.Port, Address: s.Address, EnableTagOverride: s.EnableTagOverride, diff --git a/agent/agent_endpoint_test.go b/agent/agent_endpoint_test.go index ac2d28d00..9c10a61ff 100644 --- a/agent/agent_endpoint_test.go +++ b/agent/agent_endpoint_test.go @@ -56,7 +56,10 @@ func TestAgent_Services(t *testing.T) { ID: "mysql", Service: "mysql", Tags: []string{"master"}, - Port: 5000, + Meta: map[string]string{ + "foo": "bar", + }, + Port: 5000, } require.NoError(t, a.State.AddService(srv1, "")) @@ -81,6 +84,7 @@ func TestAgent_Services(t *testing.T) { val := obj.(map[string]*api.AgentService) assert.Lenf(t, val, 1, "bad services: %v", obj) 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.Proxy) assert.Equal(t, prxy1.ExecMode.String(), string(val["mysql"].Connect.Proxy.ExecMode))