Browse Source

test fix tests

Xiang Li 12 years ago
parent
commit
e00296960c

+ 5 - 5
server/v2/tests/put_handler_test.go

@@ -95,7 +95,7 @@ func TestV2CreateKeyFail(t *testing.T) {
 		resp, _ = tests.PutForm(fmt.Sprintf("%s%s", s.URL(), "/v2/keys/foo/bar"), v)
 		resp, _ = tests.PutForm(fmt.Sprintf("%s%s", s.URL(), "/v2/keys/foo/bar"), v)
 		body := tests.ReadBodyJSON(resp)
 		body := tests.ReadBodyJSON(resp)
 		assert.Equal(t, body["errorCode"], 105, "")
 		assert.Equal(t, body["errorCode"], 105, "")
-		assert.Equal(t, body["message"], "Already exists", "")
+		assert.Equal(t, body["message"], "Key already exists", "")
 		assert.Equal(t, body["cause"], "/foo/bar", "")
 		assert.Equal(t, body["cause"], "/foo/bar", "")
 	})
 	})
 }
 }
@@ -139,7 +139,7 @@ func TestV2UpdateKeyFailOnValue(t *testing.T) {
 		resp, _ = tests.PutForm(fmt.Sprintf("%s%s", s.URL(), "/v2/keys/foo/bar"), v)
 		resp, _ = tests.PutForm(fmt.Sprintf("%s%s", s.URL(), "/v2/keys/foo/bar"), v)
 		body := tests.ReadBodyJSON(resp)
 		body := tests.ReadBodyJSON(resp)
 		assert.Equal(t, body["errorCode"], 100, "")
 		assert.Equal(t, body["errorCode"], 100, "")
-		assert.Equal(t, body["message"], "Key Not Found", "")
+		assert.Equal(t, body["message"], "Key not found", "")
 		assert.Equal(t, body["cause"], "/foo/bar", "")
 		assert.Equal(t, body["cause"], "/foo/bar", "")
 	})
 	})
 }
 }
@@ -157,7 +157,7 @@ func TestV2UpdateKeyFailOnMissingDirectory(t *testing.T) {
 		resp, _ := tests.PutForm(fmt.Sprintf("%s%s", s.URL(), "/v2/keys/foo/bar"), v)
 		resp, _ := tests.PutForm(fmt.Sprintf("%s%s", s.URL(), "/v2/keys/foo/bar"), v)
 		body := tests.ReadBodyJSON(resp)
 		body := tests.ReadBodyJSON(resp)
 		assert.Equal(t, body["errorCode"], 100, "")
 		assert.Equal(t, body["errorCode"], 100, "")
-		assert.Equal(t, body["message"], "Key Not Found", "")
+		assert.Equal(t, body["message"], "Key not found", "")
 		assert.Equal(t, body["cause"], "/foo", "")
 		assert.Equal(t, body["cause"], "/foo", "")
 	})
 	})
 }
 }
@@ -201,7 +201,7 @@ func TestV2SetKeyCASOnIndexFail(t *testing.T) {
 		resp, _ = tests.PutForm(fmt.Sprintf("%s%s", s.URL(), "/v2/keys/foo/bar"), v)
 		resp, _ = tests.PutForm(fmt.Sprintf("%s%s", s.URL(), "/v2/keys/foo/bar"), v)
 		body := tests.ReadBodyJSON(resp)
 		body := tests.ReadBodyJSON(resp)
 		assert.Equal(t, body["errorCode"], 101, "")
 		assert.Equal(t, body["errorCode"], 101, "")
-		assert.Equal(t, body["message"], "Test Failed", "")
+		assert.Equal(t, body["message"], "Compare failed", "")
 		assert.Equal(t, body["cause"], "[ != XXX] [10 != 2]", "")
 		assert.Equal(t, body["cause"], "[ != XXX] [10 != 2]", "")
 		assert.Equal(t, body["index"], 2, "")
 		assert.Equal(t, body["index"], 2, "")
 	})
 	})
@@ -263,7 +263,7 @@ func TestV2SetKeyCASOnValueFail(t *testing.T) {
 		resp, _ = tests.PutForm(fmt.Sprintf("%s%s", s.URL(), "/v2/keys/foo/bar"), v)
 		resp, _ = tests.PutForm(fmt.Sprintf("%s%s", s.URL(), "/v2/keys/foo/bar"), v)
 		body := tests.ReadBodyJSON(resp)
 		body := tests.ReadBodyJSON(resp)
 		assert.Equal(t, body["errorCode"], 101, "")
 		assert.Equal(t, body["errorCode"], 101, "")
-		assert.Equal(t, body["message"], "Test Failed", "")
+		assert.Equal(t, body["message"], "Compare failed", "")
 		assert.Equal(t, body["cause"], "[AAA != XXX] [0 != 2]", "")
 		assert.Equal(t, body["cause"], "[AAA != XXX] [0 != 2]", "")
 		assert.Equal(t, body["index"], 2, "")
 		assert.Equal(t, body["index"], 2, "")
 	})
 	})

+ 5 - 5
store/store_test.go

