From dffcc8bac6dff6054771b714db7edee17f565e33 Mon Sep 17 00:00:00 2001 From: Diptanu Choudhury Date: Mon, 14 Dec 2015 08:54:34 -0800 Subject: [PATCH 1/4] Changing the prefix of the service id --- nomad/structs/structs.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nomad/structs/structs.go b/nomad/structs/structs.go index 84a171e67..265c0713a 100644 --- a/nomad/structs/structs.go +++ b/nomad/structs/structs.go @@ -1146,7 +1146,7 @@ func (sc *ServiceCheck) Hash(serviceId string) string { } const ( - NomadConsulPrefix = "nomad" + NomadConsulPrefix = "1729nomad" ) // The Service model represents a Consul service defintion From 68b1dd032edac922258985ef2532c94a7dbfbbed Mon Sep 17 00:00:00 2001 From: Diptanu Choudhury Date: Mon, 14 Dec 2015 11:14:22 -0800 Subject: [PATCH 2/4] Changing the prefix of the service --- client/consul_test.go | 12 ++++++------ nomad/structs/structs.go | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/client/consul_test.go b/client/consul_test.go index e7bb8012e..f2fb18ef8 100644 --- a/client/consul_test.go +++ b/client/consul_test.go @@ -290,8 +290,8 @@ func TestConsul_FilterNomadServicesAndChecks(t *testing.T) { Port: 8080, Address: "10.10.1.11", }, - "nomad-2121212": { - ID: "nomad-2121212", + "nomad-registered-service-2121212": { + ID: "nomad-registered-service-2121212", Service: "identity-service", Tags: []string{"global"}, Port: 8080, @@ -300,8 +300,8 @@ func TestConsul_FilterNomadServicesAndChecks(t *testing.T) { } expSrvcs := map[string]*consul.AgentService{ - "nomad-2121212": { - ID: "nomad-2121212", + "nomad-registered-service-2121212": { + ID: "nomad-registered-service-2121212", Service: "identity-service", Tags: []string{"global"}, Port: 8080, @@ -327,7 +327,7 @@ func TestConsul_FilterNomadServicesAndChecks(t *testing.T) { }, "212121212": { CheckID: "212121212", - ServiceID: "nomad-2121212", + ServiceID: "nomad-registered-service-2121212", Name: "ping", }, } @@ -335,7 +335,7 @@ func TestConsul_FilterNomadServicesAndChecks(t *testing.T) { expChks := map[string]*consul.AgentCheck{ "212121212": { CheckID: "212121212", - ServiceID: "nomad-2121212", + ServiceID: "nomad-registered-service-2121212", Name: "ping", }, } diff --git a/nomad/structs/structs.go b/nomad/structs/structs.go index 265c0713a..82723965c 100644 --- a/nomad/structs/structs.go +++ b/nomad/structs/structs.go @@ -1146,7 +1146,7 @@ func (sc *ServiceCheck) Hash(serviceId string) string { } const ( - NomadConsulPrefix = "1729nomad" + NomadConsulPrefix = "nomad-registered-service" ) // The Service model represents a Consul service defintion From cacd8a78b3691d2e3bee251b2d85644593f55ef0 Mon Sep 17 00:00:00 2001 From: Chris Hines Date: Mon, 14 Dec 2015 14:59:19 -0500 Subject: [PATCH 3/4] Use minimum OS specific path. This change ensures LoadConfig and LoadConfigDir report consistent paths to files and those paths use the appropriate path separator for the target OS. Note that LoadConfigDir constructs paths with filepath.Join, which calls filepath.Clean, which calls filepath.FromSlash. --- command/agent/config.go | 2 +- command/agent/config_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/command/agent/config.go b/command/agent/config.go index e3fb3ae17..8ee166842 100644 --- a/command/agent/config.go +++ b/command/agent/config.go @@ -613,7 +613,7 @@ func LoadConfig(path string) (*Config, error) { if fi.IsDir() { return LoadConfigDir(path) } - return LoadConfigFile(path) + return LoadConfigFile(filepath.Clean(path)) } // LoadConfigString is used to parse a config string diff --git a/command/agent/config_test.go b/command/agent/config_test.go index e342b997b..f89386a95 100644 --- a/command/agent/config_test.go +++ b/command/agent/config_test.go @@ -327,7 +327,7 @@ func TestConfig_LoadConfigsFileOrder(t *testing.T) { config := config1.Merge(config2) if !reflect.DeepEqual(config.Files, expected) { - t.Errorf("Loaded configs don't match\nExpected\n%+vGot\n%+v\n", + t.Errorf("Loaded configs don't match\nwant: %+v\n got: %+v\n", expected, config.Files) } } From 04c7ba69af032781825b70c12264bbf2a98d54eb Mon Sep 17 00:00:00 2001 From: Chris Hines Date: Mon, 14 Dec 2015 17:03:08 -0500 Subject: [PATCH 4/4] Remove clock granularity sensitive test assertion. TestRequestTime already verifies that the request time is properly recorded. --- api/util_test.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/api/util_test.go b/api/util_test.go index 1c1073ed7..dfd0e95d0 100644 --- a/api/util_test.go +++ b/api/util_test.go @@ -17,9 +17,6 @@ func assertWriteMeta(t *testing.T, wm *WriteMeta) { if wm.LastIndex == 0 { t.Fatalf("bad index: %d", wm.LastIndex) } - if wm.RequestTime == 0 { - t.Fatalf("bad request time: %d", wm.RequestTime) - } } func testJob() *Job {