Skip to content

Commit

Permalink
Igr test: add test of restarting an internal service
Browse files Browse the repository at this point in the history
  • Loading branch information
davmac314 committed Sep 30, 2024
1 parent 07002a9 commit aef55e4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/igr-tests/igr-runner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,8 @@ void force_stop_test()

void restart_test()
{
// Restart both a process service and an internal service.

igr_test_setup setup("restart");
std::string output_file = setup.prep_output_file("basic-ran");
std::string socket_path = setup.prep_socket_path();
Expand Down Expand Up @@ -338,6 +340,11 @@ void restart_test()
nanosleepx(0, 1000000000u / 10u);

igr_assert_eq("ran\n", read_file_contents(output_file));

// "dinitctl restart internal"
dinitctl_p.start("restart", {"-p", socket_path, "restart", "internal"});
dinitctl_p.wait_for_term({1, 0} /* max 1 second */);
igr_assert_eq("Service restarted.\n", dinitctl_p.get_stdout());
}

void check_basic_test()
Expand Down
1 change: 1 addition & 0 deletions src/igr-tests/restart/sd/boot
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
type = internal
waits-for = basic
waits-for = internal
Empty file.

0 comments on commit aef55e4

Please sign in to comment.