fix dep issue

release-0.4
Xiang Li 2013-11-22 13:27:04 -08:00
parent 40a574a8ca
commit a607c9eace
4 changed files with 9 additions and 11 deletions

View File

@ -4,7 +4,7 @@ import (
"crypto/tls"
"crypto/x509"
"encoding/pem"
"errors"
"fmt"
"io/ioutil"
)
@ -27,7 +27,7 @@ func (info TLSInfo) Config() (TLSConfig, error) {
// Both the key and cert must be present.
if info.KeyFile == "" || info.CertFile == "" {
return t, errors.New("KeyFile and CertFile must both be present")
return t, fmt.Errorf("KeyFile and CertFile must both be present[key: %v, cert: %v]", info.KeyFile, info.CertFile)
}
tlsCert, err := tls.LoadX509KeyPair(info.CertFile, info.KeyFile)

View File

@ -50,18 +50,16 @@ func TestSingleNodeRecovery(t *testing.T) {
time.Sleep(time.Second)
results, err := c.Get("foo", false)
result, err = c.Get("foo", false)
if err != nil {
t.Fatal("get fail: " + err.Error())
return
}
kv := results.Kvs[0]
if err != nil || kv.Key != "/foo" || kv.Value != "bar" || kv.TTL > 99 {
if err != nil || result.Key != "/foo" || result.Value != "bar" || result.TTL > 99 {
if err != nil {
t.Fatal(err)
}
t.Fatalf("Recovery Get failed with %s %s %v", kv.Key, kv.Value, kv.TTL)
t.Fatalf("Recovery Get failed with %s %s %v", result.Key, result.Value, result.TTL)
}
}

View File

@ -51,9 +51,9 @@ func TestSingleNode(t *testing.T) {
// Add a test-and-set test
// First, we'll test we can change the value if we get it write
result, match, err := c.CompareAndSwap("foo", "foobar", 100, "foo", 0)
result, err = c.CompareAndSwap("foo", "foobar", 100, "bar", 0)
if err != nil || result.Key != "/foo" || result.Value != "foobar" || result.PrevValue != "bar" || result.TTL != 100 || !match {
if err != nil || result.Key != "/foo" || result.Value != "foobar" || result.PrevValue != "bar" || result.TTL != 100 {
if err != nil {
t.Fatal(err)
}
@ -61,7 +61,7 @@ func TestSingleNode(t *testing.T) {
}
// Next, we'll make sure we can't set it without the correct prior value
_, _, err = c.CompareAndSwap("foo", "foofoo", 100, "bar", 0)
_, err = c.CompareAndSwap("foo", "foofoo", 100, "bar", 0)
if err == nil {
t.Fatalf("Set 4 expecting error when setting key with incorrect previous value")

View File

@ -80,7 +80,7 @@ func CreateCluster(size int, procAttr *os.ProcAttr, ssl bool) ([][]string, []*os
sslServer2 := []string{"-peer-ca-file=../../fixtures/ca/ca.crt",
"-peer-cert-file=../../fixtures/ca/server2.crt",
"-peer-cert-file=../../fixtures/ca/server2.key.insecure",
"-peer-key-file=../../fixtures/ca/server2.key.insecure",
}
for i := 0; i < size; i++ {