Skip to content

Add unit tests #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

joaquim-verges
Copy link
Member

@joaquim-verges joaquim-verges commented Jul 5, 2025

Add comprehensive unit tests for the executors package to achieve 80%+ code coverage.

Summary by CodeRabbit

  • New Features

    • Introduced comprehensive automated testing and coverage reporting for the executors package, including CI workflows for test execution and coverage analysis.
    • Added detailed documentation summarizing testing patterns, compliance, and coverage metrics.
    • Added GitHub Actions workflows for continuous integration and coverage reporting tailored to the executors package.
  • Tests

    • Added extensive unit and integration tests covering deployment caching, locking, transaction registry, webhook envelope, external bundler, and webhook handler functionalities.
    • Tests include scenarios for concurrency, error handling, serialization, Redis integration, HTTP mocking, and retry logic.
    • Introduced new test fixtures and utilities to support consistent, isolated, and pattern-compliant test execution.
  • Chores

    • Enhanced development dependencies to support advanced testing and mocking frameworks.
    • Established fixtures and utilities for consistent and isolated test environments.

cursoragent and others added 2 commits July 5, 2025 04:13
Co-authored-by: joaquim.verges <joaquim.verges@gmail.com>
Co-authored-by: joaquim.verges <joaquim.verges@gmail.com>
Copy link

coderabbitai bot commented Jul 5, 2025

Walkthrough

A comprehensive suite of unit and integration tests was introduced for the executors package, following repository-wide testing standards. New test modules cover deployment caching, external bundler logic, transaction registry, webhook envelope handling, and webhook job execution. Supporting fixtures, CI workflows for tests and coverage, and detailed markdown documentation and coverage reports were also added.

Changes

File(s) Change Summary
.github/workflows/ci-executors.yaml
.github/workflows/coverage-executors.yaml
Added GitHub Actions workflows for CI testing and code coverage of the executors package, with Redis service, caching, artifact upload, and summary reporting.
executors/Cargo.toml Added [dev-dependencies] for async, mocking, Redis, containerized testing, and tracing support.
executors/PATTERN_COMPLIANCE_SUMMARY.md
executors/TESTING_SUMMARY.md
executors/TEST_COVERAGE_REPORT.md
Added markdown documentation summarizing test compliance, coverage, and overall testing approach for the executors package.
executors/tests/fixtures.rs Introduced shared test fixtures: Redis cleanup, tracing setup, atomic flags, mock job and webhook types, and helper functions. Implements traits and structs for test job execution and webhook handling.
executors/tests/deployment_test.rs Added async integration tests for Redis-backed deployment cache and lock: creation, state, lock semantics, pipeline atomicity, serialization, expiration, corruption, and concurrency. Uses testcontainers for Redis.
executors/tests/external_bundler_test.rs Added unit and integration tests for external bundler logic: serialization/deserialization, handler instantiation, error enums, webhook options, Redis-backed cache/lock, and trait mocks.
executors/tests/transaction_registry_test.rs Added async integration tests for transaction registry: key formation, set/get/remove, pipeline operations, error handling, and namespace isolation. Uses testcontainers for Redis.
executors/tests/webhook_envelope_test.rs Added unit tests for webhook envelope serialization, trait implementations, event variants, notification envelopes, nested payloads, timestamp and ID generation, and enum parsing. Includes mock types and executor.
executors/tests/webhook_test.rs Added async tests for webhook job handler: initialization, configuration, HTTP request/response, HMAC, error/retry logic, method/header handling, rate limiting, and serialization. Uses wiremock for HTTP mocking.

Sequence Diagram(s)

