Skip to content

Refactor scheduler, use just one timer, add unit testing.

Hy Murveit requested to merge murveit/kstars:scheduler6 into master

This MR is an attempt to have meaningful unit tests for the scheduler. It contains only one unit test, but my hope is to add many more if this idea is accepted. I'd also like to solicit input from the scheduler experts on specifically what tests would be most impactful.

This MR does the following.

  • It refactors the scheduler at the top-level, removing the various timers, and replacing them with a main timer.
  • The runtime scheduler runs "to completion", sets that timer, waits and then runs again.
  • The unit test, runs that scheduler iteration repeatedly, outside of that timer loop, incrementing a simulated clock.
  • Simple mock modules are introduced (Guide, Align, Capture, Mount, Focus, Ekos) that can interact with the scheduler over dbus
  • These mock modules are used in the unit test.

The unit test (see Tests/kstars_ui/test_ekos_scheduler_ops.cpp) has a basic test case.

  • It starts the scheduler with a given job,
  • waits for dusk and altitude constraints
  • watches/tests the scheduler start-up,
  • the follows a simple capture, which then declares completion,
  • and then observes the scheduler's shut-down.

Notes:

Of course, many other test cases are needed, but hopefully this is an existence proof of the possibilities.

I had hoped to separate the functionality from the UI, but I found that that would have been too complex an MR to safely pull off without significant unit tests (much of the state is currently kept inside UI Widgets). So, baby steps. This keeps the Scheduler class as a QWidget, but none of the other Ekos modules are activated (not even the Manager). All of the testing is done outside of the UI.

Edited by Hy Murveit

Merge request reports

Loading