feat: run tests on all workspaces and lints
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed

This commit is contained in:
Aravinth Manivannan 2022-12-12 15:15:11 +05:30
parent 4db76a0705
commit 96c1b807a7
Signed by: realaravinth
GPG key ID: AD9F0F08E855ED88
2 changed files with 21 additions and 16 deletions

View file

@ -1,3 +1,12 @@
define lint
cargo fmt -v --all -- --emit files
cargo clippy --workspace --tests --all-features
endef
define test
cargo test --no-fail-fast --workspace --tests --all-features
endef
default: ## Build app in debug mode default: ## Build app in debug mode
cargo build cargo build
@ -25,8 +34,10 @@ env: ## Setup development environtment
cargo fetch cargo fetch
lint: ## Lint codebase lint: ## Lint codebase
cargo fmt -v --all -- --emit files $(call lint)
cargo clippy --workspace --tests --all-features cd env/dummy_conductor && $(call lint)
cd env/nginx_bind_le && $(call lint)
cd env/libconductor && $(call lint)
#migrate: ## run migrations #migrate: ## run migrations
# unset DATABASE_URL && cargo build # unset DATABASE_URL && cargo build
@ -45,7 +56,9 @@ run: ## Run app in debug mode
# --all-features # --all-features
test: ## Run all available tests test: ## Run all available tests
cargo test --no-fail-fast --workspace $(call test)
cd env/dummy_conductor && $(call test)
cd env/nginx_bind_le && $(call test)
xml-test-coverage: ## Generate code coverage report in XML format xml-test-coverage: ## Generate code coverage report in XML format
cargo tarpaulin -t 1200 --out Xml cargo tarpaulin -t 1200 --out Xml

View file

@ -111,26 +111,18 @@ mod tests {
) )
.await; .await;
let resp = test::call_service( let resp =
&app, test::call_service(&app, test::TestRequest::get().uri(DOCS.home).to_request()).await;
test::TestRequest::get().uri(DOCS.home).to_request(),
)
.await;
assert_eq!(resp.status(), StatusCode::OK); assert_eq!(resp.status(), StatusCode::OK);
let resp = test::call_service( let resp =
&app, test::call_service(&app, test::TestRequest::get().uri(DOCS.spec).to_request()).await;
test::TestRequest::get().uri(DOCS.spec).to_request(),
)
.await;
assert_eq!(resp.status(), StatusCode::OK); assert_eq!(resp.status(), StatusCode::OK);
let uri = format!("{}/{}", DOCS.home, "favicon-32x32.png"); let uri = format!("{}/{}", DOCS.home, "favicon-32x32.png");
println!("{uri}"); println!("{uri}");
let resp = let resp = test::call_service(&app, test::TestRequest::get().uri(&uri).to_request()).await;
test::call_service(&app, test::TestRequest::get().uri(&uri).to_request())
.await;
assert_eq!(resp.status(), StatusCode::OK); assert_eq!(resp.status(), StatusCode::OK);
} }
} }