]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: add ServiceContext/Runtime enum and integration tests 42098/head
authorIvan Kruglov <mail@ikruglov.com>
Thu, 14 May 2026 16:41:50 +0000 (09:41 -0700)
committerikruglov <ikruglov@fb.com>
Fri, 15 May 2026 07:02:01 +0000 (00:02 -0700)
Co-developed-by: Claude Opus 4.6 <noreply@anthropic.com>
src/test/test-varlink-idl-unit.c
test/units/TEST-74-AUX-UTILS.varlinkctl.sh

index 7859f2d73596594381d8b29b27600b29b220c9cc..51d5b9396f3f50f4c9760b67d1c74bc435f299cd 100644 (file)
@@ -67,6 +67,14 @@ TEST(unit_enums_idl) {
 
         /* ServiceContext enums */
         TEST_IDL_ENUM(ServiceType, service_type, vl_type_ServiceType);
+        TEST_IDL_ENUM(ServiceExitType, service_exit_type, vl_type_ServiceExitType);
+        TEST_IDL_ENUM(ServiceRestart, service_restart, vl_type_ServiceRestart);
+        TEST_IDL_ENUM(ServiceRestartMode, service_restart_mode, vl_type_ServiceRestartMode);
+        TEST_IDL_ENUM(ServiceTimeoutFailureMode, service_timeout_failure_mode, vl_type_ServiceTimeoutFailureMode);
+
+        /* ServiceRuntime enums */
+        TEST_IDL_ENUM(NotifyAccess, notify_access, vl_type_NotifyAccess);
+        TEST_IDL_ENUM(ServiceResult, service_result, vl_type_ServiceResult);
 
         /* PathContext enums */
         TEST_IDL_ENUM(PathType, path_type, vl_type_PathType);
index de56b37c3153e18167294fbcba192c939d217538..bbc219decbfad1179a29014b2317f8541ccbfe87 100755 (executable)
@@ -252,6 +252,12 @@ test -n "$path_id"
 path_params=$(jq -cn --arg name "$path_id" '{name: $name}')
 varlinkctl call /run/systemd/io.systemd.Manager io.systemd.Unit.List "$path_params" | jq -e '.context.Path'
 varlinkctl call /run/systemd/io.systemd.Manager io.systemd.Unit.List "$path_params" | jq -e '.runtime.Path'
+# test for ServiceContext/Runtime
+service_id=$(varlinkctl call --collect /run/systemd/io.systemd.Manager io.systemd.Unit.List '{}' | jq -r '.[] | select(.context.Type == "service" and .runtime.LoadState == "loaded") .context.ID // empty' | tail -n 1)
+test -n "$service_id"
+service_params=$(jq -cn --arg name "$service_id" '{name: $name}')
+varlinkctl call /run/systemd/io.systemd.Manager io.systemd.Unit.List "$service_params" | jq -e '.context.Service'
+varlinkctl call /run/systemd/io.systemd.Manager io.systemd.Unit.List "$service_params" | jq -e '.runtime.Service'
 # test for ScopeContext/Runtime
 scope_id=$(varlinkctl call --collect /run/systemd/io.systemd.Manager io.systemd.Unit.List '{}' | jq -r '.[] | select(.context.Type == "scope" and .runtime.LoadState == "loaded") .context.ID // empty' | tail -n 1)
 test -n "$scope_id"