improve system tests

- log import errors for test modules
- log output only on test failure
- improve docker system test container
- use go 1.19 in docker system tests
- download go dependencies in docker container
- system tests: color failues output
- imrpove test result output
- do not install golangci-lint in system tests
This commit is contained in:
André Roth
2024-07-23 13:05:25 +02:00
parent 9f1860dff7
commit 4a0bdcbb64
8 changed files with 75 additions and 61 deletions

View File

@@ -5,9 +5,9 @@ import random
import shutil
import string
import time
import tempfile
from lib import BaseTest
from testout import TestOut
try:
import requests
@@ -19,25 +19,6 @@ TASK_SUCCEEDED = 2
TASK_FAILED = 3
class AptlyStream:
def __init__(self):
self.tmp_file = tempfile.NamedTemporaryFile(delete=False)
self.read_pos = 0
def fileno(self):
return self.tmp_file.fileno()
def get_contents(self):
self.tmp_file.seek(self.read_pos, 0)
return self.tmp_file.read().decode("utf-8")
def close(self):
self.tmp_file.close()
def clear(self):
self.read_pos = self.tmp_file.tell()
class APITest(BaseTest):
"""
BaseTest + testing aptly API
@@ -62,7 +43,7 @@ class APITest(BaseTest):
if APITest.aptly_server is None:
super(APITest, self).prepare()
APITest.aptly_out = AptlyStream()
APITest.aptly_out = TestOut()
configPath = os.path.join(os.environ["HOME"], self.aptlyConfigFile)
APITest.aptly_server = self._start_process(f"aptly api serve -no-lock -config={configPath} -listen={self.base_url}", stdout=APITest.aptly_out, stderr=APITest.aptly_out)