Skip to content

Commit

Permalink
Fix/add failure behavior #266 (#267)
Browse files Browse the repository at this point in the history
This MR addresses the behavior mismatch mentioned in
#266
Have passed the `EtcdSyncTest`
  • Loading branch information
daniel0076 committed Mar 13, 2024
1 parent c911c83 commit ca0e352
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/v3/AsyncGRPC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -994,9 +994,9 @@ etcdv3::AsyncSetAction::AsyncSetAction(etcdv3::ActionParameters&& params,
// backwards compatibility
txn.add_success_range(parameters.key);
if (create) {
txn.add_failure_put(parameters.key, parameters.value, parameters.lease_id);
} else {
txn.add_failure_range(parameters.key);
} else {
txn.add_failure_put(parameters.key, parameters.value, parameters.lease_id);
}
response_reader =
parameters.kv_stub->AsyncTxn(&context, *txn.txn_request, &cq_);
Expand Down
2 changes: 1 addition & 1 deletion tst/EtcdSyncTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ TEST_CASE("sync operations") {
// add
CHECK(0 == etcd.add("/test/key1", "42").error_code());
CHECK(etcd::ERROR_KEY_ALREADY_EXISTS ==
etcd.add("/test/key1", "42").error_code()); // Key already exists
etcd.add("/test/key1", "41").error_code()); // Key already exists
CHECK("42" == etcd.get("/test/key1").value().as_string());

// modify
Expand Down

0 comments on commit ca0e352

Please sign in to comment.