sequenceDiagram
    participant CI as GitHub Actions (CI)
    participant Redis as Redis Service
    participant TestSuite as Executors Test Suite
    participant Coverage as Coverage Tool

    CI->>Redis: Start Redis service container
    CI->>TestSuite: Run cargo-nextest tests (CI workflow)
    TestSuite->>Redis: Connect and perform integration tests
    CI->>Coverage: Run cargo-tarpaulin for coverage (Coverage workflow)
    Coverage->>Redis: Connect and perform coverage tests
    CI->>CI: Collect and cache build artifacts
    CI->>CI: Generate test and coverage reports
    CI->>CI: Upload artifacts and append summary to job
Loading
sequenceDiagram
    participant Test as Test Function
    participant Redis as Test Redis (testcontainers)
    participant Handler as Handler/Component Under Test

    Test->>Redis: Start ephemeral Redis container
    Test->>Handler: Instantiate with Redis connection
    Handler->>Redis: Perform cache/lock/registry operations
    Handler-->>Test: Return results
    Test->>Redis: Cleanup keys after test
Loading
sequenceDiagram
    participant WebhookTest as Webhook Test
    participant MockServer as Wiremock HTTP Server
    participant Handler as WebhookJobHandler

    WebhookTest->>MockServer: Setup mock HTTP endpoint
    WebhookTest->>Handler: Process webhook job
    Handler->>MockServer: Send HTTP request
    MockServer-->>Handler: Return mock response
    Handler-->>WebhookTest: Return output or error
Loading

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🧹 Nitpick comments (7)
.github/workflows/coverage-executors.yaml (1)

1-83: Well-structured coverage workflow with comprehensive setup!

The workflow properly:

  • Sets up Redis service container with health checks for integration tests
  • Uses appropriate caching strategy for Cargo dependencies
  • Generates both XML and HTML coverage reports
  • Archives coverage artifacts and adds summary to GitHub job summary
  • Targets the correct package and excludes appropriate directories

Fix the missing newline at end of file:

 # special GITHUB_STEP_SUMMARY file, which populates the job summary page.
-run: cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY
+run: cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY
+
.github/workflows/ci-executors.yaml (1)

1-74: Excellent CI workflow setup with modern tooling!

The workflow properly:

  • Sets up Redis service container with health checks for integration tests
  • Uses cargo-nextest for faster test execution with CI profile
  • Implements proper caching strategy for Cargo dependencies
  • Uploads JUnit XML reports for test result visualization
  • Runs test reporter regardless of test outcome (success or failure)

Fix the missing newline at end of file:

 name: Executors Tests # Name of the check run which will be created
 path: target/nextest/ci/junit.xml # Path to test results
-reporter: java-junit # Format of test results
+reporter: java-junit # Format of test results
+
executors/TEST_COVERAGE_REPORT.md (1)

1-226: Comprehensive and well-structured test coverage documentation!

The documentation excellently:

  • Provides detailed breakdown of test coverage across all modules (87% overall)
  • Exceeds the PR objective of >80% coverage
  • Documents test infrastructure, quality metrics, and execution instructions
  • Clearly identifies tested features and uncovered areas
  • Includes comprehensive test case listings and module coverage breakdown

Fix the markdown linting issues by removing trailing punctuation from headings:

-#### Test Cases:
+#### Test Cases

-#### Key Features Tested:
+#### Key Features Tested

-#### Module Breakdown:
+#### Module Breakdown

-### Uncovered Areas:
+### Uncovered Areas

-### Dependencies Used:
+### Dependencies Used

-### Test Categories:
+### Test Categories
executors/TESTING_SUMMARY.md (2)

11-11: Add language specification to the code block.

The fenced code block should specify a language for proper syntax highlighting.

-```
+```text

25-25: Remove trailing punctuation from headings.

Markdown headings typically don't include trailing punctuation. This is a style improvement flagged by the linter.

For example, change:

-#### Test Structure Patterns:
+#### Test Structure Patterns

Also applies to: 33-33, 39-39

executors/PATTERN_COMPLIANCE_SUMMARY.md (1)

9-9: Fix markdown formatting issues with heading punctuation.

