Zbigniew Jędrzejewski-Szmek 0eabb3
From a2deeaeaa90d493ef8a2b20656745cd0531a1b30 Mon Sep 17 00:00:00 2001
Zbigniew Jędrzejewski-Szmek 0eabb3
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Zbigniew Jędrzejewski-Szmek 0eabb3
Date: Fri, 31 Jul 2020 10:36:57 +0200
Zbigniew Jędrzejewski-Szmek 0eabb3
Subject: [PATCH 2/2] test-path: do not fail the test if we fail to start some
Zbigniew Jędrzejewski-Szmek 0eabb3
 service
Zbigniew Jędrzejewski-Szmek 0eabb3
Zbigniew Jędrzejewski-Szmek 0eabb3
The test was failing because it couldn't start the service:
Zbigniew Jędrzejewski-Szmek 0eabb3
Zbigniew Jędrzejewski-Szmek 0eabb3
path-modified.service: state = failed; result = exit-code
Zbigniew Jędrzejewski-Szmek 0eabb3
path-modified.path: state = waiting; result = success
Zbigniew Jędrzejewski-Szmek 0eabb3
path-modified.service: state = failed; result = exit-code
Zbigniew Jędrzejewski-Szmek 0eabb3
path-modified.path: state = waiting; result = success
Zbigniew Jędrzejewski-Szmek 0eabb3
path-modified.service: state = failed; result = exit-code
Zbigniew Jędrzejewski-Szmek 0eabb3
path-modified.path: state = waiting; result = success
Zbigniew Jędrzejewski-Szmek 0eabb3
path-modified.service: state = failed; result = exit-code
Zbigniew Jędrzejewski-Szmek 0eabb3
path-modified.path: state = waiting; result = success
Zbigniew Jędrzejewski-Szmek 0eabb3
path-modified.service: state = failed; result = exit-code
Zbigniew Jędrzejewski-Szmek 0eabb3
path-modified.path: state = waiting; result = success
Zbigniew Jędrzejewski-Szmek 0eabb3
path-modified.service: state = failed; result = exit-code
Zbigniew Jędrzejewski-Szmek 0eabb3
Failed to connect to system bus: No such file or directory
Zbigniew Jędrzejewski-Szmek 0eabb3
-.slice: Failed to enable/disable controllers on cgroup /system.slice/kojid.service, ignoring: Permission denied
Zbigniew Jędrzejewski-Szmek 0eabb3
path-modified.service: Failed to create cgroup /system.slice/kojid.service/path-modified.service: Permission denied
Zbigniew Jędrzejewski-Szmek 0eabb3
path-modified.service: Failed to attach to cgroup /system.slice/kojid.service/path-modified.service: No such file or directory
Zbigniew Jędrzejewski-Szmek 0eabb3
path-modified.service: Failed at step CGROUP spawning /bin/true: No such file or directory
Zbigniew Jędrzejewski-Szmek 0eabb3
path-modified.service: Main process exited, code=exited, status=219/CGROUP
Zbigniew Jędrzejewski-Szmek 0eabb3
path-modified.service: Failed with result 'exit-code'.
Zbigniew Jędrzejewski-Szmek 0eabb3
Test timeout when testing path-modified.path
Zbigniew Jędrzejewski-Szmek 0eabb3
Zbigniew Jędrzejewski-Szmek 0eabb3
Let's just ignore the failure here. Services can occasionally fail to start,
Zbigniew Jędrzejewski-Szmek 0eabb3
there's not much we can do in that case.
Zbigniew Jędrzejewski-Szmek 0eabb3
---
Zbigniew Jędrzejewski-Szmek 0eabb3
 src/test/test-path.c | 8 ++++++++
Zbigniew Jędrzejewski-Szmek 0eabb3
 1 file changed, 8 insertions(+)
Zbigniew Jędrzejewski-Szmek 0eabb3
Zbigniew Jędrzejewski-Szmek 0eabb3
diff --git a/src/test/test-path.c b/src/test/test-path.c
Zbigniew Jędrzejewski-Szmek 0eabb3
index 63b709c8da..6c0db53f10 100644
Zbigniew Jędrzejewski-Szmek 0eabb3
--- a/src/test/test-path.c
Zbigniew Jędrzejewski-Szmek 0eabb3
+++ b/src/test/test-path.c
Zbigniew Jędrzejewski-Szmek 0eabb3
@@ -98,6 +98,14 @@ static void check_states(Manager *m, Path *path, Service *service, PathState pat
Zbigniew Jędrzejewski-Szmek 0eabb3
                                 service_state_to_string(service->state),
Zbigniew Jędrzejewski-Szmek 0eabb3
                                 service_result_to_string(service->result));
Zbigniew Jędrzejewski-Szmek 0eabb3
 
Zbigniew Jędrzejewski-Szmek 0eabb3
+                if (service->state == SERVICE_FAILED) {
Zbigniew Jędrzejewski-Szmek 0eabb3
+                        log_warning("Failed to start service %s, ignoring: %s/%s",
Zbigniew Jędrzejewski-Szmek 0eabb3
+                                    UNIT(service)->id,
Zbigniew Jędrzejewski-Szmek 0eabb3
+                                    service_state_to_string(service->state),
Zbigniew Jędrzejewski-Szmek 0eabb3
+                                    service_result_to_string(service->result));
Zbigniew Jędrzejewski-Szmek 0eabb3
+                        break;
Zbigniew Jędrzejewski-Szmek 0eabb3
+                }
Zbigniew Jędrzejewski-Szmek 0eabb3
+
Zbigniew Jędrzejewski-Szmek 0eabb3
                 if (now(CLOCK_MONOTONIC) >= end) {
Zbigniew Jędrzejewski-Szmek 0eabb3
                         log_error("Test timeout when testing %s", UNIT(path)->id);
Zbigniew Jędrzejewski-Szmek 0eabb3
                         exit(EXIT_FAILURE);