|
617 | 617 | end
|
618 | 618 | end
|
619 | 619 |
|
| 620 | + context "#get_conf" do |
| 621 | + it "loads environment.conf" do |
| 622 | + cached_loader_from(:filesystem => [directory_tree], :directory => directory_tree.children.first) do |loader| |
| 623 | + expect(loader.get_conf(:an_environment)).to match_environment_conf(:an_environment). |
| 624 | + with_env_path(directory_tree.children.first). |
| 625 | + with_global_module_path([]) |
| 626 | + end |
| 627 | + end |
| 628 | + |
| 629 | + it "always reloads environment.conf" do |
| 630 | + env = Puppet::Node::Environment.create(:cached, []) |
| 631 | + mocked_loader = double('loader') |
| 632 | + expect(mocked_loader).to receive(:get_conf).with(:cached).and_return(Puppet::Settings::EnvironmentConf.static_for(env, 20)).twice |
| 633 | + |
| 634 | + cached = Puppet::Environments::Cached.new(mocked_loader) |
| 635 | + |
| 636 | + cached.get_conf(:cached) |
| 637 | + cached.get_conf(:cached) |
| 638 | + end |
| 639 | + |
| 640 | + it "returns nil if environment is not found" do |
| 641 | + cached_loader_from(:filesystem => [directory_tree], :directory => directory_tree.children.first) do |loader| |
| 642 | + expect(loader.get_conf(:doesnotexist)).to be_nil |
| 643 | + end |
| 644 | + end |
| 645 | + end |
| 646 | + |
620 | 647 | context "expiration policies" do
|
621 | 648 | let(:service) { ReplayExpirationService.new }
|
622 | 649 |
|
|
694 | 721 | end
|
695 | 722 | end
|
696 | 723 |
|
697 |
| - it "gets an environment.conf" do |
698 |
| - loader_from(:filesystem => [directory_tree], :directory => directory_tree.children.first) do |loader| |
699 |
| - expect(Puppet::Environments::Cached.new(loader).get_conf(:an_environment)).to match_environment_conf(:an_environment). |
700 |
| - with_env_path(directory_tree.children.first). |
701 |
| - with_global_module_path([]) |
702 |
| - end |
703 |
| - end |
704 |
| - |
705 | 724 | context '#clear' do
|
706 | 725 | let(:service) { ReplayExpirationService.new }
|
707 | 726 |
|
|
0 commit comments