From 4adfd1a75f06aa034e4bda641516b1627f5804ee Mon Sep 17 00:00:00 2001 From: nathan Date: Tue, 14 Mar 2023 14:45:53 +0800 Subject: [PATCH] ci: fix test --- .env | 2 +- .github/workflows/ci.yml | 4 ++-- Cargo.lock | 8 ++++---- Cargo.toml | 2 +- Makefile | 2 +- configuration/base.yaml | 2 +- docker-compose.yml | 4 ++-- src/component/auth/password.rs | 4 ++-- src/component/auth/user.rs | 2 +- tests/api/test_server.rs | 2 +- 10 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.env b/.env index bc1ad643..6014597d 100644 --- a/.env +++ b/.env @@ -1 +1 @@ -DATABASE_URL="postgres://postgres:password@localhost:5433/appflowy_pg" \ No newline at end of file +DATABASE_URL="postgres://postgres:password@localhost:5432/appflowy_pg" \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 29104c90..75420300 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,7 +24,7 @@ jobs: POSTGRES_PASSWORD: password POSTGRES_DB: postgres ports: - - 5433:5432 + - 5432:5432 redis: image: redis:7 ports: @@ -75,7 +75,7 @@ jobs: POSTGRES_PASSWORD: password POSTGRES_DB: postgres ports: - - 5433:5432 + - 5432:5432 steps: - uses: actions/checkout@v3 - uses: dtolnay/rust-toolchain@stable diff --git a/Cargo.lock b/Cargo.lock index f0b696a2..92537f51 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -461,9 +461,9 @@ checksum = "bddcadddf5e9015d310179a59bb28c4d4b9920ad0f11e8e14dbadf654890c9a6" [[package]] name = "argon2" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db4ce4441f99dbd377ca8a8f57b698c44d0d6e712d8329b5040da5a64aa1ce73" +checksum = "95c2fcf79ad1932ac6269a738109997a83c227c09b75842ae564dc8ede6a861c" dependencies = [ "base64ct", "blake2", @@ -1823,9 +1823,9 @@ dependencies = [ [[package]] name = "password-hash" -version = "0.4.2" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7676374caaee8a325c9e7a2ae557f216c5563a171d6997b0ef8a65af35147700" +checksum = "346f04948ba92c43e8469c1ee6736c7563d71012b17d40745260fe106aac2166" dependencies = [ "base64ct", "rand_core", diff --git a/Cargo.toml b/Cargo.toml index 00d13884..45e1b66a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -37,7 +37,7 @@ once_cell = "1.13.0" chrono = { version = "0.4.23", features = ["serde"] } derive_more = {version = "0.99"} uuid = { version = "1", features = ["v4", "serde"] } -argon2 = { version = "0.4", features = ["std"] } +argon2 = { version = "0.5", features = ["std"] } secrecy = { version = "0.8", features = ["serde"] } rand = { version = "0.8", features=["std_rng"] } anyhow = "1.0.40" diff --git a/Makefile b/Makefile index 37aa6231..998288f0 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ SEMVER_VERSION=$(shell grep version Cargo.toml | awk -F"\"" '{print $$2}' | head .PHONY: init_database docker_image local_server docker_test init_database: - POSTGRES_PORT=5433 ${ROOT}/init_database.sh + POSTGRES_PORT=5432 ${ROOT}/init_database.sh docker_image: source $(ROOT)/docker_env.sh && docker-compose up -d postgres_db diff --git a/configuration/base.yaml b/configuration/base.yaml index e61a2e43..ff4a9b33 100644 --- a/configuration/base.yaml +++ b/configuration/base.yaml @@ -4,7 +4,7 @@ application: secret_key: "d8b242c8a47de60e1ebf4e6bb7d3315cdd4b4071919fe1065566f23a354753ae" database: host: "localhost" - port: 5433 + port: 5432 username: "postgres" password: "password" database_name: "appflowy_pg" diff --git a/docker-compose.yml b/docker-compose.yml index a5ca5d57..e4d705a1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,13 +1,13 @@ version: '3' services: postgres_db: - image: 'postgres:9.6-alpine' + image: postgres:14 environment: - POSTGRES_USER=${POSTGRES_USER} - POSTGRES_DB=${POSTGRES_DB} - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} ports: - - "5434:5432" + - "5432:5432" appflowy_server: restart: on-failure environment: diff --git a/src/component/auth/password.rs b/src/component/auth/password.rs index d76ec71f..38152711 100644 --- a/src/component/auth/password.rs +++ b/src/component/auth/password.rs @@ -12,7 +12,7 @@ pub struct Credentials { pub password: Secret, } -#[tracing::instrument(skip(credentials, pool))] +#[tracing::instrument(level = "debug", skip(credentials, pool))] pub async fn validate_credentials( credentials: Credentials, pool: &PgPool, @@ -54,7 +54,7 @@ pub fn compute_hash_password(password: &[u8]) -> Result, anyhow:: Ok(Secret::new(password)) } -#[tracing::instrument(skip(email, pool))] +#[tracing::instrument(level = "debug", skip(email, pool))] async fn get_stored_credentials( email: &str, pool: &PgPool, diff --git a/src/component/auth/user.rs b/src/component/auth/user.rs index 771c3038..5eb45717 100644 --- a/src/component/auth/user.rs +++ b/src/component/auth/user.rs @@ -139,7 +139,7 @@ pub async fn change_password( err: format!("{}", e), })?; // Save password to disk - let sql = "update users set password = ? where uid = ?"; + let sql = "UPDATE users SET password = $1 where uid = $2"; let _ = sqlx::query(sql) .bind(new_hash_password.expose_secret()) .bind(uid) diff --git a/tests/api/test_server.rs b/tests/api/test_server.rs index 70e354af..4ecf1c75 100644 --- a/tests/api/test_server.rs +++ b/tests/api/test_server.rs @@ -10,7 +10,7 @@ use sqlx::{Connection, Executor, PgConnection, PgPool}; // Ensure that the `tracing` stack is only initialised once using `once_cell` static TRACING: Lazy<()> = Lazy::new(|| { - let level = "trace".to_string(); + let level = "info".to_string(); let mut filters = vec![]; filters.push(format!("appflowy_server={}", level)); filters.push(format!("hyper={}", level));