source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
puma/puma
https://github.com/puma/puma
test/rackup/sleep_step.ru
Ruby
bsd-3-clause
7,885
main
386
# call with "GET /sleep<d>-<s> HTTP/1.1\r\n\r\n", where <d> is the number of # seconds to sleep (can be a float or an int) and <s> is the step regex_delay = /\A\/sleep(\d+(?:\.\d+)?)/ run lambda { |env| p = env['REQUEST_PATH'] delay = (p[regex_delay,1] || '0').to_f step = p[/(\d+)\z/,1].to_i sleep delay [200...
github
puma/puma
https://github.com/puma/puma
test/rackup/ci_string.ru
Ruby
bsd-3-clause
7,885
main
1,262
# frozen_string_literal: true # Generates a response with single string bodies, size set via ENV['CI_BODY_CONF'] or # `Body-Conf` request header. # See 'CI - test/rackup/ci-*.ru files' or docs/test_rackup_ci_files.md require 'securerandom' env_len = (t = ENV['CI_BODY_CONF']) ? t[/\d+\z/].to_i : 10 headers = {} head...
github
puma/puma
https://github.com/puma/puma
test/rackup/ci_io.ru
Ruby
bsd-3-clause
7,885
main
1,075
# frozen_string_literal: true # Generates a response with File/IO bodies, size set via ENV['CI_BODY_CONF'] or # `Body-Conf` request header. # See 'CI - test/rackup/ci-*.ru files' or docs/test_rackup_ci_files.md require 'securerandom' require 'tmpdir' headers = {} headers['Content-Type'] = 'text/plain; charset=utf-8'...
github
puma/puma
https://github.com/puma/puma
test/rackup/sleep_fibonacci.ru
Ruby
bsd-3-clause
7,885
main
1,980
# frozen_string_literal: true =begin This runs loops of fibonacci code to use some CPU resources, then sleeps for the balance of time that's sent in the request. The body returned is a text string that includes the percent of time spent in the fibonacci code. Call with "GET /sleep<d> HTTP/1.1\r\n\r\n", where <d> is ...
github
puma/puma
https://github.com/puma/puma
test/rackup/ci_array.ru
Ruby
bsd-3-clause
7,885
main
1,169
# frozen_string_literal: true # Generates a response with array bodies, size set via ENV['CI_BODY_CONF'] or # `Body-Conf` request header. # See 'CI - test/rackup/ci-*.ru files' or docs/test_rackup_ci_files.md require 'securerandom' headers = {} headers['Content-Type'] = 'text/plain; charset=utf-8'.freeze 25.times { ...
github
puma/puma
https://github.com/puma/puma
examples/generate_chain_test.rb
Ruby
bsd-3-clause
7,885
main
3,081
# frozen_string_literal: true =begin regenerates ca.pem, ca_keypair.pem, subca.pem, subca_keypair.pem, cert.pem, cert_keypair.pem ca_chain.pem, cert_chain.pem certs before date will be the first of the current month =end require 'bundler/inline' gemfile(true) do sour...
github
puma/puma
https://github.com/puma/puma
examples/generate_server_test.rb
Ruby
bsd-3-clause
7,885
main
1,157
# frozen_string_literal: true =begin regenerates cert_puma.pem and puma_keypair.pem dates, key length & sign_algorithm are changed =end require 'openssl' module GenerateServerCerts KEY_LEN = 2048 SIGN_ALGORITHM = OpenSSL::Digest::SHA256 FNC = 'cert_puma.pem' FNK = 'puma_keypair.pem' class << self d...
github
puma/puma
https://github.com/puma/puma
examples/generate_client_test.rb
Ruby
bsd-3-clause
7,885
main
4,242
# frozen_string_literal: false =begin run code to generate all certs certs before date will be the first of the current month =end require "openssl" module GenerateClientCerts KEY_LEN = 2048 SIGN_ALGORITHM = OpenSSL::Digest::SHA256 CA_EXTS = [ ["basicConstraints","CA:TRUE",true], ["keyUsage","cRLSign...
github
puma/puma
https://github.com/puma/puma
examples/plugins/redis_stop_puma.rb
Ruby
bsd-3-clause
7,885
main
1,390
require 'puma/plugin' require 'redis' # How to stop Puma on Heroku # - You can't use normal methods because the dyno is not accessible # - There's no file system, no way to send signals # but ... # - You can use Redis or Memcache; any network distributed key-value # store # 1. Add this plugin to your 'lib' director...
github
puma/puma
https://github.com/puma/puma
examples/puma/client_certs/run_server_with_certs.rb
Ruby
bsd-3-clause
7,885
main
730
require "bundler/setup" require "puma" require "puma/detect" require "puma/puma_http11" require "puma/minissl" app = proc {|env| p env['puma.peercert'] [200, {}, [ env['puma.peercert'] ]] } log_writer = Puma::LogWriter.new($stdout, $stderr) server = Puma::Server.new(app, log_writer) context = Puma::MiniSSL::Conte...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
install.rb
Ruby
apache-2.0
7,843
main
14,534
#! /usr/bin/env ruby #-- # Copyright 2004 Austin Ziegler <ruby-install@halostatue.ca> # Install utility. Based on the original installation script for rdoc by the # Pragmatic Programmers. # # This program is free software. It may be redistributed and/or modified under # the terms of the GPL version 2 (or later) or ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
Rakefile
Ruby
apache-2.0
7,843
main
3,553
# frozen_string_literal: true require 'open3' require 'rake' require 'rubygems' require 'rubygems/package_task' if Rake.application.top_level_tasks.grep(/^(pl:|package:)/).any? begin require 'packaging' Pkg::Util::RakeUtils.load_packaging_tasks rescue LoadError => e puts "Error loading packaging rake ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
Gemfile
Ruby
apache-2.0
7,843
main
3,426
source ENV['GEM_SOURCE'] || "https://rubygems.org" gemspec def location_for(place, fake_version = nil) if place.is_a?(String) && place =~ /^((?:git[:@]|https:)[^#]*)#(.*)/ [fake_version, { git: $1, branch: $2, require: false }].compact elsif place.is_a?(String) && place =~ /^file:\/\/(.*)/ ['>= 0', { path...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
puppet.gemspec
Ruby
apache-2.0
7,843
main
2,168
Gem::Specification.new do |spec| spec.name = "puppet" spec.version = "8.11.0" spec.licenses = ['Apache-2.0'] spec.required_rubygems_version = Gem::Requirement.new("> 1.3.1") spec.required_ruby_version = Gem::Requirement.new(">= 3.1.0") spec.authors = ["Puppet Labs"] spec.date = "2012-08-17" spec.descri...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/spec_helper.rb
Ruby
apache-2.0
7,843
main
7,988
# NOTE: a lot of the stuff in this file is duplicated in the "puppet_spec_helper" in the project # puppetlabs_spec_helper. We should probably eat our own dog food and get rid of most of this from here, # and have the puppet core itself use puppetlabs_spec_helper dir = File.expand_path(File.dirname(__FILE__)) $LOAD_...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/shared_examples/rhel_package_provider.rb
Ruby
apache-2.0
7,843
main
17,789
shared_examples "RHEL package provider" do |provider_class, provider_name| describe provider_name do let(:name) { 'mypackage' } let(:resource) do Puppet::Type.type(:package).new( :name => name, :ensure => :installed, :provider => provider_name ) end let(:provi...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/shared_contexts/https.rb
Ruby
apache-2.0
7,843
main
874
require 'spec_helper' RSpec.shared_context('https client') do before :all do WebMock.disable! end after :all do WebMock.enable! end before :each do # make sure we don't take too long Puppet[:http_connect_timeout] = '5s' Puppet[:server] = '127.0.0.1' Puppet[:certname] = '127.0.0.1' ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/shared_contexts/checksum.rb
Ruby
apache-2.0
7,843
main
2,624
# Shared contexts for testing against all supported checksum types. # # These helpers define nested rspec example groups to test code against all our # supported checksum types. Example groups that need to be run against all # types should use the `with_checksum_types` helper which will # create a new example group for...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/shared_contexts/provider.rb
Ruby
apache-2.0
7,843
main
563
require 'spec_helper' RSpec.shared_context('provider specificity') do around do |example| old_defaults = described_class.instance_variable_get(:@defaults) old_notdefaults = described_class.instance_variable_get(:@notdefaults) begin described_class.instance_variable_set(:@defaults, []) describ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/shared_contexts/types_setup.rb
Ruby
apache-2.0
7,843
main
6,481
shared_context 'types_setup' do # Do not include the special type Unit in this list # Do not include the type Variant in this list as it needs to be parameterized to be meaningful def self.all_types [ Puppet::Pops::Types::PAnyType, Puppet::Pops::Types::PUndefType, Puppet::Pops::Types::PNotUndefTy...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/shared_contexts/digests.rb
Ruby
apache-2.0
7,843
main
3,838
# Shared contexts for testing against all supported digest algorithms. # # These helpers define nested rspec example groups to test code against all our # supported digest algorithms. Example groups that need to be run against all # algorithms should use the `with_digest_algorithms` helper which will # create a new exa...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/shared_contexts/l10n.rb
Ruby
apache-2.0
7,843
main
913
require 'spec_helper' RSpec.shared_context('l10n') do |locale| before :all do @old_locale = Locale.current Locale.current = locale @old_gettext_disabled = Puppet::GettextConfig.instance_variable_get(:@gettext_disabled) Puppet::GettextConfig.instance_variable_set(:@gettext_disabled, false) Puppet...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/shared_behaviours/store_configs_terminus.rb
Ruby
apache-2.0
7,843
main
609
shared_examples_for "a StoreConfigs terminus" do before :each do Puppet[:storeconfigs] = true Puppet[:storeconfigs_backend] = "store_configs_testing" end api = [:find, :search, :save, :destroy, :head] api.each do |name| it { is_expected.to respond_to(name) } end it "should fail if an invalid ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/shared_behaviours/an_indirector_face.rb
Ruby
apache-2.0
7,843
main
201
shared_examples_for "an indirector face" do [:find, :search, :save, :destroy, :info].each do |action| it { is_expected.to be_action action } it { is_expected.to respond_to action } end end
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/shared_behaviours/documentation_on_faces.rb
Ruby
apache-2.0
7,843
main
9,314
# encoding: UTF-8 shared_examples_for "documentation on faces" do defined?(Attrs) or Attrs = [:summary, :description, :examples, :short_description, :notes, :author] defined?(SingleLineAttrs) or SingleLineAttrs = [:summary, :author] # Simple, procedural tests that apply to a bunch of methods. Attrs.ea...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/shared_behaviours/memory_terminus.rb
Ruby
apache-2.0
7,843
main
965
shared_examples_for "A Memory Terminus" do it "should find no instances by default" do expect(@searcher.find(@request)).to be_nil end it "should be able to find instances that were previously saved" do @searcher.save(@request) expect(@searcher.find(@request)).to equal(@instance) end it "should r...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/shared_behaviours/things_that_declare_options.rb
Ruby
apache-2.0
7,843
main
7,641
# encoding: UTF-8 shared_examples_for "things that declare options" do it "should support options without arguments" do thing = add_options_to { option "--bar" } expect(thing).to be_option :bar end it "should support options with an empty block" do thing = add_options_to do option "--foo" do ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/shared_behaviours/file_serving.rb
Ruby
apache-2.0
7,843
main
2,468
shared_examples_for "Puppet::FileServing::Files" do |indirection| %w[find search].each do |method| let(:request) { Puppet::Indirector::Request.new(indirection, method, 'foo', nil) } describe "##{method}" do it "should proxy to file terminus if the path is absolute" do request.key = make_absolut...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/shared_behaviours/all_parsedfile_providers.rb
Ruby
apache-2.0
7,843
main
624
shared_examples_for "all parsedfile providers" do |provider, *files| if files.empty? then files = my_fixtures end files.flatten.each do |file| it "should rewrite #{file} reasonably unchanged" do allow(provider).to receive(:default_target).and_return(file) provider.prefetch text = provi...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/shared_behaviours/hiera_indirections.rb
Ruby
apache-2.0
7,843
main
2,936
shared_examples_for "Hiera indirection" do |test_klass, fixture_dir| include PuppetSpec::Files def write_hiera_config(config_file, datadir) File.open(config_file, 'w') do |f| f.write("--- :yaml: :datadir: #{datadir} :hierarchy: ['global', 'invalid'] :logger: 'noop' ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/shared_behaviours/file_server_terminus.rb
Ruby
apache-2.0
7,843
main
1,491
shared_examples_for "Puppet::Indirector::FileServerTerminus" do # This only works if the shared behaviour is included before # the 'before' block in the including context. before do Puppet::FileServing::Configuration.instance_variable_set(:@configuration, nil) allow(Puppet::FileSystem).to receive(:exist?)...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/shared_behaviours/path_parameters.rb
Ruby
apache-2.0
7,843
main
5,342
# In order to use this correctly you must define a method to get an instance # of the type being tested, so that this code can remain generic: # # it_should_behave_like "all path parameters", :path do # def instance(path) # Puppet::Type.type(:example).new( # :name => 'foo', :require => 'bar', :p...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/shared_behaviours/iterative_functions.rb
Ruby
apache-2.0
7,843
main
2,224
shared_examples_for 'all iterative functions hash handling' do |func| it 'passes a hash entry as an array of the key and value' do catalog = compile_to_catalog(<<-MANIFEST) {a=>1}.#{func} |$v| { notify { "${v[0]} ${v[1]}": } } MANIFEST expect(catalog.resource(:notify, "a 1")).not_to be_nil end en...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/lib/matchers/json.rb
Ruby
apache-2.0
7,843
main
3,042
module JSONMatchers class SetJsonAttribute def initialize(attributes) @attributes = attributes end def format @format ||= Puppet::Network::FormatHandler.format('json') end def json(instance) Puppet::Util::Json.load(instance.to_json) end def attr_value(attrs, instance) ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/lib/matchers/containment_matchers.rb
Ruby
apache-2.0
7,843
main
1,295
module ContainmentMatchers class ContainClass def initialize(containee) @containee = containee end def in(container) @container = container self end def matches?(catalog) @catalog = catalog raise ArgumentError, "You must set the container using #in" unless @contain...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/lib/matchers/include_in_order.rb
Ruby
apache-2.0
7,843
main
437
RSpec::Matchers.define :include_in_order do |*expected| match do |actual| elements = expected.dup actual.each do |elt| if elt == elements.first elements.shift end end elements.empty? end def failure_message "expected #{@actual.inspect} to include#{expected} in order" en...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/lib/matchers/resource.rb
Ruby
apache-2.0
7,843
main
1,886
module Matchers; module Resource extend RSpec::Matchers::DSL matcher :have_resource do |expected_resource| def resource_match(expected_resource, actual_resource) matched = true failures = [] if actual_resource.ref != expected_resource matched = false failures << "expected #{e...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/lib/matchers/match_tokens2.rb
Ruby
apache-2.0
7,843
main
2,042
# Matches tokens produced by lexer # The given exepected is one or more entries where an entry is one of # - a token symbol # - an Array with a token symbol and the text value # - an Array with a token symbol and a Hash specifying all attributes of the token # - nil (ignore) # RSpec::Matchers.define :match_tokens2 do |...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/lib/matchers/relationship_graph_matchers.rb
Ruby
apache-2.0
7,843
main
1,249
module RelationshipGraphMatchers class EnforceOrderWithEdge def initialize(before, after) @before = before @after = after end def matches?(actual_graph) @actual_graph = actual_graph @reverse_edge = actual_graph.edge?( vertex_called(actual_graph, @after), verte...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/lib/matchers/include_in_order_spec.rb
Ruby
apache-2.0
7,843
main
777
require 'spec_helper' require 'matchers/include_in_order' describe "Matching whether elements are included in order" do context "an empty array" do it "is included in an empty array" do expect([]).to include_in_order() end it "is included in a non-empty array" do expect([1]).to include_in_or...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/lib/puppet/test_ca.rb
Ruby
apache-2.0
7,843
main
4,988
module Puppet class TestCa CERT_VALID_FROM = Time.at(0).freeze # 1969-12-31 16:00:00 -0800 CERT_VALID_UNTIL = (Time.now + (10 * 365 * 24 * 60 * 60)).freeze # 10 years from now CA_EXTENSIONS = [ ["basicConstraints", "CA:TRUE", true], ["keyUsage", "keyCertSign, cRLSign", true], ["subject...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/lib/puppet/certificate_factory.rb
Ruby
apache-2.0
7,843
main
9,042
require 'puppet/ssl' # This class encapsulates the logic of creating and adding extensions to X509 # certificates. # # @api private module Puppet::CertificateFactory # Create a new X509 certificate and add any needed extensions to the cert. # # @param cert_type [Symbol] The certificate type to create, which spe...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/lib/puppet/indirector_proxy.rb
Ruby
apache-2.0
7,843
main
654
class Puppet::IndirectorProxy class ProxyId attr_accessor :name def initialize(name) self.name = name end end # We should have some way to identify if we got a valid object back with the # current values, no? attr_accessor :value, :proxyname alias_method :name, :value alias_method :name...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/lib/puppet/indirector_testing.rb
Ruby
apache-2.0
7,843
main
559
require 'puppet/indirector' class Puppet::IndirectorTesting extend Puppet::Indirector indirects :indirector_testing # We should have some way to identify if we got a valid object back with the # current values, no? attr_accessor :value alias_method :name, :value alias_method :name=, :value= def initia...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/lib/puppet/face/huzzah.rb
Ruby
apache-2.0
7,843
main
323
require 'puppet/face' Puppet::Face.define(:huzzah, '2.0.1') do copyright "Puppet Inc.", 2011 license "Apache 2 license; see COPYING" summary "life is a thing for celebration" action(:bar) { when_invoked { |options| "is where beer comes from" } } action(:call_older) { when_invoked { |_| method_on_older } } e...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/lib/puppet/face/version_matching.rb
Ruby
apache-2.0
7,843
main
490
require 'puppet/face' # The set of versions here are used explicitly in the interface_spec; if you # change this you need to ensure that is still correct. --daniel 2011-04-21 ['1.0.0', '1.0.1', '1.1.0', '1.1.1', '2.0.0'].each do |version| Puppet::Face.define(:version_matching, version) do copyright "Puppet Inc."...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/lib/puppet/face/basetest.rb
Ruby
apache-2.0
7,843
main
1,292
require 'puppet/face' Puppet::Face.define(:basetest, '0.0.1') do copyright "Puppet Inc.", 2011 license "Apache 2 license; see COPYING" summary "This is just so tests don't fail" option "--[no-]boolean" option "--mandatory ARGUMENT" action :foo do option("--action") when_invoked do |*args| args....
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/lib/puppet/face/1.0.0/huzzah.rb
Ruby
apache-2.0
7,843
main
335
require 'puppet/face' Puppet::Face.define(:huzzah, '1.0.0') do copyright "Puppet Inc.", 2011 license "Apache 2 license; see COPYING" summary "life is a thing for celebration" action(:obsolete_in_core) { when_invoked { |_| "you are in obsolete core now!" } } action(:call_newer) { when_invoked { |_| method_on...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/lib/puppet_spec/character_encoding.rb
Ruby
apache-2.0
7,843
main
333
# A support module for testing character encoding module PuppetSpec::CharacterEncoding def self.with_external_encoding(encoding, &blk) original_encoding = Encoding.default_external begin Encoding.default_external = encoding yield ensure Encoding.default_external = original_encoding e...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/lib/puppet_spec/modules.rb
Ruby
apache-2.0
7,843
main
2,555
module PuppetSpec::Modules class << self def create(name, dir, options = {}) module_dir = File.join(dir, name) FileUtils.mkdir_p(module_dir) environment = options[:environment] metadata = options[:metadata] if metadata metadata[:source] ||= 'github' metadata[:autho...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/lib/puppet_spec/language.rb
Ruby
apache-2.0
7,843
main
2,679
require 'puppet_spec/compiler' require 'matchers/resource' module PuppetSpec::Language extend RSpec::Matchers::DSL def produces(expectations) calledFrom = caller expectations.each do |manifest, resources| it "evaluates #{manifest} to produce #{resources}" do begin case resources ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/lib/puppet_spec/ssl.rb
Ruby
apache-2.0
7,843
main
9,880
require 'openssl' module PuppetSpec module SSL PRIVATE_KEY_LENGTH = 2048 FIVE_YEARS = 5 * 365 * 24 * 60 * 60 CA_EXTENSIONS = [ ["basicConstraints", "CA:TRUE", true], ["keyUsage", "keyCertSign, cRLSign", true], ["subjectKeyIdentifier", "hash", false], ["authorityKeyIdentifier", "k...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/lib/puppet_spec/network.rb
Ruby
apache-2.0
7,843
main
3,572
require 'spec_helper' require 'puppet/network/http' require 'puppet/network/http/api/indirected_routes' require 'puppet/indirector_testing' module PuppetSpec::Network def not_found_error Puppet::Network::HTTP::Error::HTTPNotFoundError end def not_acceptable_error Puppet::Network::HTTP::Error::HTTPNotAc...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/lib/puppet_spec/puppetserver.rb
Ruby
apache-2.0
7,843
main
6,061
require 'spec_helper' require 'webrick' require "webrick/ssl" class PuppetSpec::Puppetserver include PuppetSpec::Fixtures include PuppetSpec::Files attr_reader :ca_cert, :ca_crl, :server_cert, :server_key class NodeServlet < WEBrick::HTTPServlet::AbstractServlet def do_GET request, response node = ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/lib/puppet_spec/matchers.rb
Ruby
apache-2.0
7,843
main
1,825
require 'stringio' ######################################################################## # Custom matchers... RSpec::Matchers.define :have_matching_element do |expected| match do |actual| actual.any? { |item| item =~ expected } end end RSpec::Matchers.define :have_matching_log do |expected| match do |act...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/lib/puppet_spec/handler.rb
Ruby
apache-2.0
7,843
main
838
require 'puppet/network/http/handler' class PuppetSpec::Handler include Puppet::Network::HTTP::Handler def initialize(* routes) register(routes) end def set_content_type(response, format) response[:content_type_header] = format end def set_response(response, body, status = 200) response[:bod...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/lib/puppet_spec/verbose.rb
Ruby
apache-2.0
7,843
main
362
# Support code for running stuff with warnings disabled or enabled module Kernel def with_verbose_disabled verbose, $VERBOSE = $VERBOSE, nil begin yield ensure $VERBOSE = verbose end end def with_verbose_enabled verbose, $VERBOSE = $VERBOSE, true begin yield ensure ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/lib/puppet_spec/pops.rb
Ruby
apache-2.0
7,843
main
1,048
module PuppetSpec::Pops extend RSpec::Matchers::DSL # Checks if an Acceptor has a specific issue in its list of diagnostics matcher :have_issue do |expected| match do |actual| actual.diagnostics.index { |i| i.issue == expected } != nil end failure_message do |actual| "expected Acceptor[#{...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/lib/puppet_spec/https.rb
Ruby
apache-2.0
7,843
main
2,712
require 'spec_helper' require 'webrick' class PuppetSpec::HTTPSServer include PuppetSpec::Fixtures attr_reader :ca_cert, :ca_crl, :server_cert, :server_key def initialize(ca_cert: nil, ca_crl: nil, server_key: nil, server_cert: nil) @ca_cert = ca_cert || cert_fixture('ca.pem') @ca_crl = ca_crl || crl_f...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/lib/puppet_spec/files.rb
Ruby
apache-2.0
7,843
main
2,560
require 'fileutils' require 'tempfile' require 'tmpdir' require 'pathname' # A support module for testing files. module PuppetSpec::Files def self.cleanup $global_tempfiles ||= [] while path = $global_tempfiles.pop do begin FileUtils.rm_rf path, secure: true rescue Errno::ENOENT #...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/lib/puppet_spec/compiler.rb
Ruby
apache-2.0
7,843
main
3,638
module PuppetSpec::Compiler module_function def compile_to_catalog(string, node = Puppet::Node.new('test')) Puppet[:code] = string # see lib/puppet/indirector/catalog/compiler.rb#filter Puppet::Parser::Compiler.compile(node).filter { |r| r.virtual? } end # Does not removed virtual resources in com...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/lib/puppet_spec/settings.rb
Ruby
apache-2.0
7,843
main
1,664
module PuppetSpec::Settings # It would probably be preferable to refactor defaults.rb such that the real definitions of # these settings were available as a variable, which was then accessible for use during tests. # However, I'm not doing that yet because I don't want to introduce any additional moving parts ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/lib/puppet_spec/fixtures.rb
Ruby
apache-2.0
7,843
main
1,399
module PuppetSpec::Fixtures def fixtures(*rest) File.join(PuppetSpec::FIXTURE_DIR, *rest) end def my_fixture_dir callers = caller while line = callers.shift do next unless found = line.match(%r{/spec/(.*)_spec\.rb:}) return fixtures(found[1]) end fail "sorry, I couldn't work out yo...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/lib/puppet_spec/scope.rb
Ruby
apache-2.0
7,843
main
381
module PuppetSpec::Scope # Initialize a new scope suitable for testing. # def create_test_scope_for_node(node_name) node = Puppet::Node.new(node_name) compiler = Puppet::Parser::Compiler.new(node) scope = Puppet::Parser::Scope.new(compiler) scope.source = Puppet::Resource::Type.new(:node, node_nam...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/lib/puppet_spec/module_tool/stub_source.rb
Ruby
apache-2.0
7,843
main
6,235
module PuppetSpec module ModuleTool class StubSource < SemanticPuppet::Dependency::Source def inspect; "Stub Source"; end def host "http://nowhe.re" end def fetch(name) available_releases[name.tr('/', '-')].values end def available_releases return @ava...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/lib/puppet_spec/module_tool/shared_functions.rb
Ruby
apache-2.0
7,843
main
1,640
require 'puppet/util/json' module PuppetSpec module ModuleTool module SharedFunctions def remote_release(name, version) remote_source.available_releases[name][version] end def preinstall(name, version, options = { :into => primary_dir }) release = remote_release(name, version) ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/integration/util_spec.rb
Ruby
apache-2.0
7,843
main
3,921
# coding: utf-8 require 'spec_helper' describe Puppet::Util do include PuppetSpec::Files describe "#replace_file on Windows", :if => Puppet::Util::Platform.windows? do it "replace_file should preserve original ACEs from existing replaced file on Windows" do file = tmpfile("somefile") FileUtils.to...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/integration/configurer_spec.rb
Ruby
apache-2.0
7,843
main
6,474
require 'spec_helper' require 'puppet_spec/network' require 'puppet/configurer' describe Puppet::Configurer do include PuppetSpec::Files include PuppetSpec::Network describe "when running" do before(:each) do @catalog = Puppet::Resource::Catalog.new("testing", Puppet.lookup(:environments).get(Puppet[...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/integration/transaction_spec.rb
Ruby
apache-2.0
7,843
main
17,150
require 'spec_helper' require 'puppet_spec/compiler' require 'puppet/transaction' Puppet::Type.newtype(:devicetype) do apply_to_device newparam(:name) end describe Puppet::Transaction do include PuppetSpec::Files include PuppetSpec::Compiler before do allow(Puppet::Util::Storage).to receive(:store) ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/integration/data_binding_spec.rb
Ruby
apache-2.0
7,843
main
7,800
require 'spec_helper' require 'puppet/indirector/hiera' require 'puppet_spec/compiler' require 'puppet/indirector/data_binding/hiera' describe "Data binding" do include PuppetSpec::Files include PuppetSpec::Compiler let(:dir) { tmpdir("puppetdir") } let(:data) {{ 'global' => { 'testing::binding::va...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/integration/directory_environments_spec.rb
Ruby
apache-2.0
7,843
main
2,317
require 'spec_helper' describe "directory environments" do let(:args) { ['--configprint', 'modulepath', '--environment', 'direnv'] } let(:puppet) { Puppet::Application[:apply] } context "with a single directory environmentpath" do before(:each) do environmentdir = PuppetSpec::Files.tmpdir('envpath') ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/integration/defaults_spec.rb
Ruby
apache-2.0
7,843
main
10,248
require 'spec_helper' require 'puppet/defaults' describe "Puppet defaults" do describe "when default_manifest is set" do it "returns ./manifests by default" do expect(Puppet[:default_manifest]).to eq('./manifests') end end describe "when disable_per_environment_manifest is set" do it "return...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/integration/type_spec.rb
Ruby
apache-2.0
7,843
main
719
require 'spec_helper' require 'puppet/type' describe Puppet::Type do it "should not lose its provider list when it is reloaded" do type = Puppet::Type.newtype(:integration_test) do newparam(:name) {} end provider = type.provide(:myprovider) {} # reload it type = Puppet::Type.newtype(:int...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/integration/node_spec.rb
Ruby
apache-2.0
7,843
main
2,594
require 'spec_helper' require 'puppet/node' describe Puppet::Node do describe "when delegating indirection calls" do before do Puppet::Node.indirection.reset_terminus_class Puppet::Node.indirection.cache_class = nil @name = "me" @node = Puppet::Node.new(@name) end it "should be...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/integration/node/facts_spec.rb
Ruby
apache-2.0
7,843
main
1,649
require 'spec_helper' describe Puppet::Node::Facts do describe "when using the indirector" do it "should expire any cached node instances when it is saved" do allow(Puppet::Node::Facts.indirection).to receive(:terminus_class).and_return(:yaml) expect(Puppet::Node::Facts.indirection.terminus(:yaml))....
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/integration/node/environment_spec.rb
Ruby
apache-2.0
7,843
main
6,387
require 'spec_helper' require 'puppet_spec/files' require 'puppet_spec/scope' require 'matchers/resource' describe Puppet::Node::Environment do include PuppetSpec::Files include Matchers::Resource def a_module_in(name, dir) Dir.mkdir(dir) moddir = File.join(dir, name) Dir.mkdir(moddir) moddir ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/integration/application/lookup_spec.rb
Ruby
apache-2.0
7,843
main
9,309
require 'spec_helper' require 'puppet_spec/files' require 'puppet_spec/compiler' require 'deep_merge/core' describe 'lookup' do include PuppetSpec::Files context 'with an environment' do let(:fqdn) { Puppet[:certname] } let(:env_name) { 'spec' } let(:env_dir) { tmpdir('environments') } let(:enviro...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/integration/application/ssl_spec.rb
Ruby
apache-2.0
7,843
main
702
require 'spec_helper' describe "puppet ssl", unless: Puppet::Util::Platform.jruby? do context "print" do it 'translates custom oids to their long name' do basedir = File.expand_path("#{__FILE__}/../../../fixtures/ssl") # registering custom oids changes global state, so shell out output = ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/integration/application/help_spec.rb
Ruby
apache-2.0
7,843
main
1,090
require 'spec_helper' require 'puppet/application/help' describe "puppet help" do let(:app) { Puppet::Application[:help] } it "generates global help" do expect { app.run }.to exit_with(0) .and output(Regexp.new(Regexp.escape(<<~END), Regexp::MULTILINE)).to_stdout Usage: puppet <subcomma...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/integration/application/resource_spec.rb
Ruby
apache-2.0
7,843
main
2,089
require 'spec_helper' require 'puppet_spec/files' describe "puppet resource", unless: Puppet::Util::Platform.jruby? do include PuppetSpec::Files let(:resource) { Puppet::Application[:resource] } context 'when given an invalid environment' do before { Puppet[:environment] = 'badenv' } it 'falls back to...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/integration/application/apply_spec.rb
Ruby
apache-2.0
7,843
main
29,292
require 'spec_helper' require 'puppet_spec/files' require 'puppet_spec/compiler' require 'puppet_spec/https' describe "apply", unless: Puppet::Util::Platform.jruby? do include PuppetSpec::Files let(:apply) { Puppet::Application[:apply] } before :each do Puppet[:reports] = "none" # Let exceptions be rai...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/integration/application/plugin_spec.rb
Ruby
apache-2.0
7,843
main
5,904
require 'spec_helper' require 'puppet/face' require 'puppet_spec/puppetserver' describe "puppet plugin", unless: Puppet::Util::Platform.jruby? do include_context "https client" let(:server) { PuppetSpec::Puppetserver.new } let(:plugin) { Puppet::Application[:plugin] } let(:response_body) { "[{\"path\":\"/etc/...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/integration/application/doc_spec.rb
Ruby
apache-2.0
7,843
main
935
require 'spec_helper' require 'puppet/application/doc' describe Puppet::Application::Doc do include PuppetSpec::Files let(:app) { Puppet::Application[:doc] } it 'lists references' do app.command_line.args = ['-l'] expect { app.run }.to exit_with(0) .and output(/configuration - A referenc...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/integration/application/filebucket_spec.rb
Ruby
apache-2.0
7,843
main
9,059
require 'spec_helper' require 'puppet/face' require 'puppet_spec/puppetserver' require 'puppet_spec/files' describe "puppet filebucket", unless: Puppet::Util::Platform.jruby? do include PuppetSpec::Files include_context "https client" let(:server) { PuppetSpec::Puppetserver.new } let(:filebucket) { Puppet::Ap...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/integration/application/module_spec.rb
Ruby
apache-2.0
7,843
main
7,447
# coding: utf-8 require 'spec_helper' require 'puppet/forge' require 'puppet_spec/https' describe 'puppet module', unless: Puppet::Util::Platform.jruby? do include PuppetSpec::Files include_context "https client" let(:app) { Puppet::Application[:module] } let(:wrong_hostname) { 'localhost' } let(:server) { ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/integration/application/agent_spec.rb
Ruby
apache-2.0
7,843
main
36,114
require 'spec_helper' require 'puppet_spec/files' require 'puppet_spec/puppetserver' require 'puppet_spec/compiler' require 'puppet_spec/https' require 'puppet/application/agent' describe "puppet agent", unless: Puppet::Util::Platform.jruby? do include PuppetSpec::Files include PuppetSpec::Compiler include_conte...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/integration/type/package_spec.rb
Ruby
apache-2.0
7,843
main
6,601
require 'spec_helper' describe Puppet::Type.type(:package), "when choosing a default package provider" do before do # the default provider is cached. Puppet::Type.type(:package).defaultprovider = nil end def provider_name(os) case os when 'Solaris' if Puppet::Util::Package.versioncmp(Puppe...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/integration/type/file_spec.rb
Ruby
apache-2.0
7,843
main
72,731
# coding: utf-8 require 'spec_helper' require 'puppet_spec/files' if Puppet::Util::Platform.windows? require 'puppet/util/windows' class WindowsSecurity extend Puppet::Util::Windows::Security end end describe Puppet::Type.type(:file), :uses_checksums => true do include PuppetSpec::Files include_context...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/integration/type/notify_spec.rb
Ruby
apache-2.0
7,843
main
1,303
require 'spec_helper' require 'puppet_spec/compiler' describe Puppet::Type.type(:notify) do include PuppetSpec::Compiler it "logs the title at notice level" do apply_compiled_manifest(<<-MANIFEST) notify { 'hi': } MANIFEST expect(@logs).to include(an_object_having_attributes(level: :notice, mes...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/integration/type/tidy_spec.rb
Ruby
apache-2.0
7,843
main
1,115
require 'spec_helper' require 'puppet_spec/compiler' require 'puppet_spec/files' require 'puppet/file_bucket/dipper' describe Puppet::Type.type(:tidy) do include PuppetSpec::Files include PuppetSpec::Compiler before do allow(Puppet::Util::Storage).to receive(:store) end it "should be able to recursive...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/integration/type/exec_spec.rb
Ruby
apache-2.0
7,843
main
3,136
require 'spec_helper' require 'puppet_spec/files' describe Puppet::Type.type(:exec), unless: Puppet::Util::Platform.jruby? do include PuppetSpec::Files let(:catalog) { Puppet::Resource::Catalog.new } let(:path) { tmpfile('exec_provider') } before :each do catalog.host_config = false end shared_exam...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/integration/http/client_spec.rb
Ruby
apache-2.0
7,843
main
9,660
require 'spec_helper' require 'puppet_spec/https' require 'puppet_spec/files' describe Puppet::HTTP::Client, unless: Puppet::Util::Platform.jruby? do include PuppetSpec::Files include_context "https client" let(:wrong_hostname) { 'localhost' } let(:client) { Puppet::HTTP::Client.new } let(:ssl_provider) { P...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/integration/environments/setting_hooks_spec.rb
Ruby
apache-2.0
7,843
main
909
require 'spec_helper' describe "setting hooks" do let(:confdir) { Puppet[:confdir] } let(:environmentpath) { File.expand_path("envdir", confdir) } describe "reproducing PUP-3500" do let(:productiondir) { File.join(environmentpath, "production") } before(:each) do FileUtils.mkdir_p(productiondir) ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/integration/environments/settings_interpolation_spec.rb
Ruby
apache-2.0
7,843
main
3,604
require 'pp' require 'spec_helper' require 'puppet_spec/settings' module SettingsInterpolationSpec describe "interpolating $environment" do include PuppetSpec::Settings let(:confdir) { Puppet[:confdir] } let(:cmdline_args) { ['--confdir', confdir, '--vardir', Puppet[:vardir], '--hiera_config', Puppet[:hiera_con...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/integration/environments/default_manifest_spec.rb
Ruby
apache-2.0
7,843
main
8,031
require 'spec_helper' module EnvironmentsDefaultManifestsSpec describe "default manifests" do context "puppet with default_manifest settings" do let(:confdir) { Puppet[:confdir] } let(:environmentpath) { File.expand_path("envdir", confdir) } context "relative default" do let(:testingdir) { File.j...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/integration/environments/settings_spec.rb
Ruby
apache-2.0
7,843
main
4,865
require 'spec_helper' require 'puppet_spec/settings' describe "environment settings" do include PuppetSpec::Settings let(:confdir) { Puppet[:confdir] } let(:cmdline_args) { ['--confdir', confdir, '--vardir', Puppet[:vardir], '--hiera_config', Puppet[:hiera_config]] } let(:environmentpath) { File.expand_path("...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/integration/parser/pcore_resource_spec.rb
Ruby
apache-2.0
7,843
main
7,763
require 'spec_helper' require 'puppet_spec/files' require 'puppet_spec/compiler' require 'puppet/face' describe 'when pcore described resources types are in use' do include PuppetSpec::Files include PuppetSpec::Compiler let(:genface) { Puppet::Face[:generate, :current] } context "in an environment with two ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/integration/parser/script_compiler_spec.rb
Ruby
apache-2.0
7,843
main
3,422
require 'puppet' require 'spec_helper' require 'puppet_spec/compiler' require 'matchers/resource' require 'puppet/parser/script_compiler' describe 'the script compiler' do include PuppetSpec::Compiler include PuppetSpec::Files include Matchers::Resource before(:each) do Puppet[:tasks] = true end conte...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/integration/parser/node_spec.rb
Ruby
apache-2.0
7,843
main
5,587
require 'spec_helper' require 'puppet_spec/compiler' require 'matchers/resource' describe 'node statements' do include PuppetSpec::Compiler include Matchers::Resource context 'nodes' do it 'selects a node where the name is just a number' do # Future parser doesn't allow a number in this position ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
spec/integration/parser/conditionals_spec.rb
Ruby
apache-2.0
7,843
main
2,324
require 'spec_helper' require 'puppet_spec/compiler' require 'matchers/resource' describe "Evaluation of Conditionals" do include PuppetSpec::Compiler include Matchers::Resource context "a catalog built with conditionals" do it "evaluates an if block correctly" do catalog = compile_to_catalog(<<-CODE)...