Tests: start dnf-json-socket when needed
This commit is contained in:
parent
83e16afda4
commit
e6a6ed01ea
1 changed files with 11 additions and 0 deletions
|
|
@ -7,6 +7,9 @@ import os
|
|||
import sys
|
||||
import tempfile
|
||||
|
||||
def is_subprocess_succeeding(*args, **kwargs):
|
||||
sp = subprocess.run(*args, **kwargs, stdout=subprocess.PIPE)
|
||||
return sp.returncode == 0
|
||||
|
||||
def get_subprocess_stdout(*args, **kwargs):
|
||||
sp = subprocess.run(*args, **kwargs, stdout=subprocess.PIPE)
|
||||
|
|
@ -63,6 +66,14 @@ class TestCaseGenerator:
|
|||
def get_test_case(self, no_image_info, store):
|
||||
compose_request = json.dumps(self.test_case["compose-request"])
|
||||
|
||||
command = ["systemctl", "is-active", "--quiet", "osbuild-dnf-json.socket"]
|
||||
if not is_subprocess_succeeding(command):
|
||||
print("osbuild-dnf-json.socket is not running, starting it up")
|
||||
command = ["systemctl", "start", "osbuild-dnf-json.socket", "--quiet"]
|
||||
if not is_subprocess_succeeding(command):
|
||||
print("impossible to start osbuild-dnf-json.socket with systemd")
|
||||
sys.exit(1)
|
||||
|
||||
pipeline_command = ["go", "run", "./cmd/osbuild-pipeline", "-"]
|
||||
self.test_case["manifest"] = json.loads(get_subprocess_stdout(pipeline_command, input=compose_request, encoding="utf-8"))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue