fix backend tests

This commit is contained in:
Ruben Fiszel
2023-04-09 11:20:15 +02:00
parent dac61d1c98
commit 1ffed41cf9
4 changed files with 27 additions and 5 deletions
+1
View File
@@ -4873,6 +4873,7 @@ dependencies = [
"rand 0.8.5",
"reqwest",
"rsa",
"serde",
"serde_json",
"sha2 0.10.6",
"sqlx",
+2
View File
@@ -49,11 +49,13 @@ rsa.workspace = true
base64.workspace = true
sha2.workspace = true
[dev-dependencies]
serde_json.workspace = true
reqwest.workspace = true
windmill-queue.workspace = true
axum.workspace = true
serde.workspace = true
[workspace.dependencies]
windmill-api = { path = "./windmill-api" }
+23 -4
View File
@@ -1,4 +1,5 @@
use futures::{stream, Stream};
use serde::Deserialize;
use serde_json::json;
use sqlx::{postgres::PgListener, types::Uuid, Pool, Postgres, Transaction};
use windmill_api::jobs::{CompletedJob, Job};
@@ -1518,6 +1519,8 @@ async fn test_go_job(db: Pool<Postgres>) {
let port = server.addr.port();
let content = r#"
package inner
import "fmt"
func main(derp string) (string, error) {
@@ -2024,6 +2027,16 @@ async fn test_branchall_simple(db: Pool<Postgres>) {
assert_eq!(result, serde_json::json!([[1, 2], [1, 3]]));
}
#[derive(Deserialize)]
struct ErrorResult {
error: NamedError,
}
#[derive(Deserialize)]
struct NamedError {
name: String,
}
#[sqlx::test(fixtures("base"))]
async fn test_branchall_skip_failure(db: Pool<Postgres>) {
initialize_tracing().await;
@@ -2059,8 +2072,11 @@ async fn test_branchall_skip_failure(db: Pool<Postgres>) {
.unwrap();
assert_eq!(
result,
serde_json::json!([{"error": {"name": "Error", "stack": "Error: failure\n at main (file:///tmp/main.ts:1:31)\n at run (file:///tmp/wrapper.ts:9:26)\n at file:///tmp/wrapper.ts:14:1", "message": "failure"}}, [1,3]])
serde_json::from_value::<ErrorResult>(result)
.unwrap()
.error
.name,
"Error"
);
let flow: FlowValue = serde_json::from_value(json!({
@@ -2093,8 +2109,11 @@ async fn test_branchall_skip_failure(db: Pool<Postgres>) {
.unwrap();
assert_eq!(
result,
serde_json::json!([ {"error": {"name": "Error", "stack": "Error: failure\n at main (file:///tmp/main.ts:1:31)\n at run (file:///tmp/wrapper.ts:9:26)\n at file:///tmp/wrapper.ts:14:1", "message": "failure"}}, [1, 2]])
serde_json::from_value::<ErrorResult>(result)
.unwrap()
.error
.name,
"Error"
);
}
@@ -331,7 +331,7 @@
startIcon={{ icon: faArrowLeft }}
href="/scripts/get/{script.parent_hashes[0]}?workspace_id={$workspaceStore}"
dropdownItems={script.parent_hashes.map((hash) => ({
href: `/scripts/get/${hash}?workspace_id={$workspaceStore}`,
href: `/scripts/get/${hash}?workspace_id=${$workspaceStore}`,
label: hash
}))}
>