From aef55e49dc5b9af586fca762def9e3c53931832b Mon Sep 17 00:00:00 2001 From: Davin McCall Date: Tue, 1 Oct 2024 07:57:29 +1000 Subject: [PATCH] Igr test: add test of restarting an internal service --- src/igr-tests/igr-runner.cc | 7 +++++++ src/igr-tests/restart/sd/boot | 1 + src/igr-tests/restart/sd/internal | 0 3 files changed, 8 insertions(+) create mode 100644 src/igr-tests/restart/sd/internal diff --git a/src/igr-tests/igr-runner.cc b/src/igr-tests/igr-runner.cc index 844a127e..c87731b0 100644 --- a/src/igr-tests/igr-runner.cc +++ b/src/igr-tests/igr-runner.cc @@ -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(); @@ -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() diff --git a/src/igr-tests/restart/sd/boot b/src/igr-tests/restart/sd/boot index f7c6964f..805fb77c 100644 --- a/src/igr-tests/restart/sd/boot +++ b/src/igr-tests/restart/sd/boot @@ -1,2 +1,3 @@ type = internal waits-for = basic +waits-for = internal diff --git a/src/igr-tests/restart/sd/internal b/src/igr-tests/restart/sd/internal new file mode 100644 index 00000000..e69de29b