-
Notifications
You must be signed in to change notification settings - Fork 270
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add autoyast test for yast2-ntp-client systemd timers #9988
Conversation
c4a4adb
to
1090638
Compare
c80d475
to
db3b454
Compare
605b0ba
to
cb0fa59
Compare
03ee938
to
a9ddb1e
Compare
095f947
to
46811df
Compare
cb7b1a6
to
f0ce9a3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some small changes and some ideas. Enjoy :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more thing not to forget is that we don't validate generated profile (clone installed system and validate ntp settings). Feel free to create follow up ticket for that, so we can merge this PR and proceed in the next iteration.
795d464
to
8df7e8a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only a comment for the copyright section and LATM
a119647
to
0bfa2df
Compare
my $expected_server = $test_data->{profile}->{'ntp-client'}->{ntp_servers}->{ntp_server}->{address}; | ||
my $chrony_conf = script_output("cat /etc/chrony.conf"); | ||
$chrony_conf =~ /(\R|^)pool\s(?<server>(\S+))/; | ||
assert_equals($expected_server, $+{server}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case of multiple server addresses, only the first one will be taken under consideration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it is ok for this test and probably not needed a comment as the regex does not have g
modifier /regex/g
so only one match is expected. Otherwise it would need a loop.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM besides those minor comments.
record_info("Check server", "Check if the configured time synchronization server is the expected one."); | ||
my $expected_server = $test_data->{profile}->{'ntp-client'}->{ntp_servers}->{ntp_server}->{address}; | ||
my $chrony_conf = script_output("cat /etc/chrony.conf"); | ||
$chrony_conf =~ /(\R|^)pool\s(?<server>(\S+))/; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor detail: why not just: ^pool\s(?<server>\S+)
? it would detect it even there is not line on top of the searched one and the parenthesis sorrounding \S+
probably not needed due to the named group already created a group.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought that since it is a conf file, somebody who might use the module could have comments above "pool" . In that case, ^pool wouldn't work. I just tried removing the parenthesis from \S+ and it also works. I will change that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comments starts with # in that file? sure it shouldn't match?
my $expected_server = $test_data->{profile}->{'ntp-client'}->{ntp_servers}->{ntp_server}->{address}; | ||
my $chrony_conf = script_output("cat /etc/chrony.conf"); | ||
$chrony_conf =~ /(\R|^)pool\s(?<server>(\S+))/; | ||
assert_equals($expected_server, $+{server}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it is ok for this test and probably not needed a comment as the regex does not have g
modifier /regex/g
so only one match is expected. Otherwise it would need a loop.
ntp_servers: | ||
ntp_server: | ||
address: cz.pool.ntp.org | ||
ntp_sync: 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As per our discussion, I will create ticket so we could use same format for validation and variables expansion in AY profiles.
yast2-ntp-client is using systemd timers instead of cron, when configured to perform one time synchronization. This test verifies that particular function works as configured.