mirror of https://github.com/tikv/client-rust.git
fix integration tests
Signed-off-by: ekexium <ekexium@gmail.com>
This commit is contained in:
parent
dd542e0f39
commit
e2c74dcdba
|
@ -35,11 +35,11 @@ async fn delete_all_raw() -> Fallible<()> {
|
|||
|
||||
async fn delete_all_txn() -> Fallible<()> {
|
||||
let config = Config::new(pd_addrs());
|
||||
let txn_client = TransactionClient::new(config).await?;
|
||||
let txn_client = TransactionClient::new(config).await?.with_key_only(true);
|
||||
let mut txn = txn_client.begin().await?;
|
||||
|
||||
loop {
|
||||
let mut keys = txn.scan(vec![].., SCAN_BATCH_SIZE, true).await?.peekable();
|
||||
let mut keys = txn.scan(vec![].., SCAN_BATCH_SIZE).await?.peekable();
|
||||
|
||||
if keys.peek().is_none() {
|
||||
break;
|
||||
|
@ -177,6 +177,9 @@ async fn raw_bank_transfer() -> Fallible<()> {
|
|||
let mut alice_balance = get_u32(&client, alice.clone()).await?;
|
||||
let bob = chosen_people[1];
|
||||
let mut bob_balance = get_u32(&client, bob.clone()).await?;
|
||||
if alice_balance == 0 {
|
||||
continue;
|
||||
}
|
||||
let transfer = rng.gen_range(0, alice_balance);
|
||||
alice_balance -= transfer;
|
||||
bob_balance += transfer;
|
||||
|
@ -211,7 +214,7 @@ async fn txn_bank_transfer() -> Fallible<()> {
|
|||
for person in &people {
|
||||
let init = rng.gen::<u8>() as u32;
|
||||
sum += init as u32;
|
||||
txn.set(person.clone(), init.to_be_bytes().to_vec()).await?;
|
||||
txn.put(person.clone(), init.to_be_bytes().to_vec()).await?;
|
||||
}
|
||||
txn.commit().await?;
|
||||
|
||||
|
@ -223,12 +226,15 @@ async fn txn_bank_transfer() -> Fallible<()> {
|
|||
let mut alice_balance = get_txn_u32(&txn, alice.clone()).await?;
|
||||
let bob = chosen_people[1];
|
||||
let mut bob_balance = get_txn_u32(&txn, bob.clone()).await?;
|
||||
if alice_balance == 0 {
|
||||
continue;
|
||||
}
|
||||
let transfer = rng.gen_range(0, alice_balance);
|
||||
alice_balance -= transfer;
|
||||
bob_balance += transfer;
|
||||
txn.set(alice.clone(), alice_balance.to_be_bytes().to_vec())
|
||||
txn.put(alice.clone(), alice_balance.to_be_bytes().to_vec())
|
||||
.await?;
|
||||
txn.set(bob.clone(), bob_balance.to_be_bytes().to_vec())
|
||||
txn.put(bob.clone(), bob_balance.to_be_bytes().to_vec())
|
||||
.await?;
|
||||
txn.commit().await?;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue