|
| 1 | +# Copyright (c) 2025-present, Meta Platforms, Inc. and affiliates. |
| 2 | +# All rights reserved. |
| 3 | +# |
| 4 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +# you may not use this file except in compliance with the License. |
| 6 | +# You may obtain a copy of the License at |
| 7 | +# |
| 8 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +# |
| 10 | +# Unless required by applicable law or agreed to in writing, software |
| 11 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +# See the License for the specific language governing permissions and |
| 14 | +# limitations under the License. |
| 15 | + |
| 16 | +require './spec/spec_helper' |
| 17 | + |
| 18 | +recipe 'fb_logrotate::packages', :unsupported => [:mac_os_x] do |tc| |
| 19 | + let(:chef_run) do |
| 20 | + tc.chef_run |
| 21 | + end |
| 22 | + |
| 23 | + context 'when manage_packages is true' do |
| 24 | + it 'upgrades logrotate and pigz packages' do |
| 25 | + chef_run.converge(described_recipe) do |node| |
| 26 | + node.default['fb_logrotate']['manage_packages'] = true |
| 27 | + end |
| 28 | + expect(chef_run).to upgrade_package(%w{logrotate pigz}) |
| 29 | + end |
| 30 | + end |
| 31 | + |
| 32 | + context 'when manage_packages is false' do |
| 33 | + it 'does not upgrade logrotate and pigz packages' do |
| 34 | + chef_run.converge(described_recipe) do |node| |
| 35 | + node.default['fb_logrotate']['manage_packages'] = false |
| 36 | + end |
| 37 | + expect(chef_run).not_to upgrade_package(%w{logrotate pigz}) |
| 38 | + end |
| 39 | + end |
| 40 | +end |
0 commit comments