Skip to content
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

Avoid hardcoding year values #678

Merged
merged 4 commits into from
Jul 3, 2023
Merged
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
16 changes: 8 additions & 8 deletions spec/acceptance/integration_ntp_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
class { 'ntp': }
MANIFEST

it 'check the date is 2023 and set up the service' do
it 'check the date is current and set up the service' do
idempotent_apply(pp)
result = run_shell('date')
expect(result.stdout).to match(%r{2023})
expect(result.stdout).to match(%r{#{Time.now.year}})
end
end
end
Expand All @@ -27,26 +27,26 @@ class { 'ntp': }
after(:all) { reset_target_host }

describe 'go to the future' do
it 'install ntpdate and check its 2023' do
it 'install ntpdate and check the year is current' do
apply_manifest("package { 'ntpdate': ensure => present }")
result = run_shell('date')
expect(result.stdout).to match(%r{2023})
expect(result.stdout).to match(%r{#{Time.now.year}})
end

it 'disable ntp auto-sync' do
result = run_shell('timedatectl set-ntp false')
expect(result.exit_code).to eq(0)
end

it 'go forward to 2024' do
it 'go forward to to next year' do
result = run_shell('date --set="$(date --date="next year")"')
expect(result.stdout).to match(%r{2024})
expect(result.stdout).to match(%r{#{Time.now.year + 1}})
expect(result.exit_code).to eq(0)
end

it 'changed 2024' do
it 'changed to next year' do
result = run_shell('date')
expect(result.stdout).to match(%r{2024})
expect(result.stdout).to match(%r{#{Time.now.year + 1}})
end
end
end
Expand Down
Loading