@@ -117,7 +117,7 @@ func TestStoreCreateFailsIfExists(t *testing.T) {
 	e, _err := s.Create("/foo", true, "", false, Permanent)
 	e, _err := s.Create("/foo", true, "", false, Permanent)
 	err := _err.(*etcdErr.Error)
 	err := _err.(*etcdErr.Error)
 	assert.Equal(t, err.ErrorCode, etcdErr.EcodeNodeExist, "")
 	assert.Equal(t, err.ErrorCode, etcdErr.EcodeNodeExist, "")
-	assert.Equal(t, err.Message, "Already exists", "")
+	assert.Equal(t, err.Message, "Key already exists", "")
 	assert.Equal(t, err.Cause, "/foo", "")
 	assert.Equal(t, err.Cause, "/foo", "")
 	assert.Equal(t, err.Index, uint64(1), "")
 	assert.Equal(t, err.Index, uint64(1), "")
 	assert.Nil(t, e, 0, "")
 	assert.Nil(t, e, 0, "")
@@ -147,7 +147,7 @@ func TestStoreUpdateFailsIfDirectory(t *testing.T) {
 	e, _err := s.Update("/foo", "baz", Permanent)
 	e, _err := s.Update("/foo", "baz", Permanent)
 	err := _err.(*etcdErr.Error)
 	err := _err.(*etcdErr.Error)
 	assert.Equal(t, err.ErrorCode, etcdErr.EcodeNotFile, "")
 	assert.Equal(t, err.ErrorCode, etcdErr.EcodeNotFile, "")
-	assert.Equal(t, err.Message, "Not A File", "")
+	assert.Equal(t, err.Message, "Not a file", "")
 	assert.Equal(t, err.Cause, "/foo", "")
 	assert.Equal(t, err.Cause, "/foo", "")
 	assert.Nil(t, e, "")
 	assert.Nil(t, e, "")
 }
 }
@@ -240,7 +240,7 @@ func TestStoreDeleteDiretoryFailsIfNonRecursive(t *testing.T) {
 	e, _err := s.Delete("/foo", false, false)
 	e, _err := s.Delete("/foo", false, false)
 	err := _err.(*etcdErr.Error)
 	err := _err.(*etcdErr.Error)
 	assert.Equal(t, err.ErrorCode, etcdErr.EcodeNotFile, "")
 	assert.Equal(t, err.ErrorCode, etcdErr.EcodeNotFile, "")
-	assert.Equal(t, err.Message, "Not A File", "")
+	assert.Equal(t, err.Message, "Not a file", "")
 	assert.Nil(t, e, "")
 	assert.Nil(t, e, "")
 }
 }
 
 
@@ -264,7 +264,7 @@ func TestStoreCompareAndSwapPrevValueFailsIfNotMatch(t *testing.T) {
 	e, _err := s.CompareAndSwap("/foo", "wrong_value", 0, "baz", Permanent)
 	e, _err := s.CompareAndSwap("/foo", "wrong_value", 0, "baz", Permanent)
 	err := _err.(*etcdErr.Error)
 	err := _err.(*etcdErr.Error)
 	assert.Equal(t, err.ErrorCode, etcdErr.EcodeTestFailed, "")
 	assert.Equal(t, err.ErrorCode, etcdErr.EcodeTestFailed, "")
-	assert.Equal(t, err.Message, "Test Failed", "")
+	assert.Equal(t, err.Message, "Compare failed", "")
 	assert.Nil(t, e, "")
 	assert.Nil(t, e, "")
 	e, _ = s.Get("/foo", false, false)
 	e, _ = s.Get("/foo", false, false)
 	assert.Equal(t, e.Node.Value, "bar", "")
 	assert.Equal(t, e.Node.Value, "bar", "")
@@ -290,7 +290,7 @@ func TestStoreCompareAndSwapPrevIndexFailsIfNotMatch(t *testing.T) {
 	e, _err := s.CompareAndSwap("/foo", "", 100, "baz", Permanent)
 	e, _err := s.CompareAndSwap("/foo", "", 100, "baz", Permanent)
 	err := _err.(*etcdErr.Error)
 	err := _err.(*etcdErr.Error)
 	assert.Equal(t, err.ErrorCode, etcdErr.EcodeTestFailed, "")
 	assert.Equal(t, err.ErrorCode, etcdErr.EcodeTestFailed, "")
-	assert.Equal(t, err.Message, "Test Failed", "")
+	assert.Equal(t, err.Message, "Compare failed", "")
 	assert.Nil(t, e, "")
 	assert.Nil(t, e, "")
 	e, _ = s.Get("/foo", false, false)
 	e, _ = s.Get("/foo", false, false)
 	assert.Equal(t, e.Node.Value, "bar", "")
 	assert.Equal(t, e.Node.Value, "bar", "")

+ 1 - 1
tests/functional/v1_migration_test.go

@@ -92,7 +92,7 @@ func TestV1ClusterMigration(t *testing.T) {
 	body := tests.ReadBody(resp)
 	body := tests.ReadBody(resp)
 	assert.Nil(t, err, "")
 	assert.Nil(t, err, "")
 	assert.Equal(t, resp.StatusCode, 400)
 	assert.Equal(t, resp.StatusCode, 400)
-	assert.Equal(t, string(body), `{"errorCode":100,"message":"Key Not Found","cause":"/message","index":11}`+"\n")
+	assert.Equal(t, string(body), `{"errorCode":100,"message":"Key not found","cause":"/message","index":11}`+"\n")
 
 
 	// Ensure TTL'd message is removed.
 	// Ensure TTL'd message is removed.
 	resp, err = tests.Get("http://localhost:4001/v2/keys/foo")
 	resp, err = tests.Get("http://localhost:4001/v2/keys/foo")