From 3464041b801ebc6051f2f4208bc2ef05ec4a809b Mon Sep 17 00:00:00 2001 From: asledz Date: Thu, 25 Mar 2021 02:11:20 +0100 Subject: [PATCH] Add authenticate test to CI. Add authenticate test to github actions --- .github/workflows/authenticate_test.yml | 27 +++++++++++++++++++++++ scylla/src/transport/authenticate_test.rs | 22 ++++++++++++++++++ scylla/src/transport/mod.rs | 1 + 3 files changed, 50 insertions(+) create mode 100644 .github/workflows/authenticate_test.yml create mode 100644 scylla/src/transport/authenticate_test.rs diff --git a/.github/workflows/authenticate_test.yml b/.github/workflows/authenticate_test.yml new file mode 100644 index 0000000000..7727dc472d --- /dev/null +++ b/.github/workflows/authenticate_test.yml @@ -0,0 +1,27 @@ +name: Authenticate + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +env: + CARGO_TERM_COLOR: always + +jobs: + # PasswordAuthenticator + build: + runs-on: ubuntu-latest + services: + scylladb: + image: cvybhu/scylla-passauth + ports: + - 9042:9042 + options: --health-cmd "cqlsh --username cassandra --password cassandra --debug" --health-interval 5s --health-retries 30 + volumes: + - ${{ github.workspace }}:/workspace + steps: + - uses: actions/checkout@v2 + - name: Run tests + run: cargo test --verbose -- --ignored \ No newline at end of file diff --git a/scylla/src/transport/authenticate_test.rs b/scylla/src/transport/authenticate_test.rs new file mode 100644 index 0000000000..2f93fa8d60 --- /dev/null +++ b/scylla/src/transport/authenticate_test.rs @@ -0,0 +1,22 @@ +#[tokio::test] +#[ignore] +async fn authenticate_superuser() { + let uri = std::env::var("SCYLLA_URI").unwrap_or_else(|_| "127.0.0.1:9042".to_string()); + + println!("Connecting to {} with cassandra superuser ...", uri); + + let session = crate::SessionBuilder::new() + .known_node(uri) + .user("cassandra", "cassandra") + .build() + .await + .unwrap(); + + session.query("CREATE KEYSPACE IF NOT EXISTS ks WITH REPLICATION = {'class' : 'SimpleStrategy', 'replication_factor' : 1}", &[]).await.unwrap(); + session + .query("DROP TABLE IF EXISTS ks.t;", &[]) + .await + .unwrap(); + + println!("Ok."); +} diff --git a/scylla/src/transport/mod.rs b/scylla/src/transport/mod.rs index 6f9b935db2..59bb56a242 100644 --- a/scylla/src/transport/mod.rs +++ b/scylla/src/transport/mod.rs @@ -12,6 +12,7 @@ pub mod errors; pub mod iterator; mod metrics; +mod authenticate_test; #[cfg(test)] mod session_test;