Use panic instead of returning a sentinel UUID values in unit tests

pull/1667/head
Sean Chittenden 9 years ago
parent c7e58734ed
commit 1005b91c87

@ -3,6 +3,7 @@ package agent
import ( import (
"bytes" "bytes"
"encoding/json" "encoding/json"
"fmt"
"os" "os"
"reflect" "reflect"
"testing" "testing"
@ -16,7 +17,7 @@ import (
func generateUUID() (ret string) { func generateUUID() (ret string) {
var err error var err error
if ret, err = uuid.GenerateUUID(); err != nil { 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 return ret
} }

@ -2,6 +2,7 @@ package consul
import ( import (
"bytes" "bytes"
"fmt"
"os" "os"
"reflect" "reflect"
"testing" "testing"
@ -43,7 +44,7 @@ func makeLog(buf []byte) *raft.Log {
func generateUUID() (ret string) { func generateUUID() (ret string) {
var err error var err error
if ret, err = uuid.GenerateUUID(); err != nil { 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 return ret
} }

Loading…
Cancel
Save