The markdown linter flagged trailing punctuation (colons) in headings, which should be removed for consistent formatting.

Apply these changes to fix the formatting issues:

-## 🔍 Pattern Analysis Conducted:
+## 🔍 Pattern Analysis Conducted

-### Immediate Benefits:
+### Immediate Benefits

-### Long-term Benefits:
+### Long-term Benefits

Also applies to: 209-209, 216-216

executors/tests/fixtures.rs (1)

20-38: Consider Redis cleanup efficiency for large key sets.

The current implementation uses KEYS command which can be inefficient for large datasets. While this is acceptable for testing, consider documenting this limitation or using SCAN for production-like scenarios.

For improved efficiency with large key sets, consider this alternative approach:

 pub async fn cleanup_redis_keys(conn_manager: &ConnectionManager, queue_name: &str) {
     let mut conn = conn_manager.clone();
     let keys_pattern = format!("twmq:{}:*", queue_name);
     
-    let keys: Vec<String> = redis::cmd("KEYS")
-        .arg(&keys_pattern)
-        .query_async(&mut conn)
-        .await
-        .unwrap_or_default();
+    // Use SCAN for better performance with large key sets
+    let mut cursor = 0;
+    let mut all_keys = Vec::new();
+    loop {
+        let (next_cursor, keys): (u64, Vec<String>) = redis::cmd("SCAN")
+            .arg(cursor)
+            .arg("MATCH")
+            .arg(&keys_pattern)
+            .query_async(&mut conn)
+            .await
+            .unwrap_or_default();
+        all_keys.extend(keys);
+        if next_cursor == 0 { break; }
+        cursor = next_cursor;
+    }
+    let keys = all_keys;
     
     if !keys.is_empty() {
         redis::cmd("DEL")
             .arg(keys)
             .query_async::<()>(&mut conn)
             .await
             .unwrap_or_default();
     }
     tracing::info!("Cleaned up keys for pattern: {}", keys_pattern);
 }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f1d53d8 and f6f5af2.

