mirror of https://github.com/buster-so/buster.git
api, cli, web, tsting env and some rust fixes
This commit is contained in:
parent
0c5c9eafff
commit
19eea365a4
|
@ -13,6 +13,7 @@ on:
|
|||
jobs:
|
||||
test:
|
||||
runs-on: blacksmith-16vcpu-ubuntu-2204
|
||||
environment: testing
|
||||
|
||||
# Service container for Redis (needed by the setup action)
|
||||
services:
|
||||
|
@ -42,9 +43,9 @@ jobs:
|
|||
# Use hardcoded default values and secrets
|
||||
DATABASE_URL: postgres://postgres:postgres@127.0.0.1:54322/postgres
|
||||
REDIS_URL: redis://localhost:6379 # Connect to the Redis service container
|
||||
JWT_SECRET: ${{ secrets.GH_ACTIONS_SUPABASE_JWT_SECRET }} # Use secret
|
||||
JWT_SECRET: 'super-secret-jwt-token-with-at-least-32-characters-long' # Use default local value
|
||||
SUPABASE_URL: http://127.0.0.1:54321 # Default local URL
|
||||
SUPABASE_SERVICE_ROLE_KEY: ${{ secrets.GH_ACTIONS_SUPABASE_SERVICE_ROLE_KEY }} # Use secret
|
||||
SUPABASE_SERVICE_ROLE_KEY: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImV4cCI6MTk4MjM0MzA5Nn0.EGgMpd9zvvHPCOq4DJRLwzJ1iS3GV4AEyzguXGcbEIY' # Use default local value
|
||||
RUST_LOG: debug # Or adjust as needed
|
||||
|
||||
# Sensitive values from Secrets
|
||||
|
|
|
@ -13,6 +13,7 @@ on:
|
|||
jobs:
|
||||
test:
|
||||
runs-on: blacksmith-16vcpu-ubuntu-2204 # Using a powerful runner as requested
|
||||
environment: testing # Add the environment key
|
||||
|
||||
# Service container for Redis (needed by the setup action)
|
||||
services:
|
||||
|
@ -42,9 +43,9 @@ jobs:
|
|||
# Use hardcoded default values and secrets
|
||||
DATABASE_URL: postgres://postgres:postgres@127.0.0.1:54322/postgres
|
||||
REDIS_URL: redis://localhost:6379 # Connect to the Redis service container
|
||||
JWT_SECRET: ${{ secrets.GH_ACTIONS_SUPABASE_JWT_SECRET }} # Use secret
|
||||
JWT_SECRET: 'super-secret-jwt-token-with-at-least-32-characters-long' # Use default local value
|
||||
SUPABASE_URL: http://127.0.0.1:54321 # Default local URL
|
||||
SUPABASE_SERVICE_ROLE_KEY: ${{ secrets.GH_ACTIONS_SUPABASE_SERVICE_ROLE_KEY }} # Use secret
|
||||
SUPABASE_SERVICE_ROLE_KEY: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImV4cCI6MTk4MjM0MzA5Nn0.EGgMpd9zvvHPCOq4DJRLwzJ1iS3GV4AEyzguXGcbEIY' # Use default local value
|
||||
RUST_LOG: debug # Or adjust as needed
|
||||
|
||||
# Add any other environment variables your CLI tests might require
|
||||
|
|
|
@ -13,6 +13,7 @@ on:
|
|||
jobs:
|
||||
test:
|
||||
runs-on: blacksmith-16vcpu-ubuntu-2204
|
||||
environment: testing
|
||||
|
||||
# Service container for Redis (needed by the setup action and potentially API)
|
||||
services:
|
||||
|
@ -56,9 +57,9 @@ jobs:
|
|||
DATABASE_URL: postgres://postgres:postgres@127.0.0.1:54322/postgres
|
||||
POOLER_URL: postgres://postgres:postgres@127.0.0.1:54322/postgres # Assuming pooler uses same DB
|
||||
REDIS_URL: redis://localhost:6379 # Use localhost as it runs on the runner accessing the service
|
||||
JWT_SECRET: ${{ secrets.GH_ACTIONS_SUPABASE_JWT_SECRET }} # Use secret
|
||||
JWT_SECRET: 'super-secret-jwt-token-with-at-least-32-characters-long' # Use default local value
|
||||
SUPABASE_URL: http://127.0.0.1:54321 # Default local URL
|
||||
SUPABASE_SERVICE_ROLE_KEY: ${{ secrets.GH_ACTIONS_SUPABASE_SERVICE_ROLE_KEY }} # Use secret
|
||||
SUPABASE_SERVICE_ROLE_KEY: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImV4cCI6MTk4MjM0MzA5Nn0.EGgMpd9zvvHPCOq4DJRLwzJ1iS3GV4AEyzguXGcbEIY' # Use default local value
|
||||
|
||||
# Non-sensitive / Default values
|
||||
ENVIRONMENT: development
|
||||
|
@ -104,7 +105,7 @@ jobs:
|
|||
NEXT_PUBLIC_URL: http://localhost:3000 # Assuming default URL for the app itself
|
||||
# Use Supabase details - default URL and secret anon key
|
||||
NEXT_PUBLIC_SUPABASE_URL: http://127.0.0.1:54321 # Default local URL
|
||||
NEXT_PUBLIC_SUPABASE_ANON_KEY: ${{ secrets.GH_ACTIONS_SUPABASE_ANON_KEY }} # Use secret
|
||||
NEXT_PUBLIC_SUPABASE_ANON_KEY: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODIzNDMwOTZ9.7UIsMFfHYKxH7bUJCRfxd6lr7CSXGF7UxtZQO10FMMo' # Use default local value
|
||||
NEXT_PUBLIC_WEB_SOCKET_URL: ws://localhost:3001 # Assuming WS connects to API
|
||||
|
||||
# Pass any other required NEXT_PUBLIC_ variables
|
||||
|
|
|
@ -3,12 +3,14 @@ use chrono::Utc;
|
|||
use database::enums::{AssetPermissionRole, AssetType, Verification};
|
||||
use database::models::{Chat, Collection, DashboardFile, MetricFile};
|
||||
use database::schema::{chats, collections, dashboard_files, metric_files};
|
||||
use database::types::metric_yml::{
|
||||
BarAndLineAxis, BarLineChartConfig, BaseChartConfig, ChartConfig,
|
||||
};
|
||||
use database::types::{DashboardYml, MetricYml, VersionHistory};
|
||||
use database::types::metric_yml::{BaseChartConfig, BarAndLineAxis, BarLineChartConfig, ChartConfig};
|
||||
use diesel_async::RunQueryDsl;
|
||||
use indexmap;
|
||||
use uuid::Uuid;
|
||||
use std::collections::HashMap;
|
||||
use uuid::Uuid;
|
||||
|
||||
use crate::common::db::TestDb;
|
||||
use crate::common::permissions::PermissionTestHelpers;
|
||||
|
@ -18,10 +20,7 @@ pub struct AssetTestHelpers;
|
|||
|
||||
impl AssetTestHelpers {
|
||||
/// Creates a test metric file
|
||||
pub async fn create_test_metric(
|
||||
test_db: &TestDb,
|
||||
name: &str,
|
||||
) -> Result<MetricFile> {
|
||||
pub async fn create_test_metric(test_db: &TestDb, name: &str) -> Result<MetricFile> {
|
||||
let mut conn = test_db.diesel_conn().await?;
|
||||
let metric_id = Uuid::new_v4();
|
||||
|
||||
|
@ -38,7 +37,11 @@ impl AssetTestHelpers {
|
|||
let metric_file = MetricFile {
|
||||
id: metric_id,
|
||||
name: format!("{}-{}", test_db.test_id, name),
|
||||
file_name: format!("{}-{}.yml", test_db.test_id, name.to_lowercase().replace(" ", "_")),
|
||||
file_name: format!(
|
||||
"{}-{}.yml",
|
||||
test_db.test_id,
|
||||
name.to_lowercase().replace(" ", "_")
|
||||
),
|
||||
content,
|
||||
verification: Verification::Verified,
|
||||
evaluation_obj: None,
|
||||
|
@ -66,10 +69,7 @@ impl AssetTestHelpers {
|
|||
}
|
||||
|
||||
/// Creates a test dashboard file
|
||||
pub async fn create_test_dashboard(
|
||||
test_db: &TestDb,
|
||||
name: &str,
|
||||
) -> Result<DashboardFile> {
|
||||
pub async fn create_test_dashboard(test_db: &TestDb, name: &str) -> Result<DashboardFile> {
|
||||
let mut conn = test_db.diesel_conn().await?;
|
||||
let dashboard_id = Uuid::new_v4();
|
||||
|
||||
|
@ -83,7 +83,11 @@ impl AssetTestHelpers {
|
|||
let dashboard_file = DashboardFile {
|
||||
id: dashboard_id,
|
||||
name: format!("{}-{}", test_db.test_id, name),
|
||||
file_name: format!("{}-{}.yml", test_db.test_id, name.to_lowercase().replace(" ", "_")),
|
||||
file_name: format!(
|
||||
"{}-{}.yml",
|
||||
test_db.test_id,
|
||||
name.to_lowercase().replace(" ", "_")
|
||||
),
|
||||
content,
|
||||
filter: None,
|
||||
organization_id: test_db.organization_id,
|
||||
|
@ -107,10 +111,7 @@ impl AssetTestHelpers {
|
|||
}
|
||||
|
||||
/// Creates a test collection
|
||||
pub async fn create_test_collection(
|
||||
test_db: &TestDb,
|
||||
name: &str,
|
||||
) -> Result<Collection> {
|
||||
pub async fn create_test_collection(test_db: &TestDb, name: &str) -> Result<Collection> {
|
||||
let mut conn = test_db.diesel_conn().await?;
|
||||
let collection_id = Uuid::new_v4();
|
||||
|
||||
|
@ -135,10 +136,7 @@ impl AssetTestHelpers {
|
|||
}
|
||||
|
||||
/// Creates a test chat
|
||||
pub async fn create_test_chat(
|
||||
test_db: &TestDb,
|
||||
title: &str,
|
||||
) -> Result<Chat> {
|
||||
pub async fn create_test_chat(test_db: &TestDb, title: &str) -> Result<Chat> {
|
||||
let mut conn = test_db.diesel_conn().await?;
|
||||
let chat_id = Uuid::new_v4();
|
||||
|
||||
|
@ -156,6 +154,7 @@ impl AssetTestHelpers {
|
|||
public_expiry_date: None,
|
||||
most_recent_file_id: None,
|
||||
most_recent_file_type: None,
|
||||
most_recent_version_number: None,
|
||||
};
|
||||
|
||||
diesel::insert_into(chats::table)
|
||||
|
@ -182,7 +181,8 @@ impl AssetTestHelpers {
|
|||
AssetType::MetricFile,
|
||||
user_id,
|
||||
role,
|
||||
).await?;
|
||||
)
|
||||
.await?;
|
||||
|
||||
Ok(metric)
|
||||
}
|
||||
|
@ -203,7 +203,8 @@ impl AssetTestHelpers {
|
|||
AssetType::DashboardFile,
|
||||
user_id,
|
||||
role,
|
||||
).await?;
|
||||
)
|
||||
.await?;
|
||||
|
||||
Ok(dashboard)
|
||||
}
|
||||
|
@ -224,7 +225,8 @@ impl AssetTestHelpers {
|
|||
AssetType::Collection,
|
||||
user_id,
|
||||
role,
|
||||
).await?;
|
||||
)
|
||||
.await?;
|
||||
|
||||
Ok(collection)
|
||||
}
|
||||
|
@ -245,7 +247,8 @@ impl AssetTestHelpers {
|
|||
AssetType::Chat,
|
||||
user_id,
|
||||
role,
|
||||
).await?;
|
||||
)
|
||||
.await?;
|
||||
|
||||
Ok(chat)
|
||||
}
|
||||
|
|
|
@ -93,6 +93,7 @@ impl TestDb {
|
|||
created_at: Utc::now(),
|
||||
updated_at: Utc::now(),
|
||||
deleted_at: None,
|
||||
payment_required: false,
|
||||
};
|
||||
|
||||
let mut conn = self.diesel_conn().await?;
|
||||
|
|
|
@ -41,6 +41,7 @@ impl TestSetup {
|
|||
created_at: chrono::Utc::now(),
|
||||
updated_at: chrono::Utc::now(),
|
||||
deleted_at: None,
|
||||
payment_required: false,
|
||||
};
|
||||
|
||||
// Create user with specified role
|
||||
|
|
Loading…
Reference in New Issue