From cef9608621d2af23621c7f5cb4dfe01cec5a16db Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Mon, 14 Jan 2019 11:01:45 -0800 Subject: [PATCH 01/21] Refine CI Signed-off-by: Ana Hobden --- .travis.yml | 59 ++++++++++++---------------- Cargo.toml | 6 +++ tests/integration_tests/mod.rs | 25 ++++++++++++ tests/{ => integration_tests}/raw.rs | 5 ++- tests/test.rs | 15 +++++++ 5 files changed, 75 insertions(+), 35 deletions(-) create mode 100644 tests/integration_tests/mod.rs rename tests/{ => integration_tests}/raw.rs (97%) create mode 100644 tests/test.rs diff --git a/.travis.yml b/.travis.yml index 66225120..f606806f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,44 +1,37 @@ -branches: - only: - # This is where pull requests from "bors r+" are built. - - staging - # This is where pull requests from "bors try" are built. - - trying - # Enable building pull requests. - - master +sudo: false language: rust -sudo: false +os: + - linux + - windows + - osx +rust: + - stable + - nightly +cache: cargo env: global: - RUST_BACKTRACE=1 - RUSTFLAGS="-D warnings" -cache: cargo + - PD_ADDR="127.0.0.1:2379" + - TIKV_ADDR="127.0.0.1:2378" -rust: -os: - - linux - - windows - - osx +install: + - if [[ $TRAVIS_RUST_VERSION == "stable" && $TRAVIS_OS == "linux" ]]; then rustup component add rustfmt; fi + - if [[ $TRAVIS_RUST_VERSION == "stable" && $TRAVIS_OS == "linux" ]]; then rustup component add clippy; fi + - if [[ $TRAVIS_OS == "windows" ]]; then choco install golang; fi + - if [[ $TRAVIS_OS == "windows" ]]; then choco install cmake; fi -matrix: - include: - # This build uses stable and checks rustfmt and clippy. - # We don't check them on nightly since their lints and formatting may differ. - - rust: stable - install: - - rustup component add rustfmt-preview - - rustup component add clippy-preview - before_script: - - cargo fmt --all -- --check - - cargo clippy --all -- -D clippy - # Since many users will use nightlies, also test that. - - rust: nightly +before_script: + - if [[ $TRAVIS_RUST_VERSION == "stable" && $TRAVIS_OS == "linux" ]]; then cargo fmt; fi + - if [[ $TRAVIS_RUST_VERSION == "stable" && $TRAVIS_OS == "linux" ]]; then cargo clippy; fi script: - - docker run -d --net=host --name pd --rm pingcap/pd --name "pd" --data-dir "pd" --client-urls "http://127.0.0.1:2379" --advertise-client-urls "http://127.0.0.1:2379" - - docker run -d --net=host --name kv --rm pingcap/tikv --pd-endpoints "127.0.0.1:2379" --addr "127.0.0.1:2378" --data-dir "kv" - - cargo test --all -- --nocapture - # Validate benches still work. - - cargo bench --all -- --test + - cargo test + # We need to switch the daemon of Windows to use Linux docker containers. + - if [[ $TRAVIS_OS == "windows" ]]; then docker -switchDaemon; fi + # OS X can't do docker on travis. :( + - if [[ $TRAVIS_OS != "osx" ]]; then docker run -d --net=host --name pd --rm pingcap/pd --name "pd" --data-dir "pd" --client-urls $PD_ADDR --advertise-client-urls $PD_ADDR; fi + - if [[ $TRAVIS_OS != "osx" ]]; then docker run -d --net=host --name kv --rm --ulimit nofile=90000:90000 pingcap/tikv --pd-endpoints $PD_ADDR --addr $TIKV_ADDR --data-dir "kv"; fi + - if [[ $TRAVIS_OS != "osx" ]]; then cargo test --features integration-tests; fi diff --git a/Cargo.toml b/Cargo.toml index 2a46c2ef..518bb8e2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,6 +8,12 @@ repository = "https://github.com/tikv/client-rust" description = "The rust language implementation of TiKV client." edition = "2018" +[features] +default = [] +# Enable integration tests with a running TiKV and PD instance. +# Use $PD_ADDRS, comma separated, to set the addresses the tests use. +integration-tests = [] + [lib] name = "tikv_client" diff --git a/tests/integration_tests/mod.rs b/tests/integration_tests/mod.rs new file mode 100644 index 00000000..9270004d --- /dev/null +++ b/tests/integration_tests/mod.rs @@ -0,0 +1,25 @@ +// Copyright 2019 The TiKV Project Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// See the License for the specific language governing permissions and +// limitations under the License. + +mod raw; + +use std::env::var; +const ENV_PD_ADDR: &str = "PD_ADDR"; + +pub fn pd_addr() -> Vec { + var(ENV_PD_ADDR) + .expect(&format!("Expected {}:", ENV_PD_ADDR)) + .split(",") + .map(From::from) + .collect() +} \ No newline at end of file diff --git a/tests/raw.rs b/tests/integration_tests/raw.rs similarity index 97% rename from tests/raw.rs rename to tests/integration_tests/raw.rs index 7eb64201..b056f187 100644 --- a/tests/raw.rs +++ b/tests/integration_tests/raw.rs @@ -1,4 +1,4 @@ -// Copyright 2018 The TiKV Project Authors +// Copyright 2019 The TiKV Project Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -15,6 +15,7 @@ use futures::future::Future; const NUM_TEST_KEYS: u32 = 100; use tikv_client::{raw::Client, Config, Key, KvPair, Value}; +use crate::integration_tests::pd_addr; fn generate_key(id: i32) -> Key { format!("testkey_{}", id).into_bytes().into() @@ -34,7 +35,7 @@ fn wipe_all(client: &Client) { } fn connect() -> Client { - let client = Client::new(&Config::new(vec!["127.0.0.1:2379"])) + let client = Client::new(&Config::new(pd_addr())) .wait() .expect("Could not connect to tikv"); wipe_all(&client); diff --git a/tests/test.rs b/tests/test.rs new file mode 100644 index 00000000..0b85802e --- /dev/null +++ b/tests/test.rs @@ -0,0 +1,15 @@ +// Copyright 2019 The TiKV Project Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// See the License for the specific language governing permissions and +// limitations under the License. + +#[cfg(feature = "integration-tests")] +mod integration_tests; \ No newline at end of file From 5cb2812b714822906a0c15333cf7365d6a575738 Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Mon, 14 Jan 2019 14:19:34 -0800 Subject: [PATCH 02/21] Debug Signed-off-by: Ana Hobden --- .travis.yml | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index f606806f..b9c0bab8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,21 +17,24 @@ env: - TIKV_ADDR="127.0.0.1:2378" install: - - if [[ $TRAVIS_RUST_VERSION == "stable" && $TRAVIS_OS == "linux" ]]; then rustup component add rustfmt; fi - - if [[ $TRAVIS_RUST_VERSION == "stable" && $TRAVIS_OS == "linux" ]]; then rustup component add clippy; fi - - if [[ $TRAVIS_OS == "windows" ]]; then choco install golang; fi - - if [[ $TRAVIS_OS == "windows" ]]; then choco install cmake; fi + - if [[ $TRAVIS_RUST_VERSION == "stable" && $TRAVIS_OS_NAME == "linux" ]]; then rustup component add rustfmt; fi + - if [[ $TRAVIS_RUST_VERSION == "stable" && $TRAVIS_OS_NAME == "linux" ]]; then rustup component add clippy; fi + - if [[ $TRAVIS_OS_NAME == "windows" ]]; then choco install golang; fi + - if [[ $TRAVIS_OS_NAME == "windows" ]]; then choco install cmake; fi before_script: - - if [[ $TRAVIS_RUST_VERSION == "stable" && $TRAVIS_OS == "linux" ]]; then cargo fmt; fi - - if [[ $TRAVIS_RUST_VERSION == "stable" && $TRAVIS_OS == "linux" ]]; then cargo clippy; fi + - if [[ $TRAVIS_RUST_VERSION == "stable" && $TRAVIS_OS_NAME == "linux" ]]; then cargo fmt; fi + - if [[ $TRAVIS_RUST_VERSION == "stable" && $TRAVIS_OS_NAME == "linux" ]]; then cargo clippy; fi script: - cargo test # We need to switch the daemon of Windows to use Linux docker containers. - - if [[ $TRAVIS_OS == "windows" ]]; then docker -switchDaemon; fi + - if [[ $TRAVIS_OS_NAME == "windows" ]]; then docker -switchDaemon; fi # OS X can't do docker on travis. :( - - if [[ $TRAVIS_OS != "osx" ]]; then docker run -d --net=host --name pd --rm pingcap/pd --name "pd" --data-dir "pd" --client-urls $PD_ADDR --advertise-client-urls $PD_ADDR; fi - - if [[ $TRAVIS_OS != "osx" ]]; then docker run -d --net=host --name kv --rm --ulimit nofile=90000:90000 pingcap/tikv --pd-endpoints $PD_ADDR --addr $TIKV_ADDR --data-dir "kv"; fi - - if [[ $TRAVIS_OS != "osx" ]]; then cargo test --features integration-tests; fi + - if [[ $TRAVIS_OS_NAME != "osx" ]]; then docker run -d --net=host --name pd --rm pingcap/pd --name "pd" --data-dir "pd" --client-urls $PD_ADDR --advertise-client-urls $PD_ADDR; fi + - if [[ $TRAVIS_OS_NAME != "osx" ]]; then docker run -d --net=host --name kv --rm --ulimit nofile=90000:90000 pingcap/tikv --pd-endpoints $PD_ADDR --addr $TIKV_ADDR --data-dir "kv"; fi + - if [[ $TRAVIS_OS_NAME != "osx" ]]; then docker ps; fi + - if [[ $TRAVIS_OS_NAME != "osx" ]]; then docker logs pd; fi + - if [[ $TRAVIS_OS_NAME != "osx" ]]; then docker logs kv; fi + - if [[ $TRAVIS_OS_NAME != "osx" ]]; then cargo test --features integration-tests; fi From c237b3e8c5aaa5d3c39081ea58373b04432dfa8f Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Mon, 14 Jan 2019 14:53:25 -0800 Subject: [PATCH 03/21] debug Signed-off-by: Ana Hobden --- .travis.yml | 9 +++++---- tests/integration_tests/mod.rs | 2 +- tests/integration_tests/raw.rs | 2 +- tests/test.rs | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index b9c0bab8..765234b2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,16 +24,17 @@ install: before_script: - - if [[ $TRAVIS_RUST_VERSION == "stable" && $TRAVIS_OS_NAME == "linux" ]]; then cargo fmt; fi - - if [[ $TRAVIS_RUST_VERSION == "stable" && $TRAVIS_OS_NAME == "linux" ]]; then cargo clippy; fi + - if [[ $TRAVIS_RUST_VERSION == "stable" && $TRAVIS_OS_NAME == "linux" ]]; then cargo fmt -- --check; fi + # Currently some crates have lint errors if clippy checks them. + - if [[ $TRAVIS_RUST_VERSION == "stable" && $TRAVIS_OS_NAME == "linux" ]]; then cargo build && cargo clippy -- -D clippy::all; fi script: - cargo test # We need to switch the daemon of Windows to use Linux docker containers. - if [[ $TRAVIS_OS_NAME == "windows" ]]; then docker -switchDaemon; fi # OS X can't do docker on travis. :( - - if [[ $TRAVIS_OS_NAME != "osx" ]]; then docker run -d --net=host --name pd --rm pingcap/pd --name "pd" --data-dir "pd" --client-urls $PD_ADDR --advertise-client-urls $PD_ADDR; fi - - if [[ $TRAVIS_OS_NAME != "osx" ]]; then docker run -d --net=host --name kv --rm --ulimit nofile=90000:90000 pingcap/tikv --pd-endpoints $PD_ADDR --addr $TIKV_ADDR --data-dir "kv"; fi + - if [[ $TRAVIS_OS_NAME != "osx" ]]; then docker run -d --net=host --name pd --rm pingcap/pd --name "pd" --data-dir "pd" --client-urls "http://127.0.0.1:2379" --advertise-client-urls "http://127.0.0.1:2379"; fi + - if [[ $TRAVIS_OS_NAME != "osx" ]]; then docker run -d --net=host --name kv --rm --ulimit nofile=90000:90000 pingcap/tikv --pd-endpoints "127.0.0.1:2379" --addr "127.0.0.1:2378" --data-dir "kv"; fi - if [[ $TRAVIS_OS_NAME != "osx" ]]; then docker ps; fi - if [[ $TRAVIS_OS_NAME != "osx" ]]; then docker logs pd; fi - if [[ $TRAVIS_OS_NAME != "osx" ]]; then docker logs kv; fi diff --git a/tests/integration_tests/mod.rs b/tests/integration_tests/mod.rs index 9270004d..2746d190 100644 --- a/tests/integration_tests/mod.rs +++ b/tests/integration_tests/mod.rs @@ -22,4 +22,4 @@ pub fn pd_addr() -> Vec { .split(",") .map(From::from) .collect() -} \ No newline at end of file +} diff --git a/tests/integration_tests/raw.rs b/tests/integration_tests/raw.rs index b056f187..06e78ce6 100644 --- a/tests/integration_tests/raw.rs +++ b/tests/integration_tests/raw.rs @@ -14,8 +14,8 @@ use futures::future::Future; const NUM_TEST_KEYS: u32 = 100; -use tikv_client::{raw::Client, Config, Key, KvPair, Value}; use crate::integration_tests::pd_addr; +use tikv_client::{raw::Client, Config, Key, KvPair, Value}; fn generate_key(id: i32) -> Key { format!("testkey_{}", id).into_bytes().into() diff --git a/tests/test.rs b/tests/test.rs index 0b85802e..964217ab 100644 --- a/tests/test.rs +++ b/tests/test.rs @@ -12,4 +12,4 @@ // limitations under the License. #[cfg(feature = "integration-tests")] -mod integration_tests; \ No newline at end of file +mod integration_tests; From f9665563ed14fa5ddd28a49c70c4f5b9ef80a687 Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Mon, 14 Jan 2019 15:46:52 -0800 Subject: [PATCH 04/21] Update windows path Signed-off-by: Ana Hobden --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 765234b2..86eb8ba3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,6 +21,7 @@ install: - if [[ $TRAVIS_RUST_VERSION == "stable" && $TRAVIS_OS_NAME == "linux" ]]; then rustup component add clippy; fi - if [[ $TRAVIS_OS_NAME == "windows" ]]; then choco install golang; fi - if [[ $TRAVIS_OS_NAME == "windows" ]]; then choco install cmake; fi + - if [[ $TRAVIS_OS_NAME == "windows" ]]; then export PATH="$PATH:/c/Go/bin/:/c/Program Files/CMake/bin"; fi before_script: From cf0159db8bfd2ba4656c3d244cb3422d848208d1 Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Mon, 14 Jan 2019 16:25:53 -0800 Subject: [PATCH 05/21] Correct switchdaemon Signed-off-by: Ana Hobden --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 86eb8ba3..ef63a8d1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,12 +27,12 @@ install: before_script: - if [[ $TRAVIS_RUST_VERSION == "stable" && $TRAVIS_OS_NAME == "linux" ]]; then cargo fmt -- --check; fi # Currently some crates have lint errors if clippy checks them. - - if [[ $TRAVIS_RUST_VERSION == "stable" && $TRAVIS_OS_NAME == "linux" ]]; then cargo build && cargo clippy -- -D clippy::all; fi + - if [[ $TRAVIS_RUST_VERSION == "stable" && $TRAVIS_OS_NAME == "linux" ]]; then cargo clippy -- -D clippy::all; fi script: - cargo test # We need to switch the daemon of Windows to use Linux docker containers. - - if [[ $TRAVIS_OS_NAME == "windows" ]]; then docker -switchDaemon; fi + - if [[ $TRAVIS_OS_NAME == "windows" ]]; then "/c/Program Files/Docker/Docker/DockerCli.exe" -SwitchDaemon .; fi # OS X can't do docker on travis. :( - if [[ $TRAVIS_OS_NAME != "osx" ]]; then docker run -d --net=host --name pd --rm pingcap/pd --name "pd" --data-dir "pd" --client-urls "http://127.0.0.1:2379" --advertise-client-urls "http://127.0.0.1:2379"; fi - if [[ $TRAVIS_OS_NAME != "osx" ]]; then docker run -d --net=host --name kv --rm --ulimit nofile=90000:90000 pingcap/tikv --pd-endpoints "127.0.0.1:2379" --addr "127.0.0.1:2378" --data-dir "kv"; fi From c955323269518f8c2c60b5f43d6da81a03f5df21 Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Mon, 14 Jan 2019 16:52:10 -0800 Subject: [PATCH 06/21] Nocapture Signed-off-by: Ana Hobden --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index ef63a8d1..99ab527f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,7 +30,7 @@ before_script: - if [[ $TRAVIS_RUST_VERSION == "stable" && $TRAVIS_OS_NAME == "linux" ]]; then cargo clippy -- -D clippy::all; fi script: - - cargo test + - cargo test --all -- --nocapture # We need to switch the daemon of Windows to use Linux docker containers. - if [[ $TRAVIS_OS_NAME == "windows" ]]; then "/c/Program Files/Docker/Docker/DockerCli.exe" -SwitchDaemon .; fi # OS X can't do docker on travis. :( @@ -39,4 +39,4 @@ script: - if [[ $TRAVIS_OS_NAME != "osx" ]]; then docker ps; fi - if [[ $TRAVIS_OS_NAME != "osx" ]]; then docker logs pd; fi - if [[ $TRAVIS_OS_NAME != "osx" ]]; then docker logs kv; fi - - if [[ $TRAVIS_OS_NAME != "osx" ]]; then cargo test --features integration-tests; fi + - if [[ $TRAVIS_OS_NAME != "osx" ]]; then cargo test --all --features integration-tests -- --nocapture; fi From da18ef590c87a0744c3eae355ac6fec4521d9042 Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Sun, 20 Jan 2019 16:52:50 -0800 Subject: [PATCH 07/21] Merge before and script Signed-off-by: Ana Hobden --- .travis.yml | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/.travis.yml b/.travis.yml index 99ab527f..b8b5f905 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,8 +13,6 @@ env: global: - RUST_BACKTRACE=1 - RUSTFLAGS="-D warnings" - - PD_ADDR="127.0.0.1:2379" - - TIKV_ADDR="127.0.0.1:2378" install: - if [[ $TRAVIS_RUST_VERSION == "stable" && $TRAVIS_OS_NAME == "linux" ]]; then rustup component add rustfmt; fi @@ -23,20 +21,16 @@ install: - if [[ $TRAVIS_OS_NAME == "windows" ]]; then choco install cmake; fi - if [[ $TRAVIS_OS_NAME == "windows" ]]; then export PATH="$PATH:/c/Go/bin/:/c/Program Files/CMake/bin"; fi - -before_script: +script: - if [[ $TRAVIS_RUST_VERSION == "stable" && $TRAVIS_OS_NAME == "linux" ]]; then cargo fmt -- --check; fi - # Currently some crates have lint errors if clippy checks them. - if [[ $TRAVIS_RUST_VERSION == "stable" && $TRAVIS_OS_NAME == "linux" ]]; then cargo clippy -- -D clippy::all; fi - -script: - cargo test --all -- --nocapture - # We need to switch the daemon of Windows to use Linux docker containers. - - if [[ $TRAVIS_OS_NAME == "windows" ]]; then "/c/Program Files/Docker/Docker/DockerCli.exe" -SwitchDaemon .; fi - # OS X can't do docker on travis. :( - - if [[ $TRAVIS_OS_NAME != "osx" ]]; then docker run -d --net=host --name pd --rm pingcap/pd --name "pd" --data-dir "pd" --client-urls "http://127.0.0.1:2379" --advertise-client-urls "http://127.0.0.1:2379"; fi - - if [[ $TRAVIS_OS_NAME != "osx" ]]; then docker run -d --net=host --name kv --rm --ulimit nofile=90000:90000 pingcap/tikv --pd-endpoints "127.0.0.1:2379" --addr "127.0.0.1:2378" --data-dir "kv"; fi - - if [[ $TRAVIS_OS_NAME != "osx" ]]; then docker ps; fi - - if [[ $TRAVIS_OS_NAME != "osx" ]]; then docker logs pd; fi - - if [[ $TRAVIS_OS_NAME != "osx" ]]; then docker logs kv; fi - - if [[ $TRAVIS_OS_NAME != "osx" ]]; then cargo test --all --features integration-tests -- --nocapture; fi + # For now we only run full integration tests on Linux. Here's why: + # * Docker on OS X is not supported by Travis. + # * Docker on Windows seems to not have the correct binary at `"/c/Program Files/Docker/Docker/DockerCli.exe" to switch it to Linux containers. + - if [[ $TRAVIS_OS_NAME == "linux" ]]; then docker run -d --net=host --name pd --rm pingcap/pd --name "pd" --data-dir "pd" --client-urls "http://127.0.0.1:2379" --advertise-client-urls "http://127.0.0.1:2379"; fi + - if [[ $TRAVIS_OS_NAME == "linux" ]]; then docker run -d --net=host --name kv --rm --ulimit nofile=90000:90000 pingcap/tikv --pd-endpoints "127.0.0.1:2379" --addr "127.0.0.1:2378" --data-dir "kv"; fi + - if [[ $TRAVIS_OS_NAME == "linux" ]]; then docker ps; fi + - if [[ $TRAVIS_OS_NAME == "linux" ]]; then docker logs pd; fi + - if [[ $TRAVIS_OS_NAME == "linux" ]]; then docker logs kv; fi + - if [[ $TRAVIS_OS_NAME == "linux" ]]; then PD_ADDR="127.0.0.1:2379" cargo test --all --features integration-tests -- --nocapture; fi From 88731926cc661a83df4ff73420f39453dbc74ea0 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Wed, 30 Jan 2019 00:43:15 +0000 Subject: [PATCH 08/21] Try removing the travis cargo build cache Signed-off-by: Brian Anderson Signed-off-by: Ana Hobden --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b8b5f905..397e7b14 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,6 @@ os: rust: - stable - nightly -cache: cargo env: global: - RUST_BACKTRACE=1 From abcb28f344cb4c5566e1696ced066c7987781c07 Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Mon, 11 Feb 2019 16:59:45 -0800 Subject: [PATCH 09/21] Install protoc Signed-off-by: Ana Hobden --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 397e7b14..064db41f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,8 +16,8 @@ env: install: - if [[ $TRAVIS_RUST_VERSION == "stable" && $TRAVIS_OS_NAME == "linux" ]]; then rustup component add rustfmt; fi - if [[ $TRAVIS_RUST_VERSION == "stable" && $TRAVIS_OS_NAME == "linux" ]]; then rustup component add clippy; fi - - if [[ $TRAVIS_OS_NAME == "windows" ]]; then choco install golang; fi - - if [[ $TRAVIS_OS_NAME == "windows" ]]; then choco install cmake; fi + - if [[ $TRAVIS_OS_NAME == "linux" ]]; then apt0get install protobuf-compiler; fi + - if [[ $TRAVIS_OS_NAME == "windows" ]]; then choco install golang cmake protoc; fi - if [[ $TRAVIS_OS_NAME == "windows" ]]; then export PATH="$PATH:/c/Go/bin/:/c/Program Files/CMake/bin"; fi script: From 10d09c24768ff364081c912ae6070b7335d1ddce Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Tue, 12 Feb 2019 16:21:22 -0800 Subject: [PATCH 10/21] Add some dependencies Signed-off-by: Ana Hobden --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 064db41f..cacfbd70 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,8 +16,8 @@ env: install: - if [[ $TRAVIS_RUST_VERSION == "stable" && $TRAVIS_OS_NAME == "linux" ]]; then rustup component add rustfmt; fi - if [[ $TRAVIS_RUST_VERSION == "stable" && $TRAVIS_OS_NAME == "linux" ]]; then rustup component add clippy; fi - - if [[ $TRAVIS_OS_NAME == "linux" ]]; then apt0get install protobuf-compiler; fi - - if [[ $TRAVIS_OS_NAME == "windows" ]]; then choco install golang cmake protoc; fi + - if [[ $TRAVIS_OS_NAME == "linux" ]]; then apt-get install protobuf-compiler; fi + - if [[ $TRAVIS_OS_NAME == "windows" ]]; then choco install golang cmake strawberryperl protoc; fi - if [[ $TRAVIS_OS_NAME == "windows" ]]; then export PATH="$PATH:/c/Go/bin/:/c/Program Files/CMake/bin"; fi script: From 63b9a172e91ed57e51c5977087e7b6f113131604 Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Thu, 14 Feb 2019 09:49:54 -0800 Subject: [PATCH 11/21] Try to get windows to detect environment properly Signed-off-by: Ana Hobden --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index cacfbd70..12e057a2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,6 +18,7 @@ install: - if [[ $TRAVIS_RUST_VERSION == "stable" && $TRAVIS_OS_NAME == "linux" ]]; then rustup component add clippy; fi - if [[ $TRAVIS_OS_NAME == "linux" ]]; then apt-get install protobuf-compiler; fi - if [[ $TRAVIS_OS_NAME == "windows" ]]; then choco install golang cmake strawberryperl protoc; fi + - if [[ $TRAVIS_OS_NAME == "windows" ]]; then refreshenv; fi - if [[ $TRAVIS_OS_NAME == "windows" ]]; then export PATH="$PATH:/c/Go/bin/:/c/Program Files/CMake/bin"; fi script: From 58c1e8437a4d5b41c6be461f77be20ab3fec3b42 Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Thu, 14 Feb 2019 10:31:39 -0800 Subject: [PATCH 12/21] Sudo is disabled on linux Signed-off-by: Ana Hobden --- .travis.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 12e057a2..90e120c1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ sudo: false language: rust os: - linux - - windows + # - windows - osx rust: - stable @@ -13,12 +13,15 @@ env: - RUST_BACKTRACE=1 - RUSTFLAGS="-D warnings" +addons: + apt: + packages: + - protobuf-compiler + install: - if [[ $TRAVIS_RUST_VERSION == "stable" && $TRAVIS_OS_NAME == "linux" ]]; then rustup component add rustfmt; fi - if [[ $TRAVIS_RUST_VERSION == "stable" && $TRAVIS_OS_NAME == "linux" ]]; then rustup component add clippy; fi - - if [[ $TRAVIS_OS_NAME == "linux" ]]; then apt-get install protobuf-compiler; fi - if [[ $TRAVIS_OS_NAME == "windows" ]]; then choco install golang cmake strawberryperl protoc; fi - - if [[ $TRAVIS_OS_NAME == "windows" ]]; then refreshenv; fi - if [[ $TRAVIS_OS_NAME == "windows" ]]; then export PATH="$PATH:/c/Go/bin/:/c/Program Files/CMake/bin"; fi script: From 1c2b77135069989491580a89a51907ac81a6e4fa Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Thu, 14 Feb 2019 13:57:40 -0800 Subject: [PATCH 13/21] Add updated ubuntu package Signed-off-by: Ana Hobden --- .travis.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 90e120c1..87f780a9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,8 +15,11 @@ env: addons: apt: + update: true + sources: + - sourceline: 'ppa:maarten-fonville/protobuf' packages: - - protobuf-compiler + - protobuf install: - if [[ $TRAVIS_RUST_VERSION == "stable" && $TRAVIS_OS_NAME == "linux" ]]; then rustup component add rustfmt; fi From 62f67067f15de9e6fb9e4f6b63d9148d2b640a94 Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Thu, 14 Feb 2019 13:59:09 -0800 Subject: [PATCH 14/21] Note why windows is disabled Signed-off-by: Ana Hobden --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 87f780a9..4713efb5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ sudo: false language: rust os: - linux - # - windows + # - windows # TODO: https://github.com/pingcap/kvproto/issues/355 - osx rust: - stable From 188d43042c6e7f50e112013e34d0b118db8a0fdb Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Thu, 14 Feb 2019 14:06:32 -0800 Subject: [PATCH 15/21] Correct pkg name Signed-off-by: Ana Hobden --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 4713efb5..3911c364 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,7 +19,7 @@ addons: sources: - sourceline: 'ppa:maarten-fonville/protobuf' packages: - - protobuf + - protobuf-compiler install: - if [[ $TRAVIS_RUST_VERSION == "stable" && $TRAVIS_OS_NAME == "linux" ]]; then rustup component add rustfmt; fi From 1c5fab43b6ee945b85d162d02a1f3ddacb5caace Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Thu, 14 Feb 2019 14:09:13 -0800 Subject: [PATCH 16/21] Add mac dependencies Signed-off-by: Ana Hobden --- .travis.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.travis.yml b/.travis.yml index 3911c364..e78fb360 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,6 +20,11 @@ addons: - sourceline: 'ppa:maarten-fonville/protobuf' packages: - protobuf-compiler + homebrew: + packages: + - protobuf + - cmake + - go install: - if [[ $TRAVIS_RUST_VERSION == "stable" && $TRAVIS_OS_NAME == "linux" ]]; then rustup component add rustfmt; fi From 559e915063746865a766d8800b28f8494ae6a33e Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Mon, 25 Feb 2019 08:42:49 -0800 Subject: [PATCH 17/21] Resolve lint Signed-off-by: Ana Hobden --- src/rpc/tikv/client.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpc/tikv/client.rs b/src/rpc/tikv/client.rs index b1f468fb..cc5f27b3 100644 --- a/src/rpc/tikv/client.rs +++ b/src/rpc/tikv/client.rs @@ -46,7 +46,7 @@ impl From for Error { } else if e.has_region_not_found() { Error::region_not_found(e.get_region_not_found().get_region_id(), Some(message)) } else if e.has_key_not_in_region() { - let mut e = e.take_key_not_in_region(); + let e = e.take_key_not_in_region(); Error::key_not_in_region(e) } else if e.has_epoch_not_match() { Error::stale_epoch(Some(format!( From d28adbd22ce1371b400db8e915cf63073daac0eb Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Mon, 25 Feb 2019 08:47:15 -0800 Subject: [PATCH 18/21] Allow unused code in select places Signed-off-by: Ana Hobden --- src/rpc/client.rs | 3 +++ src/rpc/pd/mod.rs | 3 +++ src/rpc/tikv/client.rs | 3 +++ 3 files changed, 9 insertions(+) diff --git a/src/rpc/client.rs b/src/rpc/client.rs index fc3db470..f7bdabf4 100644 --- a/src/rpc/client.rs +++ b/src/rpc/client.rs @@ -11,6 +11,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +// TODO: Remove this when txn is done. +#![allow(dead_code)] + use std::{ collections::HashMap, fmt, diff --git a/src/rpc/pd/mod.rs b/src/rpc/pd/mod.rs index 0fc3ab36..c83993c4 100644 --- a/src/rpc/pd/mod.rs +++ b/src/rpc/pd/mod.rs @@ -11,6 +11,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +// TODO: Remove this when txn is done. +#![allow(dead_code)] + use std::ops::{Deref, DerefMut}; use kvproto::{kvrpcpb, metapb}; diff --git a/src/rpc/tikv/client.rs b/src/rpc/tikv/client.rs index cc5f27b3..50ec3f99 100644 --- a/src/rpc/tikv/client.rs +++ b/src/rpc/tikv/client.rs @@ -11,6 +11,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +// TODO: Remove this when txn is done. +#![allow(dead_code)] + use std::{fmt, sync::Arc, time::Duration}; use futures::Future; From c212a6b2cad4ff0056e3b5fc7e54abf5ec41cb5a Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Mon, 25 Feb 2019 08:55:25 -0800 Subject: [PATCH 19/21] fmt Signed-off-by: Ana Hobden --- examples/raw.rs | 10 ++-------- src/lib.rs | 1 - src/rpc/tikv/client.rs | 2 +- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/examples/raw.rs b/examples/raw.rs index 291e6be5..da1ab3c3 100644 --- a/examples/raw.rs +++ b/examples/raw.rs @@ -62,10 +62,7 @@ fn main() -> Result<()> { // You can also set the `ColumnFamily` used by the request. // This is *advanced usage* and should have some special considerations. - client - .delete(KEY) - .wait() - .expect("Could not delete value"); + client.delete(KEY).wait().expect("Could not delete value"); println!("Key: {:?} deleted", Key::from(KEY)); // Here we check if the key has been deleted from the key-value store. @@ -82,10 +79,7 @@ fn main() -> Result<()> { KvPair::from(("k2", "v2")), KvPair::from(("k3", "v3")), ]; - client - .batch_put(pairs) - .wait() - .expect("Could not put pairs"); + client.batch_put(pairs).wait().expect("Could not put pairs"); // Same thing when you want to retrieve multiple values. let keys = vec![Key::from("k1"), Key::from("k2")]; diff --git a/src/lib.rs b/src/lib.rs index 9a63c6c8..5a12bb42 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -360,7 +360,6 @@ impl fmt::Debug for Value { Ok(s) => write!(f, "Value({:?})", s), Err(_) => write!(f, "Value({})", HexRepr(&self.0)), } - } } diff --git a/src/rpc/tikv/client.rs b/src/rpc/tikv/client.rs index 50ec3f99..01a6c555 100644 --- a/src/rpc/tikv/client.rs +++ b/src/rpc/tikv/client.rs @@ -136,7 +136,7 @@ macro_rules! has_str_error { if self.get_error().is_empty() { None } else { - Some(Error::kv_error(self.take_error()) ) + Some(Error::kv_error(self.take_error())) } } } From 929dda1eaa6c483267a618e03a7a73cbfd9a18c9 Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Mon, 25 Feb 2019 09:22:24 -0800 Subject: [PATCH 20/21] Use raft 0.5.0 branch Signed-off-by: Ana Hobden --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 6b4b7910..ba034ccc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,7 +32,7 @@ failure = "0.1" [dependencies.kvproto] git = "https://github.com/pingcap/kvproto.git" -rev = "f9b9e7d362c7cc2c90202fc7c300b2e466cbfbf2" +branch = "raft-0.5.0" [dependencies.prometheus] version = "0.4.2" From 5a01eacd085b900aa7dc43b4da23ae9803d9a9f4 Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Mon, 25 Feb 2019 10:08:14 -0800 Subject: [PATCH 21/21] Remove AppVeyor, don't need it. Signed-off-by: Ana Hobden --- appveyor.yml | 32 -------------------------------- 1 file changed, 32 deletions(-) delete mode 100644 appveyor.yml diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 9f9bfcb3..00000000 --- a/appveyor.yml +++ /dev/null @@ -1,32 +0,0 @@ -branches: - only: - # This is where pull requests from "bors r+" are built. - - staging - # This is where pull requests from "bors try" are built. - - trying - # Enable building pull requests. - - master - -environment: - matrix: - - TARGET: x86_64-pc-windows-gnu - RUST_VERSION: stable - - TARGET: x86_64-pc-windows-gnu - RUST_VERSION: nightly - -install: - - curl -sSf -o rustup-init.exe https://win.rustup.rs/ - - rustup-init.exe -y --default-host %TARGET% --default-toolchain %RUST_VERSION% - - set PATH=%PATH%;C:\Users\appveyor\.cargo\bin - - rustc -Vv - - cargo -V - -# Building is done in the test phase, so we disable Appveyor's build phase. -build: false - -cache: - - C:\Users\appveyor\.cargo\registry - - target - -test_script: - - cargo test