16 Commits

Author SHA1 Message Date
Brandon Philips
d7d20d1c3d bump(github.com/stretchr/testify): 9cc77fa25329013ce07362c7742952ff887361f2 2014-02-02 16:57:36 -08:00
Xiang Li
715b4d7bfc Merge pull request #408 from xiangli-cmu/compareAndDelete
Compare and delete
2013-12-25 13:16:27 -08:00
Chris Shoemaker
d89fa131ab feat(v2/errors): Use more appropriate HTTP status codes for error cases.
This commits adds test coverage for all the error and non-error cases
described below, but only the behavior of the 403, 404 and 412 cases
are changing in this commit.

When setting a key results in a new resource, we asset an HTTP status
code of 201 (aka "Created").

When attempting to get a resource that doesn't exist, we assert an
HTTP status code of 404 (aka "Not Found").

When attempting to delete a directory without dir=true, or a non-empty
directory without recursive=true, but the request is otherwise valid,
we assert an HTTP status code of 403 (aka "Forbidden").

When a precondition (e.g. specified by prevIndex, or prevValue) is not
met, but the request is otherwise syntactically valid, we assert an
HTTP status code of 412 (aka "Precondition Failed").  However,
prevExist is handled slightly differently.  If prevExist=false fails,
then this is treated like a failed precondition, so it should use
PreconditionFailed.  But, if prevExist=true fails, then this is
treated like other requests that require the existence of the
resource, and uses NotFound if the resource doesn't exist.

We continue to assert an HTTP status code of 400 when the request is
syntactically invalid (e.g. when prevIndex=bad_index).
2013-12-21 21:39:19 -05:00
Chris Shoemaker
3cde996d21 refactor(v2/tests): don't repeat construction of full test URL 2013-12-21 21:39:19 -05:00
Xiang Li
c4179829d6 tests(get_handler) loosen the time assumption for the un 2013-12-20 08:23:50 +08:00
Xiang Li
3e4f8a382e fix TestV2WatchKeyInDir test 2013-12-11 10:19:16 -08:00
Brandon Philips
74bd0d95b8 fix(server): try and add a expire dir test
This doesn't actually work yet.
2013-12-10 16:32:37 -08:00
Ben Johnson
5d865e321c Merge branch 'master' of https://github.com/coreos/etcd into mod-lock
Conflicts:
	server/v2/tests/delete_handler_test.go
	server/v2/tests/get_handler_test.go
	server/v2/tests/post_handler_test.go
	server/v2/tests/put_handler_test.go
	third_party/github.com/coreos/go-etcd/etcd/requests.go
2013-12-04 22:36:53 -07:00
Ben Johnson
df20be775c Fix test harness. 2013-12-02 15:43:37 -07:00
Xiang Li
b7d07ea5c8 refactor event 2013-11-28 11:33:40 -05:00
Xiang Li
06f1b7f2e8 refactor change Index to modifiedIndex 2013-11-09 20:49:19 -08:00
Xiang Li
6156d5c790 refactor separate etcd index from raft index 2013-11-09 17:55:54 -08:00
Xiang Li
28ac516f68 fix sinceIndex 2013-11-07 20:55:26 -08:00
Xiang Li
f723651a6d fix test: should wait for watch response 2013-10-30 15:46:01 -07:00
Xiang Li
bd651edf80 test add integration test 2013-10-30 15:27:16 -07:00
Ben Johnson
dcef04b796 Add v2 unit tests. 2013-10-17 21:52:15 -06:00