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 893f91b0d5
commit 5ac7b893cc
2 changed files with 4 additions and 2 deletions

View File

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

View File

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