From 5ac7b893ccf4c67b5abcca2cf993fbf11a3033a6 Mon Sep 17 00:00:00 2001 From: Sean Chittenden Date: Mon, 1 Feb 2016 16:42:04 -0800 Subject: [PATCH] Use panic instead of returning a sentinel UUID values in unit tests --- command/agent/remote_exec_test.go | 3 ++- consul/fsm_test.go | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/command/agent/remote_exec_test.go b/command/agent/remote_exec_test.go index 3b61550b8..c72748de0 100644 --- a/command/agent/remote_exec_test.go +++ b/command/agent/remote_exec_test.go @@ -3,6 +3,7 @@ package agent import ( "bytes" "encoding/json" + "fmt" "os" "reflect" "testing" @@ -16,7 +17,7 @@ import ( func generateUUID() (ret string) { var err error if ret, err = uuid.GenerateUUID(); err != nil { - return "DEADC0DE-BADD-CAFE-D00D-FEEDFACECAFE" + panic(fmt.Sprintf("Unable to generate a UUID, %v", err)) } return ret } diff --git a/consul/fsm_test.go b/consul/fsm_test.go index 97f5baf23..e9ba05e15 100644 --- a/consul/fsm_test.go +++ b/consul/fsm_test.go @@ -2,6 +2,7 @@ package consul import ( "bytes" + "fmt" "os" "reflect" "testing" @@ -43,7 +44,7 @@ func makeLog(buf []byte) *raft.Log { func generateUUID() (ret string) { var err error if ret, err = uuid.GenerateUUID(); err != nil { - return "DEADC0DE-BADD-CAFE-D00D-FEEDFACECAFE" + panic(fmt.Sprintf("Unable to generate a UUID, %v", err)) } return ret }