vapor / queues

A queue system for Vapor.
MIT License
169 stars 41 forks source link

How to test jobs using XCTest? #126

Closed henrypratt closed 11 months ago

henrypratt commented 11 months ago

How would you go about testing a job since it is run on a thread that does not notify when it is complete? Right now I am just calling sleep(10) before running my asserts, but I would like to be able to know when an AsyncJob is done.

0xTim commented 11 months ago

How are you running your tests? Have you seen https://github.com/vapor/queues/blob/main/Tests/QueuesTests/AsyncQueueTests.swift?

henrypratt commented 11 months ago

How would this work when using async/await for tests and queues?

0xTim commented 11 months ago

It depends on what your job does but it's mostly the same, just convert futures to a/a code

henrypratt commented 11 months ago

Thanks!