Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion testing/docker/ci_test_device1/Dockerfile
Original file line number Diff line number Diff line change
@@ -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

Expand Down
20 changes: 20 additions & 0 deletions testing/docker/ci_test_device1/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion testing/test_tests
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,6 @@ for tester in $TESTERS; do

done

pytest -s testing/test_tests.py
pytest -v testing/test_tests.py

exit $?
6 changes: 4 additions & 2 deletions testing/test_tests.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}

Expand Down
11 changes: 9 additions & 2 deletions testing/test_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
TEST_MATRIX = 'test_tests.json'
RESULTS_PATH = '/tmp/results/*.json'

#TODO add reason
@dataclass(frozen=True)
class TestResult:
name: str
Expand Down Expand Up @@ -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