+ context 'and Exec[apt_update] refreshonly is overridden to true and has recent run' do
+ let(:facts) do
+ {
+ os: {
+ family: 'Debian',
+ name: 'Debian',
+ release: {
+ major: '9',
+ full: '9.0',
+ },
+ distro: {
+ codename: 'stretch',
+ id: 'Debian',
+ },
+ },
+ 'apt_update_last_success': Time.now.to_i,
+ }
+ end
+ let(:pre_condition) do
+ "
+ class{'::apt': update => {'frequency' => 'always' },}
+ Exec <| title=='apt_update' |> { refreshonly => true }
+ "
+ end
+
+ it 'skips an apt-get update run' do
+ # set the apt_update exec's refreshonly attribute to false
+ is_expected.to contain_exec('apt_update').with('refreshonly' => true)
+ end
+ end