diff --git a/testing/docker/ci_test_device1/Dockerfile b/testing/docker/ci_test_device1/Dockerfile index 0bb697509..4328946fd 100644 --- a/testing/docker/ci_test_device1/Dockerfile +++ b/testing/docker/ci_test_device1/Dockerfile @@ -1,6 +1,6 @@ FROM ubuntu:jammy - +ENV DEBIAN_FRONTEND=noninteractive #Update and get all additional requirements not contained in the base image RUN apt-get update && apt-get -y upgrade diff --git a/testing/docker/ci_test_device1/entrypoint.sh b/testing/docker/ci_test_device1/entrypoint.sh index 8113704be..9152af0c8 100755 --- a/testing/docker/ci_test_device1/entrypoint.sh +++ b/testing/docker/ci_test_device1/entrypoint.sh @@ -88,4 +88,24 @@ elif [ -n "${options[sshv1]}" ]; then /usr/local/sbin/sshd fi +# still testing - using fixed +if [ -n "${options[ntpv4_dhcp]}" ]; then + (while true; do + dhcp_ntp=$(fgrep NTPSERVERS= /run/ntpdate.dhcp) + if [ -n "${dhcp_ntp}" ]; then + ntp_server=`echo $dhcp_ntp | cut -d "'" -f 2` + echo NTP server from DHCP $ntp_server + fi + ntpdate -q -p 1 $ntp_server + sleep 5 + done) & +fi + +if [ -n "${options[ntpv3_time_google_com]}" ]; then + (while true; do + ntpdate -q -p 1 -o 3 time.google.com + sleep 5 + done) & +fi + tail -f /dev/null \ No newline at end of file diff --git a/testing/test_tests b/testing/test_tests index 6ba9fef94..ed14f1043 100755 --- a/testing/test_tests +++ b/testing/test_tests @@ -115,6 +115,6 @@ for tester in $TESTERS; do done -pytest -s testing/test_tests.py +pytest -v testing/test_tests.py exit $? diff --git a/testing/test_tests.json b/testing/test_tests.json index 076e9149e..179a3f7fc 100644 --- a/testing/test_tests.json +++ b/testing/test_tests.json @@ -9,10 +9,12 @@ }, "tester2": { "image": "test-run/ci_test1", - "args": "", + "args": "ntpv4_dhcp", "ethmac": "02:42:aa:00:00:02", "expected_results": { - "security.nmap.ports": "compliant" + "security.nmap.ports": "compliant", + "ntp.network.ntp_support": "compliant", + "ntp.network.ntp_dhcp": "compliant" } } diff --git a/testing/test_tests.py b/testing/test_tests.py index 7c60484f0..b61fdf064 100644 --- a/testing/test_tests.py +++ b/testing/test_tests.py @@ -29,6 +29,7 @@ TEST_MATRIX = 'test_tests.json' RESULTS_PATH = '/tmp/results/*.json' +#TODO add reason @dataclass(frozen=True) class TestResult: name: str @@ -90,13 +91,19 @@ def test_list_tests(capsys, results, test_matrix): if result == 'non-compliant']) with capsys.disabled(): + #TODO print matching the JSON schema for easy copy/paste print('============') print('============') print('tests seen:') print('\n'.join([x.name for x in all_tests])) print('\ntesting for pass:') print('\n'.join(ci_pass)) - print('\ntesting for pass:') - print('\n'.join(ci_pass)) + print('\ntesting for fail:') + print('\n'.join(ci_fail)) + print('\ntester results') + for tester in test_matrix.keys(): + print(f'\n{tester}:') + for test in collect_actual_results(results[tester]): + print(f'{test.name}: {test.result}') assert True