From f57425da6aeefd4ff019068c5933add0d2a02f87 Mon Sep 17 00:00:00 2001 From: Brice Figureau Date: Sat, 16 Oct 2010 20:04:57 +0200 Subject: Fix #4921 - race condition in Parser Functions creation The autoloading is not thread safe, which means two threads could both autoload the same function at the same time. Signed-off-by: Brice Figureau --- spec/integration/parser/functions_spec.rb | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 spec/integration/parser/functions_spec.rb (limited to 'spec/integration/parser') diff --git a/spec/integration/parser/functions_spec.rb b/spec/integration/parser/functions_spec.rb new file mode 100644 index 000000000..cbfb4ac88 --- /dev/null +++ b/spec/integration/parser/functions_spec.rb @@ -0,0 +1,21 @@ +#!/usr/bin/env ruby + +require File.dirname(__FILE__) + '/../../spec_helper' + +describe Puppet::Parser::Functions do + before :each do + Puppet::Parser::Functions.rmfunction("template") if Puppet::Parser::Functions.function("template") + end + + it "should support multiple threads autoloading the same function" do + threads = [] + lambda { + 10.times { |a| + threads << Thread.new { + Puppet::Parser::Functions.function("template") + } + } + }.should_not raise_error + threads.each { |t| t.join } + end +end \ No newline at end of file -- cgit From c8b6fb5bed057bf25a25c9e1b3f55bedf64ba775 Mon Sep 17 00:00:00 2001 From: James Turnbull Date: Mon, 15 Nov 2010 19:41:43 +1100 Subject: Fixed #5296 - test warnings messages --- spec/integration/parser/ruby_manifest_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/integration/parser') diff --git a/spec/integration/parser/ruby_manifest_spec.rb b/spec/integration/parser/ruby_manifest_spec.rb index af110d3b3..de6f4628c 100644 --- a/spec/integration/parser/ruby_manifest_spec.rb +++ b/spec/integration/parser/ruby_manifest_spec.rb @@ -69,7 +69,7 @@ describe "Pure ruby manifests" do write_file('foo.rb', "hostclass 'bar' do file 'test_file', :owner => 'root', :mode => '644' end") catalog = compile("import 'foo'\ninclude bar") file = catalog.resource("File[test_file]") - file.should be_a Puppet::Resource + file.should be_a(Puppet::Resource) file.type.should == 'File' file.title.should == 'test_file' file.exported.should_not be -- cgit