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

This commit is contained in:
Sean Chittenden 2016-02-01 16:42:04 -08:00
parent c7e58734ed
commit 1005b91c87
2 changed files with 4 additions and 2 deletions

View File

@ -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
} }

View File

@ -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
} }