winglang / wing

A programming language for the cloud ☁️ A unified programming model, combining infrastructure and runtime code into one language ⚡
https://winglang.io
Other
4.94k stars 194 forks source link

Test Helper for Schedule #2845

Open skorfmann opened 1 year ago

skorfmann commented 1 year ago

Feature Spec

Make it easy and less verbose to test a Schedule

Use Cases

To make the inflight handler of a schedule testable, I'll have to define it explicitly like this so that I have a reference to it.

let schedule = new cloud.Schedule(cron: "0 * * * ?");

let scheduleHandler = inflight () => {
  log("hello")
};

schedule.onTick(scheduleHandler);

Would be nicer to being able to define it like:

let schedule = new cloud.Schedule(cron: "0 * * * ?");

schedule.onTick(inflight () => {
  log("hello")
};

and invoke it with something like schedule.tick() or TestHelper.tick(schedule).

Implementation Notes

No response

Component

No response

Community Notes

Chriscbr commented 1 year ago

Yes, I've wondered if we should have some kind of "test" or "tick" or "trigger" or "run" or some other way to manually trigger the scheduled function. It does seem feel like apps using this resource are hard to test at the moment

github-actions[bot] commented 1 year ago

Hi,

This issue hasn't seen activity in 60 days. Therefore, we are marking this issue as stale for now. It will be closed after 7 days. Feel free to re-open this issue when there's an update or relevant information to be added. Thanks!

github-actions[bot] commented 11 months ago

Hi,

This issue hasn't seen activity in 60 days. Therefore, we are marking this issue as stale for now. It will be closed after 7 days. Feel free to re-open this issue when there's an update or relevant information to be added. Thanks!

github-actions[bot] commented 5 months ago

Hi,

This issue hasn't seen activity in 90 days. Therefore, we are marking this issue as stale for now. It will be closed after 7 days. Feel free to re-open this issue when there's an update or relevant information to be added. Thanks!

github-actions[bot] commented 2 months ago

Hi,

This issue hasn't seen activity in 90 days. Therefore, we are marking this issue as stale for now. It will be closed after 7 days. Feel free to re-open this issue when there's an update or relevant information to be added. Thanks!