Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
ntp-client
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ansible
ntp-client
Commits
2a6c00fd
Commit
2a6c00fd
authored
8 years ago
by
nimrod
Browse files
Options
Downloads
Patches
Plain Diff
- Added config check and status tests.
parent
efb7acd1
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_ntp.py
+22
-1
22 additions, 1 deletion
tests/test_ntp.py
with
22 additions
and
1 deletion
tests/test_ntp.py
+
22
−
1
View file @
2a6c00fd
...
...
@@ -3,7 +3,7 @@ from testinfra.utils.ansible_runner import AnsibleRunner
testinfra_hosts
=
AnsibleRunner
(
'
.molecule/ansible_inventory
'
).
get_hosts
(
'
all
'
)
def
test_ntp
(
Service
,
SystemInfo
):
def
test_ntp
_service
(
Service
,
SystemInfo
):
if
SystemInfo
.
type
==
'
openbsd
'
:
service
=
Service
(
'
ntpd
'
)
elif
SystemInfo
.
type
==
'
linux
'
:
...
...
@@ -16,3 +16,24 @@ def test_ntp(Service, SystemInfo):
assert
service
.
is_enabled
except
NotImplementedError
:
pass
def
test_ntp_config
(
SystemInfo
,
Command
):
if
SystemInfo
.
type
==
'
openbsd
'
or
(
SystemInfo
.
type
==
'
linux
'
and
SystemInfo
.
codename
not
in
[
'
jessie
'
,
'
stretch
'
,
'
xenial
'
]):
command
=
Command
(
'
ntpd -n
'
)
assert
command
.
rc
==
0
assert
'
configuration OK
'
in
command
.
stderr
def
test_ntp_status
(
SystemInfo
,
Command
):
if
SystemInfo
.
type
==
'
openbsd
'
:
assert
Command
(
'
ntpctl -s status
'
).
rc
==
0
assert
'
peers valid
'
in
Command
(
'
ntpctl -s status
'
).
stdout
elif
SystemInfo
.
type
==
'
linux
'
and
SystemInfo
.
codename
in
[
'
jessie
'
,
'
stretch
'
,
'
xenial
'
]:
command
=
Command
(
'
timedatectl status
'
)
assert
command
.
rc
==
0
assert
'
Network time on: yes
'
in
command
.
stdout
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment