Skip to content
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

Backend Expose Test #534

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

Conversation

anthonykimani
Copy link

@geofmureithi If I'm correct I writing test for backend expose with sqlite, these test should be able to test

  • if I register a job does it work ?
  • Can I register a job
  • Can I push 100 jobs and list them

I found other existing tests for registering jobs and added a function to test 100 jobs

@geofmureithi
Copy link
Owner

geofmureithi commented Mar 17, 2025

The trait has 3 methods:

pub trait BackendExpose<T>
where
    Self: Sized,
{
    /// The request type being handled by the backend
    type Request;
    /// The error returned during reading jobs and stats
    type Error;
    /// List all Workers that are working on a backend
    fn list_workers(
        &self,
    ) -> impl Future<Output = Result<Vec<Worker<WorkerState>>, Self::Error>> + Send;

    /// Returns the counts of jobs in different states
    fn stats(&self) -> impl Future<Output = Result<Stat, Self::Error>> + Send;

    /// Fetch jobs persisted in a backend
    fn list_jobs(
        &self,
        status: &State,
        page: i32,
    ) -> impl Future<Output = Result<Vec<Self::Request>, Self::Error>> + Send;
}
  1. For list_workers register a worker then confirm its listed
  2. For stats, push some jobs, check if the stats are good, consume some jobs then check again.
  3. For list_jobs, push some jobs then assert they are listed.

Let me know if you need some help

@anthonykimani
Copy link
Author

@geofmureithi not getting any jobs listed when using the list_jobs function

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