From 1f6dea1dbc1cb881eb03a394cbac2d0718bf3791 Mon Sep 17 00:00:00 2001 From: Elad Kaplan Date: Mon, 16 Dec 2024 10:07:12 +0200 Subject: [PATCH] change test config to blocking --- .github/workflows/loco-new.yml | 12 ------- loco-new/tests/templates/background.rs | 47 +++++++++++++++++++++++++- 2 files changed, 46 insertions(+), 13 deletions(-) diff --git a/.github/workflows/loco-new.yml b/.github/workflows/loco-new.yml index ffe98946e..4db13adee 100644 --- a/.github/workflows/loco-new.yml +++ b/.github/workflows/loco-new.yml @@ -46,17 +46,6 @@ jobs: permissions: contents: read - services: - redis: - image: redis - options: >- - --health-cmd "redis-cli ping" - --health-interval 10s - --health-timeout 5s - --health-retries 5 - ports: - - "6379:6379" - steps: - name: Checkout the code uses: actions/checkout@v4 @@ -86,4 +75,3 @@ jobs: LOCO_DEV_MODE_PATH: ${{ github.workspace }} # NOTE NOTE NOTE: this is for optimizing build and may result in strange behavior CARGO_TARGET_DIR: /tmp/shared-target - REDIS_URL: redis://localhost:${{job.services.redis.ports[6379]}} diff --git a/loco-new/tests/templates/background.rs b/loco-new/tests/templates/background.rs index adcab5cba..222b95516 100644 --- a/loco-new/tests/templates/background.rs +++ b/loco-new/tests/templates/background.rs @@ -60,7 +60,7 @@ fn test_config_file_queue( #[rstest] fn test_config_file_workers( - #[values("config/development.yaml", "config/test.yaml")] config_file: &str, + #[values("config/development.yaml")] config_file: &str, #[values( BackgroundOption::None, BackgroundOption::Async, @@ -104,6 +104,51 @@ fn test_config_file_workers( } } +#[rstest] +fn test_config_file_workers_tests( + #[values( + BackgroundOption::None, + BackgroundOption::Async, + BackgroundOption::Queue, + BackgroundOption::Blocking + )] + background: BackgroundOption, +) { + let generator = run_generator(background.clone()); + let content = assertion::yaml::load(generator.path("config/test.yaml")); + + match background { + BackgroundOption::Async => { + assertion::yaml::assert_path_value_eq_string( + &content, + &["workers", "mode"], + "ForegroundBlocking", + ); + } + BackgroundOption::Queue => { + assertion::yaml::assert_path_value_eq_string( + &content, + &["workers", "mode"], + "ForegroundBlocking", + ); + } + BackgroundOption::Blocking => { + assertion::yaml::assert_path_value_eq_string( + &content, + &["workers", "mode"], + "ForegroundBlocking", + ); + } + BackgroundOption::None => { + assertion::yaml::assert_path_is_empty(&content, &["workers"]); + } + }; + + if background.enable() { + assertion::yaml::assert_path_key_count(&content, &["workers"], 1); + } +} + #[rstest] fn test_app_rs( #[values(