ci: fix test

This commit is contained in:
nathan 2023-03-14 14:45:53 +08:00
parent aca7e8737e
commit 4adfd1a75f
10 changed files with 16 additions and 16 deletions

2
.env
View file

@ -1 +1 @@
DATABASE_URL="postgres://postgres:password@localhost:5433/appflowy_pg"
DATABASE_URL="postgres://postgres:password@localhost:5432/appflowy_pg"

View file

@ -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

8
Cargo.lock generated
View file

@ -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",

View file

@ -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"

View file

@ -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

View file

@ -4,7 +4,7 @@ application:
secret_key: "d8b242c8a47de60e1ebf4e6bb7d3315cdd4b4071919fe1065566f23a354753ae"
database:
host: "localhost"
port: 5433
port: 5432
username: "postgres"
password: "password"
database_name: "appflowy_pg"

View file

@ -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:

View file

@ -12,7 +12,7 @@ pub struct Credentials {
pub password: Secret<String>,
}
#[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<Secret<String>, 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,

View file

@ -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)

View file

@ -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));