puppet 3.2.4 → 3.3.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of puppet might be problematic. Click here for more details.
- data/COMMITTERS.md +101 -42
- data/Gemfile +15 -4
- data/README.md +5 -1
- data/README_DEVELOPER.md +117 -54
- data/Rakefile +4 -0
- data/ext/build_defaults.yaml +3 -2
- data/ext/debian/puppet-common.manpages +33 -1
- data/ext/gentoo/init.d/puppet +1 -1
- data/ext/gentoo/init.d/puppetmaster +1 -1
- data/ext/redhat/puppet.spec.erb +0 -1
- data/install.rb +2 -1
- data/lib/hiera/backend/puppet_backend.rb +1 -1
- data/lib/puppet/application.rb +10 -9
- data/lib/puppet/application/agent.rb +87 -93
- data/lib/puppet/application/apply.rb +0 -2
- data/lib/puppet/application/device.rb +3 -3
- data/lib/puppet/application/kick.rb +2 -2
- data/lib/puppet/application/master.rb +41 -19
- data/lib/puppet/application/queue.rb +5 -3
- data/lib/puppet/bindings.rb +147 -0
- data/lib/puppet/configurer.rb +25 -15
- data/lib/puppet/configurer/fact_handler.rb +2 -9
- data/lib/puppet/daemon.rb +44 -33
- data/lib/puppet/defaults.rb +57 -26
- data/lib/puppet/error.rb +1 -1
- data/lib/puppet/external/dot.rb +2 -2
- data/lib/puppet/external/nagios/base.rb +1 -6
- data/lib/puppet/external/pson/common.rb +2 -2
- data/lib/puppet/external/pson/pure/generator.rb +2 -2
- data/lib/puppet/external/pson/pure/parser.rb +1 -1
- data/lib/puppet/face/ca.rb +1 -1
- data/lib/puppet/face/config.rb +1 -1
- data/lib/puppet/face/help.rb +2 -2
- data/lib/puppet/face/module/list.rb +2 -2
- data/lib/puppet/feature/rails.rb +1 -1
- data/lib/puppet/file_bucket/dipper.rb +0 -1
- data/lib/puppet/file_serving/base.rb +1 -1
- data/lib/puppet/file_serving/configuration/parser.rb +20 -14
- data/lib/puppet/forge.rb +0 -32
- data/lib/puppet/forge/cache.rb +1 -1
- data/lib/puppet/forge/errors.rb +3 -3
- data/lib/puppet/forge/repository.rb +7 -42
- data/lib/puppet/graph.rb +11 -0
- data/lib/puppet/graph/key.rb +26 -0
- data/lib/puppet/graph/prioritizer.rb +29 -0
- data/lib/puppet/graph/random_prioritizer.rb +16 -0
- data/lib/puppet/{rb_tree_map.rb → graph/rb_tree_map.rb} +3 -3
- data/lib/puppet/graph/relationship_graph.rb +246 -0
- data/lib/puppet/graph/sequential_prioritizer.rb +31 -0
- data/lib/puppet/{simple_graph.rb → graph/simple_graph.rb} +22 -3
- data/lib/puppet/graph/title_hash_prioritizer.rb +16 -0
- data/lib/puppet/indirector.rb +2 -2
- data/lib/puppet/indirector/catalog/compiler.rb +10 -7
- data/lib/puppet/indirector/catalog/static_compiler.rb +50 -0
- data/lib/puppet/indirector/certificate/rest.rb +1 -1
- data/lib/puppet/indirector/exec.rb +1 -1
- data/lib/puppet/indirector/facts/facter.rb +2 -2
- data/lib/puppet/indirector/facts/inventory_active_record.rb +0 -1
- data/lib/puppet/indirector/facts/network_device.rb +1 -1
- data/lib/puppet/indirector/file_bucket_file/file.rb +0 -1
- data/lib/puppet/indirector/indirection.rb +2 -2
- data/lib/puppet/indirector/memory.rb +9 -0
- data/lib/puppet/indirector/node/ldap.rb +2 -4
- data/lib/puppet/indirector/report/processor.rb +1 -2
- data/lib/puppet/indirector/report/rest.rb +1 -1
- data/lib/puppet/indirector/request.rb +32 -10
- data/lib/puppet/indirector/resource/rest.rb +1 -1
- data/lib/puppet/indirector/resource_type/parser.rb +31 -12
- data/lib/puppet/interface.rb +1 -1
- data/lib/puppet/interface/documentation.rb +7 -11
- data/lib/puppet/interface/option.rb +1 -1
- data/lib/puppet/interface/option_builder.rb +1 -1
- data/lib/puppet/metatype/manager.rb +2 -2
- data/lib/puppet/module.rb +7 -1
- data/lib/puppet/module_tool.rb +1 -1
- data/lib/puppet/module_tool/applications/application.rb +10 -0
- data/lib/puppet/module_tool/applications/installer.rb +6 -3
- data/lib/puppet/module_tool/dependency.rb +2 -0
- data/lib/puppet/module_tool/errors/upgrader.rb +1 -1
- data/lib/puppet/module_tool/metadata.rb +25 -13
- data/lib/puppet/module_tool/modulefile.rb +7 -7
- data/lib/puppet/module_tool/shared_behaviors.rb +4 -2
- data/lib/puppet/module_tool/skeleton.rb +1 -1
- data/lib/puppet/module_tool/skeleton/templates/generator/manifests/init.pp.erb +5 -5
- data/lib/puppet/module_tool/skeleton/templates/generator/tests/init.pp.erb +5 -4
- data/lib/puppet/network/auth_config_parser.rb +3 -0
- data/lib/puppet/network/authconfig.rb +0 -1
- data/lib/puppet/network/authorization.rb +1 -1
- data/lib/puppet/network/authstore.rb +2 -2
- data/lib/puppet/network/format_handler.rb +25 -114
- data/lib/puppet/network/format_support.rb +106 -0
- data/lib/puppet/network/formats.rb +10 -4
- data/lib/puppet/network/http/compression.rb +1 -1
- data/lib/puppet/network/http/connection.rb +76 -32
- data/lib/puppet/network/http/handler.rb +122 -61
- data/lib/puppet/network/http/rack/rest.rb +1 -1
- data/lib/puppet/network/http/webrick/rest.rb +9 -3
- data/lib/puppet/network/http_pool.rb +2 -2
- data/lib/puppet/network/resolver.rb +1 -0
- data/lib/puppet/network/server.rb +5 -81
- data/lib/puppet/node/environment.rb +256 -13
- data/lib/puppet/node/facts.rb +28 -2
- data/lib/puppet/parameter.rb +27 -18
- data/lib/puppet/parameter/boolean.rb +20 -0
- data/lib/puppet/parameter/path.rb +1 -1
- data/lib/puppet/parameter/value.rb +1 -1
- data/lib/puppet/parameter/value_collection.rb +1 -1
- data/lib/puppet/parser/ast/arithmetic_operator.rb +8 -0
- data/lib/puppet/parser/ast/casestatement.rb +0 -3
- data/lib/puppet/parser/ast/lambda.rb +25 -6
- data/lib/puppet/parser/ast/leaf.rb +10 -3
- data/lib/puppet/parser/ast/nop.rb +1 -1
- data/lib/puppet/parser/ast/resource_override.rb +0 -2
- data/lib/puppet/parser/compiler.rb +92 -34
- data/lib/puppet/parser/files.rb +0 -5
- data/lib/puppet/parser/functions/create_resources.rb +23 -46
- data/lib/puppet/parser/functions/each.rb +0 -2
- data/lib/puppet/parser/functions/extlookup.rb +2 -2
- data/lib/puppet/parser/functions/foreach.rb +0 -2
- data/lib/puppet/parser/functions/hiera_include.rb +1 -1
- data/lib/puppet/parser/functions/lookup.rb +44 -0
- data/lib/puppet/parser/functions/slice.rb +1 -1
- data/lib/puppet/parser/grammar.ra +0 -1
- data/lib/puppet/parser/lexer.rb +0 -1
- data/lib/puppet/parser/parser.rb +0 -1
- data/lib/puppet/parser/parser_factory.rb +3 -2
- data/lib/puppet/parser/parser_support.rb +1 -1
- data/lib/puppet/parser/relationship.rb +1 -1
- data/lib/puppet/parser/scope.rb +49 -24
- data/lib/puppet/parser/type_loader.rb +13 -18
- data/lib/puppet/pops.rb +45 -0
- data/lib/puppet/pops/adaptable.rb +2 -2
- data/lib/puppet/pops/adapters.rb +4 -0
- data/lib/puppet/pops/binder/binder.rb +421 -0
- data/lib/puppet/pops/binder/binder_issues.rb +142 -0
- data/lib/puppet/pops/binder/bindings_checker.rb +217 -0
- data/lib/puppet/pops/binder/bindings_composer.rb +241 -0
- data/lib/puppet/pops/binder/bindings_factory.rb +847 -0
- data/lib/puppet/pops/binder/bindings_label_provider.rb +46 -0
- data/lib/puppet/pops/binder/bindings_loader.rb +79 -0
- data/lib/puppet/pops/binder/bindings_model.rb +215 -0
- data/lib/puppet/pops/binder/bindings_model_dumper.rb +205 -0
- data/lib/puppet/pops/binder/bindings_validator_factory.rb +28 -0
- data/lib/puppet/pops/binder/config/binder_config.rb +139 -0
- data/lib/puppet/pops/binder/config/binder_config_checker.rb +183 -0
- data/lib/puppet/pops/binder/config/diagnostic_producer.rb +32 -0
- data/lib/puppet/pops/binder/config/issues.rb +106 -0
- data/lib/puppet/pops/binder/hiera2.rb +10 -0
- data/lib/puppet/pops/binder/hiera2/bindings_provider.rb +148 -0
- data/lib/puppet/pops/binder/hiera2/config.rb +69 -0
- data/lib/puppet/pops/binder/hiera2/config_checker.rb +68 -0
- data/lib/puppet/pops/binder/hiera2/diagnostic_producer.rb +36 -0
- data/lib/puppet/pops/binder/hiera2/issues.rb +67 -0
- data/lib/puppet/pops/binder/hiera2/json_backend.rb +18 -0
- data/lib/puppet/pops/binder/hiera2/yaml_backend.rb +21 -0
- data/lib/puppet/pops/binder/injector.rb +688 -0
- data/lib/puppet/pops/binder/injector_entry.rb +53 -0
- data/lib/puppet/pops/binder/key_factory.rb +61 -0
- data/lib/puppet/pops/binder/producers.rb +829 -0
- data/lib/puppet/pops/binder/scheme_handler/confdir_hiera_scheme.rb +67 -0
- data/lib/puppet/pops/binder/scheme_handler/confdir_scheme.rb +34 -0
- data/lib/puppet/pops/binder/scheme_handler/module_hiera_scheme.rb +92 -0
- data/lib/puppet/pops/binder/scheme_handler/module_scheme.rb +84 -0
- data/lib/puppet/pops/binder/scheme_handler/symbolic_scheme.rb +54 -0
- data/lib/puppet/pops/binder/system_bindings.rb +72 -0
- data/lib/puppet/pops/issue_reporter.rb +75 -0
- data/lib/puppet/pops/issues.rb +9 -5
- data/lib/puppet/pops/model/ast_transformer.rb +4 -4
- data/lib/puppet/pops/model/ast_tree_dumper.rb +1 -1
- data/lib/puppet/pops/model/factory.rb +25 -13
- data/lib/puppet/pops/model/model.rb +1 -1
- data/lib/puppet/pops/model/tree_dumper.rb +2 -2
- data/lib/puppet/pops/parser/egrammar.ra +0 -1
- data/lib/puppet/pops/parser/eparser.rb +1 -2
- data/lib/puppet/pops/parser/evaluating_parser.rb +162 -0
- data/lib/puppet/pops/parser/lexer.rb +8 -6
- data/lib/puppet/pops/types/class_loader.rb +118 -0
- data/lib/puppet/pops/types/type_calculator.rb +557 -0
- data/lib/puppet/pops/types/type_factory.rb +147 -0
- data/lib/puppet/pops/types/type_parser.rb +117 -0
- data/lib/puppet/pops/types/types.rb +132 -0
- data/lib/puppet/pops/validation.rb +146 -17
- data/lib/puppet/pops/validation/checker3_1.rb +1 -1
- data/lib/puppet/pops/validation/validator_factory_3_1.rb +6 -16
- data/lib/puppet/property.rb +3 -3
- data/lib/puppet/property/keyvalue.rb +1 -1
- data/lib/puppet/provider.rb +2 -2
- data/lib/puppet/provider/aixobject.rb +19 -21
- data/lib/puppet/provider/augeas/augeas.rb +3 -1
- data/lib/puppet/provider/command.rb +2 -2
- data/lib/puppet/provider/group/aix.rb +1 -1
- data/lib/puppet/provider/group/ldap.rb +1 -1
- data/lib/puppet/provider/macauthorization/macauthorization.rb +1 -1
- data/lib/puppet/provider/mailalias/aliases.rb +3 -8
- data/lib/puppet/provider/mcx/mcxcontent.rb +7 -1
- data/lib/puppet/provider/mount.rb +8 -3
- data/lib/puppet/provider/nameservice.rb +1 -1
- data/lib/puppet/provider/nameservice/directoryservice.rb +5 -5
- data/lib/puppet/provider/package/appdmg.rb +1 -1
- data/lib/puppet/provider/package/apt.rb +0 -1
- data/lib/puppet/provider/package/dpkg.rb +86 -32
- data/lib/puppet/provider/package/fink.rb +0 -2
- data/lib/puppet/provider/package/freebsd.rb +0 -2
- data/lib/puppet/provider/package/openbsd.rb +57 -10
- data/lib/puppet/provider/package/opkg.rb +0 -1
- data/lib/puppet/provider/package/pacman.rb +0 -1
- data/lib/puppet/provider/package/pip.rb +1 -1
- data/lib/puppet/provider/package/pkgdmg.rb +17 -6
- data/lib/puppet/provider/package/pkgutil.rb +1 -1
- data/lib/puppet/provider/package/portage.rb +9 -1
- data/lib/puppet/provider/package/ports.rb +2 -2
- data/lib/puppet/provider/package/rpm.rb +29 -12
- data/lib/puppet/provider/package/rug.rb +1 -1
- data/lib/puppet/provider/package/urpmi.rb +11 -15
- data/lib/puppet/provider/package/windows/exe_package.rb +1 -1
- data/lib/puppet/provider/package/windows/package.rb +1 -26
- data/lib/puppet/provider/package/yum.rb +1 -1
- data/lib/puppet/provider/package/zypper.rb +22 -3
- data/lib/puppet/provider/parsedfile.rb +1 -12
- data/lib/puppet/provider/scheduled_task/win32_taskscheduler.rb +1 -1
- data/lib/puppet/provider/service/base.rb +1 -1
- data/lib/puppet/provider/service/daemontools.rb +3 -3
- data/lib/puppet/provider/service/debian.rb +1 -1
- data/lib/puppet/provider/service/init.rb +14 -20
- data/lib/puppet/provider/service/openrc.rb +3 -1
- data/lib/puppet/provider/service/redhat.rb +5 -8
- data/lib/puppet/provider/service/runit.rb +3 -2
- data/lib/puppet/provider/service/systemd.rb +1 -1
- data/lib/puppet/provider/ssh_authorized_key/parsed.rb +1 -1
- data/lib/puppet/provider/sshkey/parsed.rb +0 -2
- data/lib/puppet/provider/user/aix.rb +25 -12
- data/lib/puppet/provider/user/directoryservice.rb +4 -7
- data/lib/puppet/provider/user/ldap.rb +0 -1
- data/lib/puppet/provider/user/user_role_add.rb +2 -0
- data/lib/puppet/provider/user/useradd.rb +1 -1
- data/lib/puppet/provider/zone/solaris.rb +1 -2
- data/lib/puppet/reference/metaparameter.rb +1 -1
- data/lib/puppet/reference/type.rb +1 -1
- data/lib/puppet/reports/rrdgraph.rb +1 -1
- data/lib/puppet/reports/tagmail.rb +1 -1
- data/lib/puppet/resource.rb +16 -4
- data/lib/puppet/resource/catalog.rb +111 -173
- data/lib/puppet/resource/status.rb +42 -3
- data/lib/puppet/resource/type.rb +33 -46
- data/lib/puppet/resource/type_collection.rb +19 -15
- data/lib/puppet/run.rb +5 -1
- data/lib/puppet/scheduler/scheduler.rb +14 -15
- data/lib/puppet/settings.rb +78 -41
- data/lib/puppet/settings/boolean_setting.rb +0 -2
- data/lib/puppet/settings/config_file.rb +0 -2
- data/lib/puppet/settings/directory_setting.rb +0 -2
- data/lib/puppet/settings/duration_setting.rb +0 -2
- data/lib/puppet/settings/enum_setting.rb +16 -0
- data/lib/puppet/settings/file_setting.rb +0 -2
- data/lib/puppet/settings/path_setting.rb +0 -2
- data/lib/puppet/settings/string_setting.rb +0 -3
- data/lib/puppet/settings/terminus_setting.rb +0 -2
- data/lib/puppet/ssl/certificate_authority.rb +102 -9
- data/lib/puppet/test/test_helper.rb +1 -0
- data/lib/puppet/transaction.rb +130 -292
- data/lib/puppet/transaction/additional_resource_generator.rb +126 -0
- data/lib/puppet/transaction/event.rb +16 -1
- data/lib/puppet/transaction/report.rb +34 -14
- data/lib/puppet/transaction/resource_harness.rb +16 -19
- data/lib/puppet/type.rb +59 -53
- data/lib/puppet/type/component.rb +0 -2
- data/lib/puppet/type/cron.rb +13 -2
- data/lib/puppet/type/exec.rb +5 -7
- data/lib/puppet/type/file.rb +9 -32
- data/lib/puppet/type/file/content.rb +4 -1
- data/lib/puppet/type/file/ctime.rb +3 -1
- data/lib/puppet/type/file/ensure.rb +1 -1
- data/lib/puppet/type/file/mode.rb +0 -1
- data/lib/puppet/type/file/mtime.rb +2 -1
- data/lib/puppet/type/group.rb +7 -9
- data/lib/puppet/type/host.rb +1 -2
- data/lib/puppet/type/mcx.rb +0 -1
- data/lib/puppet/type/mount.rb +38 -6
- data/lib/puppet/type/package.rb +2 -2
- data/lib/puppet/type/resources.rb +5 -4
- data/lib/puppet/type/schedule.rb +1 -4
- data/lib/puppet/type/selmodule.rb +1 -1
- data/lib/puppet/type/service.rb +1 -3
- data/lib/puppet/type/tidy.rb +3 -3
- data/lib/puppet/type/user.rb +9 -13
- data/lib/puppet/type/yumrepo.rb +11 -7
- data/lib/puppet/util.rb +14 -7
- data/lib/puppet/util/autoload.rb +0 -1
- data/lib/puppet/util/backups.rb +1 -3
- data/lib/puppet/util/classgen.rb +1 -1
- data/lib/puppet/util/command_line/puppet_option_parser.rb +1 -3
- data/lib/puppet/util/command_line/trollop.rb +1 -1
- data/lib/puppet/util/constant_inflector.rb +1 -2
- data/lib/puppet/util/errors.rb +1 -0
- data/lib/puppet/util/file_watcher.rb +28 -0
- data/lib/puppet/util/fileparsing.rb +1 -3
- data/lib/puppet/util/filetype.rb +0 -1
- data/lib/puppet/util/http_proxy.rb +38 -0
- data/lib/puppet/util/ldap/manager.rb +1 -2
- data/lib/puppet/util/log.rb +31 -10
- data/lib/puppet/util/log/destinations.rb +0 -50
- data/lib/puppet/util/metric.rb +8 -1
- data/lib/puppet/util/monkey_patches.rb +14 -148
- data/lib/puppet/util/network_device/cisco/facts.rb +1 -1
- data/lib/puppet/util/network_device/config.rb +6 -9
- data/lib/puppet/util/network_device/transport/ssh.rb +1 -1
- data/lib/puppet/util/pidlock.rb +3 -0
- data/lib/puppet/util/posix.rb +1 -1
- data/lib/puppet/util/profiler.rb +1 -1
- data/lib/puppet/util/rdoc.rb +1 -1
- data/lib/puppet/util/rdoc/generators/puppet_generator.rb +0 -1
- data/lib/puppet/util/rdoc/generators/template/puppet/puppet.rb +50 -42
- data/lib/puppet/util/retryaction.rb +0 -1
- data/lib/puppet/util/symbolic_file_mode.rb +5 -1
- data/lib/puppet/util/tagging.rb +0 -2
- data/lib/puppet/util/warnings.rb +3 -0
- data/lib/puppet/util/watched_file.rb +37 -0
- data/lib/puppet/util/watcher.rb +17 -0
- data/lib/puppet/util/watcher/change_watcher.rb +33 -0
- data/lib/puppet/util/watcher/periodic_watcher.rb +37 -0
- data/lib/puppet/util/watcher/timer.rb +19 -0
- data/lib/puppet/util/windows/user.rb +1 -1
- data/lib/puppet/version.rb +1 -1
- data/lib/puppetx.rb +109 -0
- data/lib/puppetx/puppet/bindings_scheme_handler.rb +130 -0
- data/lib/puppetx/puppet/hiera2_backend.rb +31 -0
- data/lib/puppetx/puppet/syntax_checker.rb +91 -0
- data/lib/puppetx/puppetlabs/syntax_checkers/json.rb +39 -0
- data/lib/semver.rb +1 -1
- data/man/man8/puppet-kick.8 +1 -1
- data/spec/fixtures/integration/provider/cron/crontab/unspecialized +15 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/hiera1config/binder_config.yaml +18 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/hiera1config/hiera.yaml +8 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/hiera1config/modules/good/common.yaml +1 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/hiera1config/modules/good/hiera.yaml +10 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/binder_config.yaml +19 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/common.yaml +1 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/hiera.yaml +11 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/localhost.yaml +1 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/modules/awesome/common.yaml +3 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/modules/awesome/hiera.yaml +13 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/modules/awesome/lib/puppet/bindings/awesome/default.rb +4 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/modules/awesome/lib/puppetx/awesome/echo_backend.rb +11 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/modules/awesome/lib/puppetx/awesome/echo_scheme_handler.rb +18 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/modules/awesome/localhost.yaml +1 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/modules/bad/common.yaml +3 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/modules/bad/hiera_config.yaml +9 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/modules/good/common.yaml +2 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/modules/good/hiera.yaml +11 -0
- data/spec/fixtures/unit/pops/binder/config/binder_config/ok/binder_config.yaml +9 -0
- data/spec/fixtures/unit/pops/binder/hiera2/bindings_provider/ok/hiera.yaml +9 -0
- data/spec/fixtures/unit/pops/binder/hiera2/bindings_provider/ok/node.example.com.json +9 -0
- data/spec/fixtures/unit/pops/binder/hiera2/bindings_provider/ok/node.example.com.yaml +5 -0
- data/spec/fixtures/unit/pops/binder/hiera2/config/bad_syntax/hiera.yaml +10 -0
- data/spec/fixtures/unit/pops/binder/hiera2/config/malformed_hierarchy/hiera.yaml +8 -0
- data/spec/fixtures/unit/pops/binder/hiera2/config/missing/foo.txt +1 -0
- data/spec/fixtures/unit/pops/binder/hiera2/config/no_backends/hiera.yaml +7 -0
- data/spec/fixtures/unit/pops/binder/hiera2/config/no_hierarchy/hiera.yaml +4 -0
- data/spec/fixtures/unit/pops/binder/hiera2/config/not_a_hash/hiera.yaml +2 -0
- data/spec/fixtures/unit/pops/binder/hiera2/config/ok/hiera.yaml +8 -0
- data/spec/fixtures/unit/pops/binder/hiera2/yaml_backend/empty/common.yaml +0 -0
- data/spec/fixtures/unit/pops/binder/hiera2/yaml_backend/invalid/common.yaml +1 -0
- data/spec/fixtures/unit/pops/binder/hiera2/yaml_backend/ok/common.yaml +2 -0
- data/spec/fixtures/unit/provider/package/openbsd/pkginfo_flavors.list +2 -0
- data/spec/integration/agent/logging_spec.rb +178 -0
- data/spec/integration/configurer_spec.rb +1 -1
- data/spec/integration/defaults_spec.rb +0 -6
- data/spec/integration/network/authconfig_spec.rb +19 -0
- data/spec/integration/network/server/webrick_spec.rb +10 -11
- data/spec/integration/parser/catalog_spec.rb +85 -0
- data/spec/integration/provider/cron/crontab_spec.rb +11 -0
- data/spec/integration/provider/mount_spec.rb +1 -0
- data/spec/integration/transaction_spec.rb +8 -8
- data/spec/integration/type/file_spec.rb +1 -1
- data/spec/integration/util/settings_spec.rb +58 -11
- data/spec/lib/matchers/include_in_order.rb +21 -0
- data/spec/lib/matchers/include_in_order_spec.rb +30 -0
- data/spec/lib/matchers/relationship_graph_matchers.rb +48 -0
- data/spec/lib/puppet_spec/compiler.rb +24 -0
- data/spec/lib/puppet_spec/pops.rb +16 -0
- data/spec/spec_helper.rb +0 -1
- data/spec/unit/application/agent_spec.rb +145 -145
- data/spec/unit/application/apply_spec.rb +1 -1
- data/spec/unit/application/doc_spec.rb +1 -1
- data/spec/unit/application/face_base_spec.rb +3 -3
- data/spec/unit/application/facts_spec.rb +1 -0
- data/spec/unit/application/master_spec.rb +0 -15
- data/spec/unit/application/queue_spec.rb +6 -12
- data/spec/unit/application/resource_spec.rb +1 -1
- data/spec/unit/configurer/fact_handler_spec.rb +19 -50
- data/spec/unit/configurer_spec.rb +23 -7
- data/spec/unit/daemon_spec.rb +97 -121
- data/spec/unit/defaults_spec.rb +44 -0
- data/spec/unit/face/node_spec.rb +2 -2
- data/spec/unit/file_serving/configuration/parser_spec.rb +23 -33
- data/spec/unit/file_serving/configuration_spec.rb +2 -2
- data/spec/unit/file_serving/mount/file_spec.rb +4 -4
- data/spec/unit/forge/repository_spec.rb +9 -29
- data/spec/unit/graph/key_spec.rb +41 -0
- data/spec/unit/{rb_tree_map_spec.rb → graph/rb_tree_map_spec.rb} +7 -7
- data/spec/unit/graph/relationship_graph_spec.rb +393 -0
- data/spec/unit/graph/sequential_prioritizer_spec.rb +32 -0
- data/spec/unit/{simple_graph_spec.rb → graph/simple_graph.rb} +42 -254
- data/spec/unit/graph/title_hash_prioritizer_spec.rb +49 -0
- data/spec/unit/hiera_puppet_spec.rb +1 -1
- data/spec/unit/indirector/catalog/active_record_spec.rb +4 -2
- data/spec/unit/indirector/catalog/compiler_spec.rb +20 -26
- data/spec/unit/indirector/face_spec.rb +1 -1
- data/spec/unit/indirector/facts/facter_spec.rb +11 -1
- data/spec/unit/indirector/facts/network_device_spec.rb +11 -1
- data/spec/unit/indirector/hiera_spec.rb +1 -1
- data/spec/unit/indirector/instrumentation_data/local_spec.rb +1 -1
- data/spec/unit/indirector/instrumentation_listener/local_spec.rb +1 -1
- data/spec/unit/indirector/request_spec.rb +92 -39
- data/spec/unit/indirector/rest_spec.rb +1 -0
- data/spec/unit/indirector_spec.rb +2 -2
- data/spec/unit/interface/option_builder_spec.rb +1 -0
- data/spec/unit/interface/option_spec.rb +1 -0
- data/spec/unit/interface_spec.rb +2 -2
- data/spec/unit/module_tool/applications/installer_spec.rb +49 -2
- data/spec/unit/module_tool/metadata_spec.rb +13 -0
- data/spec/unit/network/authstore_spec.rb +1 -1
- data/spec/unit/network/format_handler_spec.rb +33 -282
- data/spec/unit/network/format_support_spec.rb +199 -0
- data/spec/unit/network/formats_spec.rb +2 -2
- data/spec/unit/network/http/connection_spec.rb +88 -7
- data/spec/unit/network/http/handler_spec.rb +271 -249
- data/spec/unit/network/http/rack/rest_spec.rb +1 -1
- data/spec/unit/network/http/webrick/rest_spec.rb +73 -22
- data/spec/unit/network/http_pool_spec.rb +40 -0
- data/spec/unit/network/server_spec.rb +18 -207
- data/spec/unit/node/facts_spec.rb +68 -17
- data/spec/unit/other/selinux_spec.rb +24 -20
- data/spec/unit/parameter/boolean_spec.rb +25 -0
- data/spec/unit/parameter/value_collection_spec.rb +7 -7
- data/spec/unit/parameter_spec.rb +10 -13
- data/spec/unit/parser/ast/function_spec.rb +4 -4
- data/spec/unit/parser/ast/leaf_spec.rb +45 -6
- data/spec/unit/parser/collector_spec.rb +3 -3
- data/spec/unit/parser/compiler_spec.rb +4 -3
- data/spec/unit/parser/functions/create_resources_spec.rb +9 -25
- data/spec/unit/parser/functions/extlookup_spec.rb +2 -2
- data/spec/unit/parser/functions/hiera_include_spec.rb +12 -0
- data/spec/unit/parser/functions/lookup_spec.rb +96 -0
- data/spec/unit/parser/functions/regsubst_spec.rb +2 -2
- data/spec/unit/parser/functions/split_spec.rb +2 -2
- data/spec/unit/parser/functions/sprintf_spec.rb +1 -1
- data/spec/unit/parser/functions/versioncmp_spec.rb +2 -2
- data/spec/unit/parser/functions_spec.rb +7 -7
- data/spec/unit/parser/lexer_spec.rb +1 -1
- data/spec/unit/parser/methods/collect_spec.rb +43 -0
- data/spec/unit/parser/resource_spec.rb +9 -9
- data/spec/unit/parser/scope_spec.rb +45 -2
- data/spec/unit/parser/type_loader_spec.rb +159 -175
- data/spec/unit/pops/binder/binder_spec.rb +62 -0
- data/spec/unit/pops/binder/bindings_checker_spec.rb +196 -0
- data/spec/unit/pops/binder/bindings_composer_spec.rb +89 -0
- data/spec/unit/pops/binder/bindings_validator_factory_spec.rb +18 -0
- data/spec/unit/pops/binder/config/binder_config_spec.rb +48 -0
- data/spec/unit/pops/binder/hiera2/bindings_provider_spec.rb +74 -0
- data/spec/unit/pops/binder/hiera2/config_spec.rb +61 -0
- data/spec/unit/pops/binder/hiera2/yaml_backend_spec.rb +33 -0
- data/spec/unit/pops/binder/injector_spec.rb +789 -0
- data/spec/unit/pops/containment_spec.rb +1 -0
- data/spec/unit/pops/issues_spec.rb +1 -1
- data/spec/unit/pops/parser/evaluating_parser_spec.rb +88 -0
- data/spec/unit/pops/parser/lexer_spec.rb +1 -1
- data/spec/unit/pops/parser/parse_calls_spec.rb +4 -0
- data/spec/unit/pops/parser/parser_spec.rb +1 -1
- data/spec/unit/pops/types/type_calculator_spec.rb +484 -0
- data/spec/unit/pops/types/type_factory_spec.rb +65 -0
- data/spec/unit/pops/types/type_parser_spec.rb +93 -0
- data/spec/unit/property/list_spec.rb +1 -1
- data/spec/unit/property/ordered_list_spec.rb +1 -1
- data/spec/unit/provider/aixobject_spec.rb +101 -0
- data/spec/unit/provider/augeas/augeas_spec.rb +14 -3
- data/spec/unit/provider/mcx/mcxcontent_spec.rb +52 -16
- data/spec/unit/provider/mount/parsed_spec.rb +44 -56
- data/spec/unit/provider/mount_spec.rb +11 -2
- data/spec/unit/provider/naginator_spec.rb +8 -0
- data/spec/unit/provider/package/apt_spec.rb +5 -1
- data/spec/unit/provider/package/aptitude_spec.rb +9 -5
- data/spec/unit/provider/package/aptrpm_spec.rb +2 -2
- data/spec/unit/provider/package/dpkg_spec.rb +274 -99
- data/spec/unit/provider/package/openbsd_spec.rb +84 -1
- data/spec/unit/provider/package/opkg_spec.rb +3 -3
- data/spec/unit/provider/package/pip_spec.rb +16 -0
- data/spec/unit/provider/package/pkgdmg_spec.rb +62 -7
- data/spec/unit/provider/package/rpm_spec.rb +112 -21
- data/spec/unit/provider/package/urpmi.rb +80 -0
- data/spec/unit/provider/package/windows/exe_package_spec.rb +1 -1
- data/spec/unit/provider/package/yum_spec.rb +85 -0
- data/spec/unit/provider/package/zypper_spec.rb +25 -6
- data/spec/unit/provider/parsedfile_spec.rb +3 -2
- data/spec/unit/provider/service/init_spec.rb +10 -10
- data/spec/unit/provider/service/openrc_spec.rb +16 -0
- data/spec/unit/provider/service/openwrt_spec.rb +1 -1
- data/spec/unit/provider/service/redhat_spec.rb +7 -0
- data/spec/unit/provider/ssh_authorized_key/parsed_spec.rb +2 -2
- data/spec/unit/provider/user/aix_spec.rb +89 -0
- data/spec/unit/provider/user/directoryservice_spec.rb +11 -4
- data/spec/unit/provider/user/user_role_add_spec.rb +18 -0
- data/spec/unit/provider_spec.rb +2 -13
- data/spec/unit/reports/http_spec.rb +1 -1
- data/spec/unit/resource/catalog_spec.rb +23 -97
- data/spec/unit/resource/resource_type.json +34 -0
- data/spec/unit/resource/status_spec.rb +56 -0
- data/spec/unit/resource/type_collection_spec.rb +6 -6
- data/spec/unit/resource/type_spec.rb +25 -5
- data/spec/unit/resource_spec.rb +68 -24
- data/spec/unit/run_spec.rb +16 -0
- data/spec/unit/scheduler/scheduler_spec.rb +14 -27
- data/spec/unit/semver_spec.rb +5 -0
- data/spec/unit/settings/enum_setting_spec.rb +27 -0
- data/spec/unit/settings_spec.rb +53 -44
- data/spec/unit/ssl/certificate_authority_spec.rb +155 -19
- data/spec/unit/transaction/additional_resource_generator_spec.rb +419 -0
- data/spec/unit/transaction/event_manager_spec.rb +2 -2
- data/spec/unit/transaction/event_spec.rb +57 -0
- data/spec/unit/transaction/report_spec.rb +66 -0
- data/spec/unit/transaction/resource_harness_spec.rb +27 -20
- data/spec/unit/transaction_spec.rb +182 -390
- data/spec/unit/type/augeas_spec.rb +3 -3
- data/spec/unit/type/component_spec.rb +0 -9
- data/spec/unit/type/computer_spec.rb +1 -1
- data/spec/unit/type/cron_spec.rb +2 -2
- data/spec/unit/type/exec_spec.rb +4 -2
- data/spec/unit/type/file/content_spec.rb +11 -0
- data/spec/unit/type/file/group_spec.rb +1 -1
- data/spec/unit/type/file_spec.rb +16 -8
- data/spec/unit/type/mount_spec.rb +445 -259
- data/spec/unit/type/package_spec.rb +4 -4
- data/spec/unit/type/resources_spec.rb +30 -1
- data/spec/unit/type/user_spec.rb +26 -3
- data/spec/unit/type/yumrepo_spec.rb +7 -27
- data/spec/unit/type/zone_spec.rb +4 -1
- data/spec/unit/type_spec.rb +66 -33
- data/spec/unit/util/backups_spec.rb +3 -3
- data/spec/unit/util/http_proxy_spec.rb +83 -0
- data/spec/unit/util/log_spec.rb +79 -8
- data/spec/unit/util/metric_spec.rb +12 -0
- data/spec/unit/util/monkey_patches_spec.rb +6 -0
- data/spec/unit/util/network_device/config_spec.rb +26 -64
- data/spec/unit/util/pidlock_spec.rb +4 -1
- data/spec/unit/util/tagging_spec.rb +5 -9
- data/spec/unit/util/warnings_spec.rb +1 -1
- data/spec/unit/util/watched_file_spec.rb +52 -0
- data/spec/unit/util/watcher/periodic_watcher_spec.rb +52 -0
- data/spec/unit/util/watcher_spec.rb +56 -0
- data/spec/unit/util_spec.rb +16 -0
- metadata +2767 -2576
- data/ext/debian/puppet.manpages +0 -32
- data/ext/osx/PackageInfo.plist +0 -36
- data/ext/osx/createpackage.sh +0 -187
- data/ext/redhat/rundir-perms.patch +0 -28
- data/lib/puppet/external/base64.rb +0 -19
- data/lib/puppet/util/graph.rb +0 -27
- data/lib/puppet/util/loadedfile.rb +0 -61
- data/lib/puppet/util/log_paths.rb +0 -22
- data/lib/puppet/util/subclass_loader.rb +0 -78
- data/spec/monkey_patches/publicize_methods.rb +0 -11
- data/spec/unit/util/loadedfile_spec.rb +0 -71
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'puppet/settings'
|
3
|
+
|
4
|
+
describe "Defaults" do
|
5
|
+
describe ".default_diffargs" do
|
6
|
+
describe "on AIX" do
|
7
|
+
before(:each) do
|
8
|
+
Facter.stubs(:value).with(:kernel).returns("AIX")
|
9
|
+
end
|
10
|
+
describe "on 5.3" do
|
11
|
+
before(:each) do
|
12
|
+
Facter.stubs(:value).with(:kernelmajversion).returns("5300")
|
13
|
+
end
|
14
|
+
it "should be empty" do
|
15
|
+
Puppet.default_diffargs.should == ""
|
16
|
+
end
|
17
|
+
end
|
18
|
+
[ "",
|
19
|
+
nil,
|
20
|
+
"6300",
|
21
|
+
"7300",
|
22
|
+
].each do |kernel_version|
|
23
|
+
describe "on kernel version #{kernel_version.inspect}" do
|
24
|
+
before(:each) do
|
25
|
+
Facter.stubs(:value).with(:kernelmajversion).returns(kernel_version)
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should be '-u'" do
|
29
|
+
Puppet.default_diffargs.should == "-u"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
describe "on everything else" do
|
35
|
+
before(:each) do
|
36
|
+
Facter.stubs(:value).with(:kernel).returns("NOT_AIX")
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should be '-u'" do
|
40
|
+
Puppet.default_diffargs.should == "-u"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
data/spec/unit/face/node_spec.rb
CHANGED
@@ -67,8 +67,8 @@ describe Puppet::Face[:node, '0.0.1'] do
|
|
67
67
|
|
68
68
|
it "should accept the option --unexport" do
|
69
69
|
expect {
|
70
|
-
subject.
|
71
|
-
}.to_not raise_error
|
70
|
+
subject.clean('hostname', :unexport => true)
|
71
|
+
}.to_not raise_error
|
72
72
|
end
|
73
73
|
|
74
74
|
context "clean action" do
|
@@ -3,30 +3,20 @@ require 'spec_helper'
|
|
3
3
|
|
4
4
|
require 'puppet/file_serving/configuration/parser'
|
5
5
|
|
6
|
-
describe Puppet::FileServing::Configuration::Parser do
|
7
|
-
it "should subclass the LoadedFile class" do
|
8
|
-
Puppet::FileServing::Configuration::Parser.superclass.should equal(Puppet::Util::LoadedFile)
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
6
|
|
13
7
|
module FSConfigurationParserTesting
|
14
|
-
def
|
8
|
+
def write_config_file(content)
|
15
9
|
# We want an array, but we actually want our carriage returns on all of it.
|
16
|
-
|
17
|
-
@filehandle.stubs(:each_line).multiple_yields(*lines)
|
18
|
-
@filehandle.expects(:each).never
|
10
|
+
File.open(@path, 'w') {|f| f.puts content}
|
19
11
|
end
|
20
12
|
end
|
21
13
|
|
22
14
|
describe Puppet::FileServing::Configuration::Parser do
|
15
|
+
include PuppetSpec::Files
|
16
|
+
|
23
17
|
before :each do
|
24
|
-
@path =
|
25
|
-
|
26
|
-
FileTest.stubs(:readable?).with(@path).returns(true)
|
27
|
-
@filehandle = mock 'filehandle'
|
28
|
-
@filehandle.expects(:each).never
|
29
|
-
File.expects(:open).with(@path).yields(@filehandle)
|
18
|
+
@path = tmpfile('fileserving_config')
|
19
|
+
FileUtils.touch(@path)
|
30
20
|
@parser = Puppet::FileServing::Configuration::Parser.new(@path)
|
31
21
|
end
|
32
22
|
|
@@ -34,12 +24,12 @@ describe Puppet::FileServing::Configuration::Parser do
|
|
34
24
|
include FSConfigurationParserTesting
|
35
25
|
|
36
26
|
it "should allow comments" do
|
37
|
-
|
27
|
+
write_config_file("# this is a comment\n")
|
38
28
|
proc { @parser.parse }.should_not raise_error
|
39
29
|
end
|
40
30
|
|
41
31
|
it "should allow blank lines" do
|
42
|
-
|
32
|
+
write_config_file("\n")
|
43
33
|
proc { @parser.parse }.should_not raise_error
|
44
34
|
end
|
45
35
|
|
@@ -48,7 +38,7 @@ describe Puppet::FileServing::Configuration::Parser do
|
|
48
38
|
mount2 = mock 'two', :validate => true
|
49
39
|
Puppet::FileServing::Mount::File.expects(:new).with("one").returns(mount1)
|
50
40
|
Puppet::FileServing::Mount::File.expects(:new).with("two").returns(mount2)
|
51
|
-
|
41
|
+
write_config_file "[one]\n[two]\n"
|
52
42
|
@parser.parse
|
53
43
|
end
|
54
44
|
|
@@ -58,7 +48,7 @@ describe Puppet::FileServing::Configuration::Parser do
|
|
58
48
|
mount2 = mock 'two', :validate => true
|
59
49
|
Puppet::FileServing::Mount::File.expects(:new).with("one").returns(mount1)
|
60
50
|
Puppet::FileServing::Mount::File.expects(:new).with("two").returns(mount2)
|
61
|
-
|
51
|
+
write_config_file "[one]\n[two]\n"
|
62
52
|
|
63
53
|
result = @parser.parse
|
64
54
|
result["one"].should equal(mount1)
|
@@ -66,19 +56,19 @@ describe Puppet::FileServing::Configuration::Parser do
|
|
66
56
|
end
|
67
57
|
|
68
58
|
it "should only allow mount names that are alphanumeric plus dashes" do
|
69
|
-
|
59
|
+
write_config_file "[a*b]\n"
|
70
60
|
proc { @parser.parse }.should raise_error(ArgumentError)
|
71
61
|
end
|
72
62
|
|
73
63
|
it "should fail if the value for path/allow/deny starts with an equals sign" do
|
74
|
-
|
64
|
+
write_config_file "[one]\npath = /testing"
|
75
65
|
proc { @parser.parse }.should raise_error(ArgumentError)
|
76
66
|
end
|
77
67
|
|
78
68
|
it "should validate each created mount" do
|
79
69
|
mount1 = mock 'one'
|
80
70
|
Puppet::FileServing::Mount::File.expects(:new).with("one").returns(mount1)
|
81
|
-
|
71
|
+
write_config_file "[one]\n"
|
82
72
|
|
83
73
|
mount1.expects(:validate)
|
84
74
|
|
@@ -88,7 +78,7 @@ describe Puppet::FileServing::Configuration::Parser do
|
|
88
78
|
it "should fail if any mount does not pass validation" do
|
89
79
|
mount1 = mock 'one'
|
90
80
|
Puppet::FileServing::Mount::File.expects(:new).with("one").returns(mount1)
|
91
|
-
|
81
|
+
write_config_file "[one]\n"
|
92
82
|
|
93
83
|
mount1.expects(:validate).raises RuntimeError
|
94
84
|
|
@@ -106,14 +96,14 @@ describe Puppet::FileServing::Configuration::Parser do
|
|
106
96
|
end
|
107
97
|
|
108
98
|
it "should set the mount path to the path attribute from that section" do
|
109
|
-
|
99
|
+
write_config_file "[one]\npath /some/path\n"
|
110
100
|
|
111
101
|
@mount.expects(:path=).with("/some/path")
|
112
102
|
@parser.parse
|
113
103
|
end
|
114
104
|
|
115
105
|
it "should tell the mount to allow any allow values from the section" do
|
116
|
-
|
106
|
+
write_config_file "[one]\nallow something\n"
|
117
107
|
|
118
108
|
@mount.expects(:info)
|
119
109
|
@mount.expects(:allow).with("something")
|
@@ -121,7 +111,7 @@ describe Puppet::FileServing::Configuration::Parser do
|
|
121
111
|
end
|
122
112
|
|
123
113
|
it "should support inline comments" do
|
124
|
-
|
114
|
+
write_config_file "[one]\nallow something \# will it work?\n"
|
125
115
|
|
126
116
|
@mount.expects(:info)
|
127
117
|
@mount.expects(:allow).with("something")
|
@@ -129,7 +119,7 @@ describe Puppet::FileServing::Configuration::Parser do
|
|
129
119
|
end
|
130
120
|
|
131
121
|
it "should tell the mount to deny any deny values from the section" do
|
132
|
-
|
122
|
+
write_config_file "[one]\ndeny something\n"
|
133
123
|
|
134
124
|
@mount.expects(:info)
|
135
125
|
@mount.expects(:deny).with("something")
|
@@ -137,7 +127,7 @@ describe Puppet::FileServing::Configuration::Parser do
|
|
137
127
|
end
|
138
128
|
|
139
129
|
it "should fail on any attributes other than path, allow, and deny" do
|
140
|
-
|
130
|
+
write_config_file "[one]\ndo something\n"
|
141
131
|
|
142
132
|
proc { @parser.parse }.should raise_error(ArgumentError)
|
143
133
|
end
|
@@ -151,14 +141,14 @@ describe Puppet::FileServing::Configuration::Parser do
|
|
151
141
|
end
|
152
142
|
|
153
143
|
it "should create an instance of the Modules Mount class" do
|
154
|
-
|
144
|
+
write_config_file "[modules]\n"
|
155
145
|
|
156
146
|
Puppet::FileServing::Mount::Modules.expects(:new).with("modules").returns @mount
|
157
147
|
@parser.parse
|
158
148
|
end
|
159
149
|
|
160
150
|
it "should warn if a path is set" do
|
161
|
-
|
151
|
+
write_config_file "[modules]\npath /some/path\n"
|
162
152
|
Puppet::FileServing::Mount::Modules.expects(:new).with("modules").returns(@mount)
|
163
153
|
|
164
154
|
Puppet.expects(:warning)
|
@@ -174,14 +164,14 @@ describe Puppet::FileServing::Configuration::Parser do
|
|
174
164
|
end
|
175
165
|
|
176
166
|
it "should create an instance of the Plugins Mount class" do
|
177
|
-
|
167
|
+
write_config_file "[plugins]\n"
|
178
168
|
|
179
169
|
Puppet::FileServing::Mount::Plugins.expects(:new).with("plugins").returns @mount
|
180
170
|
@parser.parse
|
181
171
|
end
|
182
172
|
|
183
173
|
it "should warn if a path is set" do
|
184
|
-
|
174
|
+
write_config_file "[plugins]\npath /some/path\n"
|
185
175
|
|
186
176
|
Puppet.expects(:warning)
|
187
177
|
@parser.parse
|
@@ -167,13 +167,13 @@ describe Puppet::FileServing::Configuration do
|
|
167
167
|
it "should fail if the mount name is not alpha-numeric" do
|
168
168
|
request.expects(:key).returns "foo&bar/asdf"
|
169
169
|
|
170
|
-
|
170
|
+
expect { config.split_path(request) }.to raise_error(ArgumentError)
|
171
171
|
end
|
172
172
|
|
173
173
|
it "should support dashes in the mount name" do
|
174
174
|
request.expects(:key).returns "foo-bar/asdf"
|
175
175
|
|
176
|
-
|
176
|
+
expect { config.split_path(request) }.to_not raise_error
|
177
177
|
end
|
178
178
|
|
179
179
|
it "should use the mount name and environment to find the mount" do
|
@@ -11,7 +11,7 @@ end
|
|
11
11
|
|
12
12
|
describe Puppet::FileServing::Mount::File do
|
13
13
|
it "should be invalid if it does not have a path" do
|
14
|
-
|
14
|
+
expect { Puppet::FileServing::Mount::File.new("foo").validate }.to raise_error(ArgumentError)
|
15
15
|
end
|
16
16
|
|
17
17
|
it "should be valid if it has a path" do
|
@@ -19,7 +19,7 @@ describe Puppet::FileServing::Mount::File do
|
|
19
19
|
FileTest.stubs(:readable?).returns true
|
20
20
|
mount = Puppet::FileServing::Mount::File.new("foo")
|
21
21
|
mount.path = "/foo"
|
22
|
-
|
22
|
+
expect { mount.validate }.not_to raise_error
|
23
23
|
end
|
24
24
|
|
25
25
|
describe "when setting the path" do
|
@@ -30,13 +30,13 @@ describe Puppet::FileServing::Mount::File do
|
|
30
30
|
|
31
31
|
it "should fail if the path is not a directory" do
|
32
32
|
FileTest.expects(:directory?).returns(false)
|
33
|
-
|
33
|
+
expect { @mount.path = @dir }.to raise_error(ArgumentError)
|
34
34
|
end
|
35
35
|
|
36
36
|
it "should fail if the path is not readable" do
|
37
37
|
FileTest.expects(:directory?).returns(true)
|
38
38
|
FileTest.expects(:readable?).returns(false)
|
39
|
-
|
39
|
+
expect { @mount.path = @dir }.to raise_error(ArgumentError)
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
@@ -11,39 +11,19 @@ describe Puppet::Forge::Repository do
|
|
11
11
|
let(:ssl_repository) { Puppet::Forge::Repository.new('https://fake.com', consumer_version) }
|
12
12
|
|
13
13
|
it "retrieve accesses the cache" do
|
14
|
-
|
15
|
-
repository.cache.expects(:retrieve)
|
14
|
+
path = '/module/foo.tar.gz'
|
15
|
+
repository.cache.expects(:retrieve)
|
16
16
|
|
17
|
-
repository.retrieve(
|
17
|
+
repository.retrieve(path)
|
18
18
|
end
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
it "supports environment variable for port and host" do
|
26
|
-
ENV["http_proxy"] = "http://test.com:8011"
|
27
|
-
|
28
|
-
repository.http_proxy_host.should == "test.com"
|
29
|
-
repository.http_proxy_port.should == 8011
|
30
|
-
end
|
31
|
-
|
32
|
-
it "supports puppet configuration for port and host" do
|
33
|
-
ENV["http_proxy"] = nil
|
34
|
-
proxy_settings_of('test.com', 7456)
|
20
|
+
it "retrieve merges forge URI and path specified" do
|
21
|
+
path = '/module/foo.tar.gz'
|
22
|
+
repo_uri = 'http://fake.com/test'
|
23
|
+
repository = Puppet::Forge::Repository.new(repo_uri, consumer_version)
|
24
|
+
repository.cache.expects(:retrieve).with(URI.parse(repo_uri+path))
|
35
25
|
|
36
|
-
|
37
|
-
repository.http_proxy_host.should == "test.com"
|
38
|
-
end
|
39
|
-
|
40
|
-
it "uses environment variable before puppet settings" do
|
41
|
-
ENV["http_proxy"] = "http://test1.com:8011"
|
42
|
-
proxy_settings_of('test2.com', 7456)
|
43
|
-
|
44
|
-
repository.http_proxy_host.should == "test1.com"
|
45
|
-
repository.http_proxy_port.should == 8011
|
46
|
-
end
|
26
|
+
repository.retrieve(path)
|
47
27
|
end
|
48
28
|
|
49
29
|
describe "making a request" do
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
require 'puppet/graph'
|
4
|
+
|
5
|
+
describe Puppet::Graph::Key do
|
6
|
+
it "produces the next in the sequence" do
|
7
|
+
key = Puppet::Graph::Key.new
|
8
|
+
|
9
|
+
expect(key.next).to be > key
|
10
|
+
end
|
11
|
+
|
12
|
+
it "produces a key after itself but before next" do
|
13
|
+
key = Puppet::Graph::Key.new
|
14
|
+
expect(key.down).to be > key
|
15
|
+
expect(key.down).to be < key.next
|
16
|
+
end
|
17
|
+
|
18
|
+
it "downward keys of the same group are in sequence" do
|
19
|
+
key = Puppet::Graph::Key.new
|
20
|
+
|
21
|
+
first = key.down
|
22
|
+
middle = key.down.next
|
23
|
+
last = key.down.next.next
|
24
|
+
|
25
|
+
expect(first).to be < middle
|
26
|
+
expect(middle).to be < last
|
27
|
+
expect(last).to be < key.next
|
28
|
+
end
|
29
|
+
|
30
|
+
it "downward keys in sequential groups are in sequence" do
|
31
|
+
key = Puppet::Graph::Key.new
|
32
|
+
|
33
|
+
first = key.down
|
34
|
+
middle = key.next
|
35
|
+
last = key.next.down
|
36
|
+
|
37
|
+
expect(first).to be < middle
|
38
|
+
expect(middle).to be < last
|
39
|
+
expect(last).to be < key.next.next
|
40
|
+
end
|
41
|
+
end
|
@@ -2,9 +2,9 @@
|
|
2
2
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
|
-
require 'puppet/
|
5
|
+
require 'puppet/graph'
|
6
6
|
|
7
|
-
describe Puppet::RbTreeMap do
|
7
|
+
describe Puppet::Graph::RbTreeMap do
|
8
8
|
describe "#push" do
|
9
9
|
it "should allow a new element to be added" do
|
10
10
|
subject[5] = 'foo'
|
@@ -32,7 +32,7 @@ describe Puppet::RbTreeMap do
|
|
32
32
|
|
33
33
|
subject[5] = 'foo'
|
34
34
|
|
35
|
-
subject.instance_variable_get(:@root).should be_a(Puppet::RbTreeMap::Node)
|
35
|
+
subject.instance_variable_get(:@root).should be_a(Puppet::Graph::RbTreeMap::Node)
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
@@ -395,14 +395,14 @@ describe Puppet::RbTreeMap do
|
|
395
395
|
|
396
396
|
describe "#isred" do
|
397
397
|
it "should return true if the node is red" do
|
398
|
-
node = Puppet::RbTreeMap::Node.new(1,2)
|
398
|
+
node = Puppet::Graph::RbTreeMap::Node.new(1,2)
|
399
399
|
node.color = :red
|
400
400
|
|
401
401
|
subject.send(:isred, node).should == true
|
402
402
|
end
|
403
403
|
|
404
404
|
it "should return false if the node is black" do
|
405
|
-
node = Puppet::RbTreeMap::Node.new(1,2)
|
405
|
+
node = Puppet::Graph::RbTreeMap::Node.new(1,2)
|
406
406
|
node.color = :black
|
407
407
|
|
408
408
|
subject.send(:isred, node).should == false
|
@@ -414,8 +414,8 @@ describe Puppet::RbTreeMap do
|
|
414
414
|
end
|
415
415
|
end
|
416
416
|
|
417
|
-
describe Puppet::RbTreeMap::Node do
|
418
|
-
let(:tree) { Puppet::RbTreeMap.new }
|
417
|
+
describe Puppet::Graph::RbTreeMap::Node do
|
418
|
+
let(:tree) { Puppet::Graph::RbTreeMap.new }
|
419
419
|
let(:subject) { tree.instance_variable_get(:@root) }
|
420
420
|
|
421
421
|
before :each do
|
@@ -0,0 +1,393 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
require 'spec_helper'
|
3
|
+
require 'puppet/graph'
|
4
|
+
|
5
|
+
require 'puppet_spec/compiler'
|
6
|
+
require 'matchers/include_in_order'
|
7
|
+
require 'matchers/relationship_graph_matchers'
|
8
|
+
|
9
|
+
describe Puppet::Graph::RelationshipGraph do
|
10
|
+
include PuppetSpec::Files
|
11
|
+
include PuppetSpec::Compiler
|
12
|
+
include RelationshipGraphMatchers
|
13
|
+
|
14
|
+
let(:graph) { Puppet::Graph::RelationshipGraph.new(Puppet::Graph::SequentialPrioritizer.new) }
|
15
|
+
|
16
|
+
it "allows adding a new vertex with a specific priority" do
|
17
|
+
vertex = stub_vertex('something')
|
18
|
+
|
19
|
+
graph.add_vertex(vertex, 2)
|
20
|
+
|
21
|
+
expect(graph.resource_priority(vertex)).to eq(2)
|
22
|
+
end
|
23
|
+
|
24
|
+
it "returns resource priority based on the order added" do
|
25
|
+
# strings chosen so the old hex digest method would put these in the
|
26
|
+
# wrong order
|
27
|
+
first = stub_vertex('aa')
|
28
|
+
second = stub_vertex('b')
|
29
|
+
|
30
|
+
graph.add_vertex(first)
|
31
|
+
graph.add_vertex(second)
|
32
|
+
|
33
|
+
expect(graph.resource_priority(first)).to be < graph.resource_priority(second)
|
34
|
+
end
|
35
|
+
|
36
|
+
it "retains the first priority when a resource is added more than once" do
|
37
|
+
first = stub_vertex(1)
|
38
|
+
second = stub_vertex(2)
|
39
|
+
|
40
|
+
graph.add_vertex(first)
|
41
|
+
graph.add_vertex(second)
|
42
|
+
graph.add_vertex(first)
|
43
|
+
|
44
|
+
expect(graph.resource_priority(first)).to be < graph.resource_priority(second)
|
45
|
+
end
|
46
|
+
|
47
|
+
it "forgets the priority of a removed resource" do
|
48
|
+
vertex = stub_vertex(1)
|
49
|
+
|
50
|
+
graph.add_vertex(vertex)
|
51
|
+
graph.remove_vertex!(vertex)
|
52
|
+
|
53
|
+
expect(graph.resource_priority(vertex)).to be_nil
|
54
|
+
end
|
55
|
+
|
56
|
+
it "does not give two resources the same priority" do
|
57
|
+
first = stub_vertex(1)
|
58
|
+
second = stub_vertex(2)
|
59
|
+
third = stub_vertex(3)
|
60
|
+
|
61
|
+
graph.add_vertex(first)
|
62
|
+
graph.add_vertex(second)
|
63
|
+
graph.remove_vertex!(first)
|
64
|
+
graph.add_vertex(third)
|
65
|
+
|
66
|
+
expect(graph.resource_priority(second)).to be < graph.resource_priority(third)
|
67
|
+
end
|
68
|
+
|
69
|
+
context "order of traversal" do
|
70
|
+
it "traverses independent resources in the order they are added" do
|
71
|
+
relationships = compile_to_relationship_graph(<<-MANIFEST)
|
72
|
+
notify { "first": }
|
73
|
+
notify { "second": }
|
74
|
+
notify { "third": }
|
75
|
+
notify { "fourth": }
|
76
|
+
notify { "fifth": }
|
77
|
+
MANIFEST
|
78
|
+
|
79
|
+
expect(order_resources_traversed_in(relationships)).to(
|
80
|
+
include_in_order("Notify[first]",
|
81
|
+
"Notify[second]",
|
82
|
+
"Notify[third]",
|
83
|
+
"Notify[fourth]",
|
84
|
+
"Notify[fifth]"))
|
85
|
+
end
|
86
|
+
|
87
|
+
it "traverses resources generated during catalog creation in the order inserted" do
|
88
|
+
relationships = compile_to_relationship_graph(<<-MANIFEST)
|
89
|
+
create_resources(notify, { "first" => {} })
|
90
|
+
create_resources(notify, { "second" => {} })
|
91
|
+
notify{ "third": }
|
92
|
+
create_resources(notify, { "fourth" => {} })
|
93
|
+
create_resources(notify, { "fifth" => {} })
|
94
|
+
MANIFEST
|
95
|
+
|
96
|
+
expect(order_resources_traversed_in(relationships)).to(
|
97
|
+
include_in_order("Notify[first]",
|
98
|
+
"Notify[second]",
|
99
|
+
"Notify[third]",
|
100
|
+
"Notify[fourth]",
|
101
|
+
"Notify[fifth]"))
|
102
|
+
end
|
103
|
+
|
104
|
+
it "traverses all independent resources before traversing dependent ones" do
|
105
|
+
relationships = compile_to_relationship_graph(<<-MANIFEST)
|
106
|
+
notify { "first": require => Notify[third] }
|
107
|
+
notify { "second": }
|
108
|
+
notify { "third": }
|
109
|
+
MANIFEST
|
110
|
+
|
111
|
+
expect(order_resources_traversed_in(relationships)).to(
|
112
|
+
include_in_order("Notify[second]", "Notify[third]", "Notify[first]"))
|
113
|
+
end
|
114
|
+
|
115
|
+
it "traverses all independent resources before traversing dependent ones (with a backwards require)" do
|
116
|
+
relationships = compile_to_relationship_graph(<<-MANIFEST)
|
117
|
+
notify { "first": }
|
118
|
+
notify { "second": }
|
119
|
+
notify { "third": require => Notify[second] }
|
120
|
+
notify { "fourth": }
|
121
|
+
MANIFEST
|
122
|
+
|
123
|
+
expect(order_resources_traversed_in(relationships)).to(
|
124
|
+
include_in_order("Notify[first]", "Notify[second]", "Notify[third]", "Notify[fourth]"))
|
125
|
+
end
|
126
|
+
|
127
|
+
it "traverses resources in classes in the order they are added" do
|
128
|
+
relationships = compile_to_relationship_graph(<<-MANIFEST)
|
129
|
+
class c1 {
|
130
|
+
notify { "a": }
|
131
|
+
notify { "b": }
|
132
|
+
}
|
133
|
+
class c2 {
|
134
|
+
notify { "c": require => Notify[b] }
|
135
|
+
}
|
136
|
+
class c3 {
|
137
|
+
notify { "d": }
|
138
|
+
}
|
139
|
+
include c2
|
140
|
+
include c1
|
141
|
+
include c3
|
142
|
+
MANIFEST
|
143
|
+
|
144
|
+
expect(order_resources_traversed_in(relationships)).to(
|
145
|
+
include_in_order("Notify[a]", "Notify[b]", "Notify[c]", "Notify[d]"))
|
146
|
+
end
|
147
|
+
|
148
|
+
it "traverses resources in defines in the order they are added" do
|
149
|
+
relationships = compile_to_relationship_graph(<<-MANIFEST)
|
150
|
+
define d1() {
|
151
|
+
notify { "a": }
|
152
|
+
notify { "b": }
|
153
|
+
}
|
154
|
+
define d2() {
|
155
|
+
notify { "c": require => Notify[b]}
|
156
|
+
}
|
157
|
+
define d3() {
|
158
|
+
notify { "d": }
|
159
|
+
}
|
160
|
+
d2 { "c": }
|
161
|
+
d1 { "d": }
|
162
|
+
d3 { "e": }
|
163
|
+
MANIFEST
|
164
|
+
|
165
|
+
expect(order_resources_traversed_in(relationships)).to(
|
166
|
+
include_in_order("Notify[a]", "Notify[b]", "Notify[c]", "Notify[d]"))
|
167
|
+
end
|
168
|
+
|
169
|
+
def order_resources_traversed_in(relationships)
|
170
|
+
order_seen = []
|
171
|
+
relationships.traverse { |resource| order_seen << resource.ref }
|
172
|
+
order_seen
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
describe "when interrupting traversal" do
|
177
|
+
def collect_canceled_resources(relationships, trigger_on)
|
178
|
+
continue = true
|
179
|
+
continue_while = lambda { continue }
|
180
|
+
|
181
|
+
canceled_resources = []
|
182
|
+
canceled_resource_handler = lambda { |resource| canceled_resources << resource.ref }
|
183
|
+
|
184
|
+
relationships.traverse(:while => continue_while,
|
185
|
+
:canceled_resource_handler => canceled_resource_handler) do |resource|
|
186
|
+
if resource.ref == trigger_on
|
187
|
+
continue = false
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
canceled_resources
|
192
|
+
end
|
193
|
+
|
194
|
+
it "enumerates the remaining resources" do
|
195
|
+
relationships = compile_to_relationship_graph(<<-MANIFEST)
|
196
|
+
notify { "a": }
|
197
|
+
notify { "b": }
|
198
|
+
notify { "c": }
|
199
|
+
MANIFEST
|
200
|
+
resources = collect_canceled_resources(relationships, 'Notify[b]')
|
201
|
+
|
202
|
+
expect(resources).to include('Notify[c]')
|
203
|
+
end
|
204
|
+
|
205
|
+
it "enumerates the remaining blocked resources" do
|
206
|
+
relationships = compile_to_relationship_graph(<<-MANIFEST)
|
207
|
+
notify { "a": }
|
208
|
+
notify { "b": }
|
209
|
+
notify { "c": }
|
210
|
+
notify { "d": require => Notify["c"] }
|
211
|
+
MANIFEST
|
212
|
+
resources = collect_canceled_resources(relationships, 'Notify[b]')
|
213
|
+
|
214
|
+
expect(resources).to include('Notify[d]')
|
215
|
+
end
|
216
|
+
end
|
217
|
+
|
218
|
+
describe "when constructing dependencies" do
|
219
|
+
let(:child) { make_absolute('/a/b') }
|
220
|
+
let(:parent) { make_absolute('/a') }
|
221
|
+
|
222
|
+
it "does not create an automatic relationship that would interfere with a manual relationship" do
|
223
|
+
relationship_graph = compile_to_relationship_graph(<<-MANIFEST)
|
224
|
+
file { "#{child}": }
|
225
|
+
|
226
|
+
file { "#{parent}": require => File["#{child}"] }
|
227
|
+
MANIFEST
|
228
|
+
|
229
|
+
relationship_graph.should enforce_order_with_edge("File[#{child}]", "File[#{parent}]")
|
230
|
+
end
|
231
|
+
|
232
|
+
it "creates automatic relationships defined by the type" do
|
233
|
+
relationship_graph = compile_to_relationship_graph(<<-MANIFEST)
|
234
|
+
file { "#{child}": }
|
235
|
+
|
236
|
+
file { "#{parent}": }
|
237
|
+
MANIFEST
|
238
|
+
|
239
|
+
relationship_graph.should enforce_order_with_edge("File[#{parent}]", "File[#{child}]")
|
240
|
+
end
|
241
|
+
end
|
242
|
+
|
243
|
+
describe "when reconstructing containment relationships" do
|
244
|
+
def admissible_sentinel_of(ref)
|
245
|
+
"Admissible_#{ref}"
|
246
|
+
end
|
247
|
+
|
248
|
+
def completed_sentinel_of(ref)
|
249
|
+
"Completed_#{ref}"
|
250
|
+
end
|
251
|
+
|
252
|
+
it "an empty container's completed sentinel should depend on its admissible sentinel" do
|
253
|
+
relationship_graph = compile_to_relationship_graph(<<-MANIFEST)
|
254
|
+
class a { }
|
255
|
+
|
256
|
+
include a
|
257
|
+
MANIFEST
|
258
|
+
|
259
|
+
relationship_graph.should enforce_order_with_edge(
|
260
|
+
admissible_sentinel_of("class[A]"),
|
261
|
+
completed_sentinel_of("class[A]"))
|
262
|
+
end
|
263
|
+
|
264
|
+
it "a container with children does not directly connect the completed sentinel to its admissible sentinel" do
|
265
|
+
relationship_graph = compile_to_relationship_graph(<<-MANIFEST)
|
266
|
+
class a { notify { "a": } }
|
267
|
+
|
268
|
+
include a
|
269
|
+
MANIFEST
|
270
|
+
|
271
|
+
relationship_graph.should_not enforce_order_with_edge(
|
272
|
+
admissible_sentinel_of("class[A]"),
|
273
|
+
completed_sentinel_of("class[A]"))
|
274
|
+
end
|
275
|
+
|
276
|
+
it "all contained objects should depend on their container's admissible sentinel" do
|
277
|
+
relationship_graph = compile_to_relationship_graph(<<-MANIFEST)
|
278
|
+
class a {
|
279
|
+
notify { "class a": }
|
280
|
+
}
|
281
|
+
|
282
|
+
include a
|
283
|
+
MANIFEST
|
284
|
+
|
285
|
+
relationship_graph.should enforce_order_with_edge(
|
286
|
+
admissible_sentinel_of("class[A]"),
|
287
|
+
"Notify[class a]")
|
288
|
+
end
|
289
|
+
|
290
|
+
it "completed sentinels should depend on their container's contents" do
|
291
|
+
relationship_graph = compile_to_relationship_graph(<<-MANIFEST)
|
292
|
+
class a {
|
293
|
+
notify { "class a": }
|
294
|
+
}
|
295
|
+
|
296
|
+
include a
|
297
|
+
MANIFEST
|
298
|
+
|
299
|
+
relationship_graph.should enforce_order_with_edge(
|
300
|
+
"Notify[class a]",
|
301
|
+
completed_sentinel_of("class[A]"))
|
302
|
+
end
|
303
|
+
|
304
|
+
it "should remove all Component objects from the dependency graph" do
|
305
|
+
relationship_graph = compile_to_relationship_graph(<<-MANIFEST)
|
306
|
+
class a {
|
307
|
+
notify { "class a": }
|
308
|
+
}
|
309
|
+
define b() {
|
310
|
+
notify { "define b": }
|
311
|
+
}
|
312
|
+
|
313
|
+
include a
|
314
|
+
b { "testing": }
|
315
|
+
MANIFEST
|
316
|
+
|
317
|
+
relationship_graph.vertices.find_all { |v| v.is_a?(Puppet::Type.type(:component)) }.should be_empty
|
318
|
+
end
|
319
|
+
|
320
|
+
it "should remove all Stage resources from the dependency graph" do
|
321
|
+
relationship_graph = compile_to_relationship_graph(<<-MANIFEST)
|
322
|
+
notify { "class a": }
|
323
|
+
MANIFEST
|
324
|
+
|
325
|
+
relationship_graph.vertices.find_all { |v| v.is_a?(Puppet::Type.type(:stage)) }.should be_empty
|
326
|
+
end
|
327
|
+
|
328
|
+
it "should retain labels on non-containment edges" do
|
329
|
+
relationship_graph = compile_to_relationship_graph(<<-MANIFEST)
|
330
|
+
class a {
|
331
|
+
notify { "class a": }
|
332
|
+
}
|
333
|
+
define b() {
|
334
|
+
notify { "define b": }
|
335
|
+
}
|
336
|
+
|
337
|
+
include a
|
338
|
+
Class[a] ~> b { "testing": }
|
339
|
+
MANIFEST
|
340
|
+
|
341
|
+
relationship_graph.edges_between(
|
342
|
+
vertex_called(relationship_graph, completed_sentinel_of("class[A]")),
|
343
|
+
vertex_called(relationship_graph, admissible_sentinel_of("b[testing]")))[0].label.
|
344
|
+
should == {:callback => :refresh, :event => :ALL_EVENTS}
|
345
|
+
end
|
346
|
+
|
347
|
+
it "should not add labels to edges that have none" do
|
348
|
+
relationship_graph = compile_to_relationship_graph(<<-MANIFEST)
|
349
|
+
class a {
|
350
|
+
notify { "class a": }
|
351
|
+
}
|
352
|
+
define b() {
|
353
|
+
notify { "define b": }
|
354
|
+
}
|
355
|
+
|
356
|
+
include a
|
357
|
+
Class[a] -> b { "testing": }
|
358
|
+
MANIFEST
|
359
|
+
|
360
|
+
relationship_graph.edges_between(
|
361
|
+
vertex_called(relationship_graph, completed_sentinel_of("class[A]")),
|
362
|
+
vertex_called(relationship_graph, admissible_sentinel_of("b[testing]")))[0].label.
|
363
|
+
should be_empty
|
364
|
+
end
|
365
|
+
|
366
|
+
it "should copy notification labels to all created edges" do
|
367
|
+
relationship_graph = compile_to_relationship_graph(<<-MANIFEST)
|
368
|
+
class a {
|
369
|
+
notify { "class a": }
|
370
|
+
}
|
371
|
+
define b() {
|
372
|
+
notify { "define b": }
|
373
|
+
}
|
374
|
+
|
375
|
+
include a
|
376
|
+
Class[a] ~> b { "testing": }
|
377
|
+
MANIFEST
|
378
|
+
|
379
|
+
relationship_graph.edges_between(
|
380
|
+
vertex_called(relationship_graph, admissible_sentinel_of("b[testing]")),
|
381
|
+
vertex_called(relationship_graph, "Notify[define b]"))[0].label.
|
382
|
+
should == {:callback => :refresh, :event => :ALL_EVENTS}
|
383
|
+
end
|
384
|
+
end
|
385
|
+
|
386
|
+
def vertex_called(graph, name)
|
387
|
+
graph.vertices.find { |v| v.ref =~ /#{Regexp.escape(name)}/ }
|
388
|
+
end
|
389
|
+
|
390
|
+
def stub_vertex(name)
|
391
|
+
stub "vertex #{name}", :ref => name
|
392
|
+
end
|
393
|
+
end
|