📒 Files selected for processing (12)
  • .github/workflows/ci-executors.yaml (1 hunks)
  • .github/workflows/coverage-executors.yaml (1 hunks)
  • executors/Cargo.toml (1 hunks)
  • executors/PATTERN_COMPLIANCE_SUMMARY.md (1 hunks)
  • executors/TESTING_SUMMARY.md (1 hunks)
  • executors/TEST_COVERAGE_REPORT.md (1 hunks)
  • executors/tests/deployment_test.rs (1 hunks)
  • executors/tests/external_bundler_test.rs (1 hunks)
  • executors/tests/fixtures.rs (1 hunks)
  • executors/tests/transaction_registry_test.rs (1 hunks)
  • executors/tests/webhook_envelope_test.rs (1 hunks)
  • executors/tests/webhook_test.rs (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
executors/tests/transaction_registry_test.rs (2)
executors/tests/fixtures.rs (3)
  • redis (31-33)
  • setup_tracing (41-50)
  • cleanup_redis_keys (21-38)
executors/src/transaction_registry.rs (2)
  • registry_key (30-35)
  • get_transaction_queue (37-41)
🪛 YAMLlint (1.37.1)
.github/workflows/coverage-executors.yaml

[error] 83-83: no new line character at the end of file

(new-line-at-end-of-file)

.github/workflows/ci-executors.yaml

[error] 74-74: no new line character at the end of file

(new-line-at-end-of-file)

🪛 markdownlint-cli2 (0.17.2)
executors/TEST_COVERAGE_REPORT.md

13-13: Trailing punctuation in heading
Punctuation: ':'

(MD026, no-trailing-punctuation)


22-22: Trailing punctuation in heading
Punctuation: ':'

(MD026, no-trailing-punctuation)


34-34: Trailing punctuation in heading
Punctuation: ':'

(MD026, no-trailing-punctuation)


53-53: Trailing punctuation in heading
Punctuation: ':'

(MD026, no-trailing-punctuation)


66-66: Trailing punctuation in heading
Punctuation: ':'

(MD026, no-trailing-punctuation)


83-83: Trailing punctuation in heading
Punctuation: ':'

(MD026, no-trailing-punctuation)


95-95: Trailing punctuation in heading
Punctuation: ':'

(MD026, no-trailing-punctuation)


111-111: Trailing punctuation in heading
Punctuation: ':'

(MD026, no-trailing-punctuation)


124-124: Trailing punctuation in heading
Punctuation: ':'

(MD026, no-trailing-punctuation)


142-142: Trailing punctuation in heading
Punctuation: ':'

(MD026, no-trailing-punctuation)


156-156: Trailing punctuation in heading
Punctuation: ':'

(MD026, no-trailing-punctuation)


167-167: Trailing punctuation in heading
Punctuation: ':'

(MD026, no-trailing-punctuation)


176-176: Trailing punctuation in heading
Punctuation: ':'

(MD026, no-trailing-punctuation)


184-184: Trailing punctuation in heading
Punctuation: ':'

(MD026, no-trailing-punctuation)

executors/TESTING_SUMMARY.md

11-11: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


25-25: Trailing punctuation in heading
Punctuation: ':'

(MD026, no-trailing-punctuation)


33-33: Trailing punctuation in heading
Punctuation: ':'

(MD026, no-trailing-punctuation)


39-39: Trailing punctuation in heading
Punctuation: ':'

(MD026, no-trailing-punctuation)


49-49: Trailing punctuation in heading
Punctuation: ':'

(MD026, no-trailing-punctuation)


68-68: Trailing punctuation in heading
Punctuation: ':'

(MD026, no-trailing-punctuation)

executors/PATTERN_COMPLIANCE_SUMMARY.md

9-9: Trailing punctuation in heading
Punctuation: ':'

(MD026, no-trailing-punctuation)


209-209: Trailing punctuation in heading
Punctuation: ':'

(MD026, no-trailing-punctuation)


216-216: Trailing punctuation in heading
Punctuation: ':'

(MD026, no-trailing-punctuation)

🪛 LanguageTool
executors/TESTING_SUMMARY.md

[uncategorized] ~49-~49: Loose punctuation mark.
Context: ...## .github/workflows/ci-executors.yaml: ```yaml name: executors Tests on: pus...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~68-~68: Loose punctuation mark.
Context: ...ithub/workflows/coverage-executors.yaml`: ```yaml name: executors Coverage on: ...

(UNLIKELY_OPENING_PUNCTUATION)

🔇 Additional comments (14)
executors/Cargo.toml (1)

24-31: Excellent choice of testing dependencies!

The dev-dependencies are well-selected for comprehensive testing infrastructure:

  • tokio with full features for async runtime support
  • mockall for mocking external dependencies
  • wiremock for HTTP mocking (webhook testing)
  • redis with tokio compatibility for Redis integration testing
  • testcontainers for containerized Redis testing
  • tracing-test for logging verification in tests

These dependencies will enable thorough testing of async operations, external integrations, and Redis-backed functionality.

executors/tests/transaction_registry_test.rs (8)

1-9: Excellent test module structure and imports!

The imports are well-organized and include all necessary dependencies for comprehensive Redis integration testing.


10-29: Thorough test for registry creation with namespace handling!

The test properly validates both namespaced and non-namespaced registry creation, ensuring the correct Redis key formation. The use of multi-threaded tokio runtime is appropriate for integration testing.


31-59: Comprehensive CRUD operation testing!

The test covers the complete lifecycle of transaction-to-queue mapping with proper cleanup, positive and negative test cases, and validates both successful operations and non-existent key handling.


61-92: Excellent validation of transaction removal functionality!

The test follows a proper sequence: set → verify → remove → verify removal, ensuring the removal operation works correctly.


94-136: Thorough testing of Redis pipeline operations!

The test validates atomic pipeline operations for both setting and removing transactions, which is crucial for maintaining data consistency in concurrent environments.


138-177: Comprehensive multi-transaction handling test!

The test validates handling of multiple transactions simultaneously and selective removal, ensuring the registry can manage complex scenarios correctly.


179-189: Good error handling validation!

The test properly validates error scenarios with invalid Redis connections, ensuring robust error handling in the registry.


191-230: Critical namespace isolation testing!

This test is particularly important for multi-tenant environments, ensuring that transactions in different namespaces don't interfere with each other. The comprehensive validation covers setting, getting, and removing operations across namespaces.

executors/tests/deployment_test.rs (1)

1-434: Excellent test coverage for deployment cache and lock mechanisms!

The tests comprehensively cover all important scenarios including initialization, concurrent access, pipeline operations, serialization, and error handling. The use of testcontainers for Redis integration provides realistic testing conditions.

executors/tests/webhook_envelope_test.rs (1)

1-409: Well-designed tests for webhook envelope functionality!

The tests provide excellent coverage of serialization/deserialization, trait implementations, and edge cases. The use of mock types effectively simulates real-world scenarios.

executors/tests/webhook_test.rs (1)

1-544: Comprehensive webhook handler test suite!

Excellent coverage of webhook handling scenarios including success cases, various error types, retry logic, authentication, and edge cases. The use of wiremock for HTTP mocking provides reliable and deterministic tests.

executors/PATTERN_COMPLIANCE_SUMMARY.md (1)

1-234: Excellent comprehensive documentation of test pattern compliance.

This document provides thorough documentation of the test pattern alignment efforts, clearly explaining the changes made and their rationale. The structure is logical and the before/after examples are helpful for understanding the improvements.

executors/tests/fixtures.rs (1)

1-222: Well-structured test fixtures following established patterns.

The fixtures module is comprehensive and follows the repository testing patterns described in the documentation. The code includes proper error handling, tracing setup, and mock structures for various testing scenarios.

Comment on lines +596 to +598
// Just verify that serialization/deserialization works
assert!(true);
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Remove or replace placeholder assertions in credential tests.

These tests only verify that serialization/deserialization doesn't panic but don't check if the data is preserved correctly.

Consider adding assertions to verify the credentials are correctly preserved:

-        // Just verify that serialization/deserialization works
-        assert!(true);
+        // Verify that credentials are preserved after serialization
+        match (credential, &deserialized.rpc_credentials) {
+            (RpcCredentials::None, RpcCredentials::None) => {},
+            (RpcCredentials::BearerToken(t1), RpcCredentials::BearerToken(t2)) => assert_eq!(t1, t2),
+            (RpcCredentials::ApiKey(k1), RpcCredentials::ApiKey(k2)) => assert_eq!(k1, k2),
+            _ => panic!("Credential type mismatch after deserialization"),
+        }

Also applies to: 620-622

🤖 Prompt for AI Agents
In executors/tests/external_bundler_test.rs around lines 596 to 598 and 620 to
622, the tests currently use placeholder assertions that do not verify if the
credential data is correctly preserved after serialization and deserialization.
Replace the assert!(true) statements with assertions that compare the original
credential data to the deserialized data to ensure they match exactly,
confirming data integrity through the process.

Comment on lines +515 to +533
for error in errors {
let serialized = serde_json::to_string(&error).unwrap();
let deserialized: ExternalBundlerSendError = serde_json::from_str(&serialized).unwrap();

// Just verify that serialization/deserialization works
match (&error, &deserialized) {
(ExternalBundlerSendError::ChainServiceError { chain_id: c1, .. },
ExternalBundlerSendError::ChainServiceError { chain_id: c2, .. }) => {
assert_eq!(c1, c2);
}
(ExternalBundlerSendError::UserCancelled, ExternalBundlerSendError::UserCancelled) => {
assert!(true);
}
_ => {
// For other variants, just check they serialize/deserialize without error
assert!(true);
}
}
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Replace placeholder assertions in error variant tests.

Multiple error variant tests contain placeholder assertions that don't verify the serialization/deserialization beyond basic type matching. Consider adding more specific assertions or documenting why basic validation is sufficient.

For example, in lines 526, 530:

-            assert!(true);
+            // Serialization/deserialization verified by type match

Or add more specific assertions to verify the error details are preserved correctly.

🤖 Prompt for AI Agents
In executors/tests/external_bundler_test.rs around lines 515 to 533, the test
uses placeholder assertions that only confirm basic type matching after
serialization and deserialization of error variants. Replace these placeholder
assertions with more specific checks that verify the internal data of each error
variant is preserved correctly through serialization. For example, assert
equality of all relevant fields in each variant instead of just asserting true,
or add comments explaining why simple validation is sufficient if detailed
checks are not needed.

Comment on lines +318 to +321
let deployment_manager = handler.deployment_manager();
// Just verify it was created without errors
assert!(true); // Placeholder assertion
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Replace placeholder assertion with meaningful verification.

The test creates a deployment manager but doesn't verify any of its properties or behavior. Either add meaningful assertions or document why no assertions are needed.

-    // Test deployment manager creation
-    let deployment_manager = handler.deployment_manager();
-    // Just verify it was created without errors
-    assert!(true); // Placeholder assertion
+    // Test deployment manager creation
+    let deployment_manager = handler.deployment_manager();
+    // Verify the deployment manager was created successfully
+    // The mere fact that no panic occurred validates basic functionality

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In executors/tests/external_bundler_test.rs around lines 318 to 321, the test
currently uses a placeholder assertion that always passes without verifying the
deployment manager's properties or behavior. Replace the placeholder
assert!(true) with meaningful assertions that check key properties or expected
behavior of the deployment manager instance to ensure it was created correctly
and functions as intended. If no assertions are needed, add a comment explaining
why verification is unnecessary.

Comment on lines +86 to +87
// Use a static AtomicBool to signal from the job process to the test
pub static TEST_JOB_PROCESSED_SUCCESSFULLY: AtomicBool = AtomicBool::new(false);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Verify atomic boolean reset between tests.

The static atomic boolean TEST_JOB_PROCESSED_SUCCESSFULLY is used for test coordination. Ensure it's properly reset between tests to avoid test interference.


🏁 Script executed:

#!/bin/bash
# Description: Check if the atomic boolean is properly reset in test setup
# Expected: Find reset calls in test functions or setup code

ast-grep --pattern $'TEST_JOB_PROCESSED_SUCCESSFULLY.store(false, $_)'

Length of output: 162


🏁 Script executed:

#!/bin/bash
# Check for atomic boolean resets across test suites

echo "----- Resets in twmq/tests -----"
rg "TEST_JOB_PROCESSED_SUCCESSFULLY\.store\(false" -n twmq/tests || echo "No matches in twmq/tests"

echo
echo "----- Resets in executors/tests -----"
rg "TEST_JOB_PROCESSED_SUCCESSFULLY\.store\(false" -n executors/tests || echo "No matches in executors/tests"

Length of output: 466


Add missing atomic boolean reset in executors tests

I found that while TEST_JOB_PROCESSED_SUCCESSFULLY is reset in twmq/tests/basic.rs, there are no store(false, …) calls in the executors/tests suite. Without a reset, one test’s success flag can bleed into the next, causing intermittent failures.

• File needing update: executors/tests/fixtures.rs (around the pub static TEST_JOB_PROCESSED_SUCCESSFULLY definition)
• Suggested fix: insert a reset before each test run, for example with a constructor function:

use std::sync::atomic::Ordering;
use ctor::ctor;  // add `ctor = "0.1"` to [dev-dependencies] if not already present

#[ctor]
fn reset_test_job_processed() {
    TEST_JOB_PROCESSED_SUCCESSFULLY.store(false, Ordering::SeqCst);
}

This ensures the flag is cleared automatically before any test in this crate executes.

🤖 Prompt for AI Agents
In executors/tests/fixtures.rs around lines 86 to 87, the static AtomicBool
TEST_JOB_PROCESSED_SUCCESSFULLY is not reset before each test, which can cause
test interference. Fix this by adding a constructor function using the ctor
crate that resets TEST_JOB_PROCESSED_SUCCESSFULLY to false with Ordering::SeqCst
before any test runs. Import std::sync::atomic::Ordering and the ctor crate,
then define a function annotated with #[ctor] that calls
TEST_JOB_PROCESSED_SUCCESSFULLY.store(false, Ordering::SeqCst).

Co-authored-by: joaquim.verges <joaquim.verges@gmail.com>
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (5)
.github/workflows/coverage-executors.yaml (2)

70-75: Add a trailing newline to silence YAML linter

yamllint flags the file because there is no line-feed after the last line.
This is purely cosmetic but keeps the linter (and git diff) quiet.

-        run: cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY
+\t        run: cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY
+
+# (newline EOF)

17-21: Consider using the concurrency key to auto-cancel superseded runs

Long-running coverage jobs can queue up on busy branches.
Adding a simple concurrency group prevents wasting CI minutes:

jobs:
  coverage:
    concurrency:
      group: coverage-${{ github.ref }}
      cancel-in-progress: true
.github/workflows/ci-executors.yaml (2)

60-66: Add missing newline at EOF

Same yamllint warning here—append a final newline.


54-58: Skip the redundant build step to shave CI time

cargo nextest run performs a build if artifacts are absent.
The explicit cargo build just duplicates work and usually adds ~30-40 s.

Two options:

-      - name: Build
-        run: cargo build -p engine-executors --verbose
-
-      - name: Run tests
-        run: cargo nextest run -p engine-executors --profile ci
+      - name: Run tests
+        run: cargo nextest run -p engine-executors --profile ci --no-rebuild

The --no-rebuild guard ensures nextest does not trigger a compile if someone adds the build step back later.

executors/GITHUB_ACTIONS_SUMMARY.md (1)

66-71: Specify a fenced-code language to satisfy markdownlint

markdownlint rule MD040 complains about language-less fences.
Just tag the block as plaintext:

-```
+```text
 github/workflows/
 ├── ci-twmq.yaml           # ✅ Tests for twmq crate
 ...

</blockquote></details>

</blockquote></details>

<details>
<summary>📜 Review details</summary>

**Configuration used: CodeRabbit UI**
**Review profile: CHILL**
**Plan: Pro**


<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between f6f5af27a6ff8114e7fc6d225f9771735983704c and ae379711ff30f4dd8a461c3c98063cc75c1d16d3.

</details>

<details>
<summary>📒 Files selected for processing (3)</summary>

* `.github/workflows/ci-executors.yaml` (1 hunks)
* `.github/workflows/coverage-executors.yaml` (1 hunks)
* `executors/GITHUB_ACTIONS_SUMMARY.md` (1 hunks)

</details>

<details>
<summary>🧰 Additional context used</summary>

<details>
<summary>🪛 YAMLlint (1.37.1)</summary>

<details>
<summary>.github/workflows/ci-executors.yaml</summary>

[error] 66-66: no new line character at the end of file

(new-line-at-end-of-file)

</details>
<details>
<summary>.github/workflows/coverage-executors.yaml</summary>

[error] 75-75: no new line character at the end of file

(new-line-at-end-of-file)

</details>

</details>
<details>
<summary>🪛 markdownlint-cli2 (0.17.2)</summary>

<details>
<summary>executors/GITHUB_ACTIONS_SUMMARY.md</summary>

68-68: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

</details>

</details>

</details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants