Skip to content

Commit

Permalink
change test config to blocking
Browse files Browse the repository at this point in the history
  • Loading branch information
kaplanelad committed Dec 16, 2024
1 parent e917bfa commit 1f6dea1
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 13 deletions.
12 changes: 0 additions & 12 deletions .github/workflows/loco-new.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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]}}
47 changes: 46 additions & 1 deletion loco-new/tests/templates/background.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 1f6dea1

Please sign in to comment.