From 1f04f2ba6f5138dcd61d686cc35dea611e23f7dd Mon Sep 17 00:00:00 2001 From: nick Date: Mon, 16 Oct 2023 17:59:09 -0700 Subject: [PATCH 1/8] Create examples.yml --- .github/workflows/examples.yml | 89 ++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 .github/workflows/examples.yml diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml new file mode 100644 index 0000000000..d4186fd9c2 --- /dev/null +++ b/.github/workflows/examples.yml @@ -0,0 +1,89 @@ +name: Examples + +on: + push: + branches: + - main + - 'branch-*' + pull_request: + branches: + - main + - 'branch-*' + +env: + CARGO_TERM_COLOR: always + RUST_BACKTRACE: full + +jobs: + tls: + runs-on: ubuntu-latest + timeout-minutes: 60 + services: + scylladb: + image: scylladb/scylla-tls + ports: + - 9042:9042 + - 9142:9142 + options: + --health-cmd "cqlsh --debug" + --health-interval 5s + --health-retries 10 + env: + working-directory: ./scylla + steps: + - uses: actions/checkout@v3 + - name: Check + run: cargo check --verbose --features "ssl" + working-directory: ${{env.working-directory}} + - name: Run allocations example + run: cargo run --example allocations + - name: Run auth example + run: cargo run --example auth + - name: Run basic example + run: cargo run --example basic + - name: Run cloud example + run: cargo run --example cloud + - name: Run compare-tokens example + run: cargo run --example compare-tokens + - name: Run config-data example + run: cargo run --example config-data + - name: Run cql-time-types example + run: cargo run --example cql-time-types + - name: Run cqlsh-rs example + run: cargo run --example cqlsh-rs + - name: Run custom_deserialization example + run: cargo run --example custom_deserialization + - name: Run custom_load_balancing_policy example + run: cargo run --example custom_load_balancing_policy + - name: Run execution_profile example + run: cargo run --example execution_profile + - name: Run get_by_name example + run: cargo run --example get_by_name + - name: Run logging example + run: cargo run --example logging + - name: Run parallel-prepared example + run: cargo run --example parallel-prepared + - name: Run parallel example + run: cargo run --example parallel + - name: Run query_history example + run: cargo run --example query_history + - name: Run custom_load_balancing_policy example + run: cargo run --example custom_load_balancing_policy + - name: Run schema_agreement example + run: cargo run --example schema_agreement + - name: Run select-paging example + run: cargo run --example select-paging + - name: Run select-paging example + run: cargo run --example select-paging + - name: Run speculative-execution example + run: cargo run --example speculative-execution + - name: Run tls example + run: cargo run --example tls + - name: Run tower example + run: cargo run --example tower + - name: Run custom_load_balancing_policy example + run: cargo run --example custom_load_balancing_policy + - name: Run user-defined-type example + run: cargo run --example user-defined-type + - name: Run value_list example + run: cargo run --example value_list From dea71b086820e471cf3727fed57f2724a38cf13c Mon Sep 17 00:00:00 2001 From: nick Date: Mon, 16 Oct 2023 18:05:15 -0700 Subject: [PATCH 2/8] Update examples.yml --- .github/workflows/examples.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index d4186fd9c2..c05c0177f2 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -41,8 +41,8 @@ jobs: run: cargo run --example auth - name: Run basic example run: cargo run --example basic - - name: Run cloud example - run: cargo run --example cloud + # - name: Run cloud example + # run: cargo run --example cloud - name: Run compare-tokens example run: cargo run --example compare-tokens - name: Run config-data example From 27b6108b530f7e92a9a82a861cb47342aa26bcf7 Mon Sep 17 00:00:00 2001 From: nick Date: Mon, 16 Oct 2023 18:19:36 -0700 Subject: [PATCH 3/8] Update examples.yml --- .github/workflows/examples.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index c05c0177f2..6ba1082796 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -43,8 +43,8 @@ jobs: run: cargo run --example basic # - name: Run cloud example # run: cargo run --example cloud - - name: Run compare-tokens example - run: cargo run --example compare-tokens + # - name: Run compare-tokens example + # run: cargo run --example compare-tokens - name: Run config-data example run: cargo run --example config-data - name: Run cql-time-types example From fdf8dc5f52c2706d7095a23a8070510ba283ec1e Mon Sep 17 00:00:00 2001 From: nick Date: Mon, 16 Oct 2023 18:27:26 -0700 Subject: [PATCH 4/8] Update examples.yml --- .github/workflows/examples.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index 6ba1082796..8f4d6ce2f2 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -15,7 +15,7 @@ env: RUST_BACKTRACE: full jobs: - tls: + Examples: runs-on: ubuntu-latest timeout-minutes: 60 services: @@ -45,8 +45,6 @@ jobs: # run: cargo run --example cloud # - name: Run compare-tokens example # run: cargo run --example compare-tokens - - name: Run config-data example - run: cargo run --example config-data - name: Run cql-time-types example run: cargo run --example cql-time-types - name: Run cqlsh-rs example From 2181491388ef102ce2222c8a76e637d38f4f7aa4 Mon Sep 17 00:00:00 2001 From: nick Date: Mon, 16 Oct 2023 18:42:44 -0700 Subject: [PATCH 5/8] Update examples.yml --- .github/workflows/examples.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index 8f4d6ce2f2..eb87090bf0 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -49,8 +49,8 @@ jobs: run: cargo run --example cql-time-types - name: Run cqlsh-rs example run: cargo run --example cqlsh-rs - - name: Run custom_deserialization example - run: cargo run --example custom_deserialization + # - name: Run custom_deserialization example + # run: cargo run --example custom_deserialization - name: Run custom_load_balancing_policy example run: cargo run --example custom_load_balancing_policy - name: Run execution_profile example From fb622bbab7f1a44770c3ea9af8a29514e4634c70 Mon Sep 17 00:00:00 2001 From: nick Date: Mon, 16 Oct 2023 19:05:38 -0700 Subject: [PATCH 6/8] Update examples.yml --- .github/workflows/examples.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index eb87090bf0..b8864ea37d 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -53,8 +53,8 @@ jobs: # run: cargo run --example custom_deserialization - name: Run custom_load_balancing_policy example run: cargo run --example custom_load_balancing_policy - - name: Run execution_profile example - run: cargo run --example execution_profile + # - name: Run execution_profile example + # run: cargo run --example execution_profile - name: Run get_by_name example run: cargo run --example get_by_name - name: Run logging example From d537d6ce847e10307bad9c49f2b99000f1f592ca Mon Sep 17 00:00:00 2001 From: nick Date: Mon, 16 Oct 2023 19:41:20 -0700 Subject: [PATCH 7/8] Update examples.yml From 236de78363b900ce0186c62d8abd583f3618e975 Mon Sep 17 00:00:00 2001 From: Nick Sippl-Swezey Date: Mon, 16 Oct 2023 19:41:57 -0700 Subject: [PATCH 8/8] Update broken examples --- examples/compare-tokens.rs | 8 ++++---- examples/custom_deserialization.rs | 8 ++++---- examples/execution_profile.rs | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/examples/compare-tokens.rs b/examples/compare-tokens.rs index 5c56aa5f4d..9b2c18b7d7 100644 --- a/examples/compare-tokens.rs +++ b/examples/compare-tokens.rs @@ -17,16 +17,16 @@ async fn main() -> Result<()> { session .query( - "CREATE TABLE IF NOT EXISTS ks.t (pk bigint primary key)", + "CREATE TABLE IF NOT EXISTS ks.compare_tokens_example (pk bigint primary key)", &[], ) .await?; - let prepared = session.prepare("INSERT INTO ks.t (pk) VALUES (?)").await?; + let prepared = session.prepare("INSERT INTO ks.compare_tokens_example (pk) VALUES (?)").await?; for pk in (0..100_i64).chain(99840..99936_i64) { session - .query("INSERT INTO ks.t (pk) VALUES (?)", (pk,)) + .query("INSERT INTO ks.compare_tokens_example (pk) VALUES (?)", (pk,)) .await?; let serialized_pk = (pk,).serialized()?.into_owned(); @@ -43,7 +43,7 @@ async fn main() -> Result<()> { ); let qt = session - .query(format!("SELECT token(pk) FROM ks.t where pk = {}", pk), &[]) + .query(format!("SELECT token(pk) FROM ks.compare_tokens_example where pk = {}", pk), &[]) .await? .rows .unwrap() diff --git a/examples/custom_deserialization.rs b/examples/custom_deserialization.rs index 122c842bb8..88b7b72d6f 100644 --- a/examples/custom_deserialization.rs +++ b/examples/custom_deserialization.rs @@ -16,13 +16,13 @@ async fn main() -> Result<()> { session.query("CREATE KEYSPACE IF NOT EXISTS ks WITH REPLICATION = {'class' : 'NetworkTopologyStrategy', 'replication_factor' : 1}", &[]).await?; session .query( - "CREATE TABLE IF NOT EXISTS ks.t (pk int PRIMARY KEY, v text)", + "CREATE TABLE IF NOT EXISTS ks.custom_deserialization_test (pk int primary key, v text)", &[], ) .await?; session - .query("INSERT INTO ks.t (pk, v) VALUES (1, 'asdf')", ()) + .query("INSERT INTO ks.custom_deserialization_test (pk, v) VALUES (1, 'asdf')", ()) .await?; // You can implement FromCqlVal for your own types @@ -38,7 +38,7 @@ async fn main() -> Result<()> { } let (v,) = session - .query("SELECT v FROM ks.t WHERE pk = 1", ()) + .query("SELECT v FROM ks.custom_deserialization_test WHERE pk = 1", ()) .await? .single_row_typed::<(MyType,)>()?; assert_eq!(v, MyType("asdf".to_owned())); @@ -62,7 +62,7 @@ async fn main() -> Result<()> { impl_from_cql_value_from_method!(MyOtherType, into_my_other_type); let (v,) = session - .query("SELECT v FROM ks.t WHERE pk = 1", ()) + .query("SELECT v FROM ks.custom_deserialization_test WHERE pk = 1", ()) .await? .single_row_typed::<(MyOtherType,)>()?; assert_eq!(v, MyOtherType("asdf".to_owned())); diff --git a/examples/execution_profile.rs b/examples/execution_profile.rs index d8d1b1eed9..13bb44e0e6 100644 --- a/examples/execution_profile.rs +++ b/examples/execution_profile.rs @@ -18,7 +18,7 @@ async fn main() -> Result<()> { println!("Connecting to {} ...", uri); let profile1 = ExecutionProfile::builder() - .consistency(Consistency::EachQuorum) + .consistency(Consistency::LocalQuorum) .serial_consistency(Some(SerialConsistency::Serial)) .request_timeout(Some(Duration::from_secs(42))) .load_balancing_policy(Arc::new(load_balancing::DefaultPolicy::default()))