diff options
Diffstat (limited to 'spec/fixtures/unit')
52 files changed, 739 insertions, 0 deletions
diff --git a/spec/fixtures/unit/parser/lexer/aliastest.pp b/spec/fixtures/unit/parser/lexer/aliastest.pp new file mode 100644 index 000000000..f2b61592e --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/aliastest.pp @@ -0,0 +1,16 @@ +file { "a file": + path => "/tmp/aliastest", + ensure => file +} + +file { "another": + path => "/tmp/aliastest2", + ensure => file, + require => File["a file"] +} + +file { "a third": + path => "/tmp/aliastest3", + ensure => file, + require => File["/tmp/aliastest"] +} diff --git a/spec/fixtures/unit/parser/lexer/append.pp b/spec/fixtures/unit/parser/lexer/append.pp new file mode 100644 index 000000000..20cbda662 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/append.pp @@ -0,0 +1,11 @@ +$var=['/tmp/file1','/tmp/file2'] + +class arraytest { + $var += ['/tmp/file3', '/tmp/file4'] + file { + $var: + content => "test" + } +} + +include arraytest diff --git a/spec/fixtures/unit/parser/lexer/argumentdefaults.pp b/spec/fixtures/unit/parser/lexer/argumentdefaults.pp new file mode 100644 index 000000000..eac9dd757 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/argumentdefaults.pp @@ -0,0 +1,14 @@ +# $Id$ + +define testargs($file, $mode = 755) { + file { $file: ensure => file, mode => $mode } +} + +testargs { "testingname": + file => "/tmp/argumenttest1" +} + +testargs { "testingother": + file => "/tmp/argumenttest2", + mode => 644 +} diff --git a/spec/fixtures/unit/parser/lexer/arithmetic_expression.pp b/spec/fixtures/unit/parser/lexer/arithmetic_expression.pp new file mode 100644 index 000000000..aae98a4db --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/arithmetic_expression.pp @@ -0,0 +1,8 @@ + +$one = 1.30 +$two = 2.034e-2 + +$result = ((( $two + 2) / $one) + 4 * 5.45) - (6 << 7) + (0x800 + -9) + + +notice("result is $result == 1295.87692307692")
\ No newline at end of file diff --git a/spec/fixtures/unit/parser/lexer/arraytrailingcomma.pp b/spec/fixtures/unit/parser/lexer/arraytrailingcomma.pp new file mode 100644 index 000000000..a410f9553 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/arraytrailingcomma.pp @@ -0,0 +1,3 @@ +file { + ["/tmp/arraytrailingcomma1","/tmp/arraytrailingcomma2", ]: content => "tmp" +} diff --git a/spec/fixtures/unit/parser/lexer/casestatement.pp b/spec/fixtures/unit/parser/lexer/casestatement.pp new file mode 100644 index 000000000..66ecd72b9 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/casestatement.pp @@ -0,0 +1,65 @@ +# $Id$ + +$var = "value" + +case $var { + "nope": { + file { "/tmp/fakefile": mode => 644, ensure => file } + } + "value": { + file { "/tmp/existsfile": mode => 755, ensure => file } + } +} + +$ovar = "yayness" + +case $ovar { + "fooness": { + file { "/tmp/nostillexistsfile": mode => 644, ensure => file } + } + "booness", "yayness": { + case $var { + "nep": { + file { "/tmp/noexistsfile": mode => 644, ensure => file } + } + "value": { + file { "/tmp/existsfile2": mode => 755, ensure => file } + } + } + } +} + +case $ovar { + "fooness": { + file { "/tmp/nostillexistsfile": mode => 644, ensure => file } + } + default: { + file { "/tmp/existsfile3": mode => 755, ensure => file } + } +} + +$bool = true + +case $bool { + true: { + file { "/tmp/existsfile4": mode => 755, ensure => file } + } +} + +$yay = yay +$a = yay +$b = boo + +case $yay { + $a: { file { "/tmp/existsfile5": mode => 755, ensure => file } } + $b: { file { "/tmp/existsfile5": mode => 644, ensure => file } } + default: { file { "/tmp/existsfile5": mode => 711, ensure => file } } + +} + +$regexvar = "exists regex" +case $regexvar { + "no match": { file { "/tmp/existsfile6": mode => 644, ensure => file } } + /(.*) regex$/: { file { "/tmp/${1}file6": mode => 755, ensure => file } } + default: { file { "/tmp/existsfile6": mode => 711, ensure => file } } +} diff --git a/spec/fixtures/unit/parser/lexer/classheirarchy.pp b/spec/fixtures/unit/parser/lexer/classheirarchy.pp new file mode 100644 index 000000000..36619d8b9 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/classheirarchy.pp @@ -0,0 +1,15 @@ +# $Id$ + +class base { + file { "/tmp/classheir1": ensure => file, mode => 755 } +} + +class sub1 inherits base { + file { "/tmp/classheir2": ensure => file, mode => 755 } +} + +class sub2 inherits base { + file { "/tmp/classheir3": ensure => file, mode => 755 } +} + +include sub1, sub2 diff --git a/spec/fixtures/unit/parser/lexer/classincludes.pp b/spec/fixtures/unit/parser/lexer/classincludes.pp new file mode 100644 index 000000000..bd5b44ed7 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/classincludes.pp @@ -0,0 +1,17 @@ +# $Id$ + +class base { + file { "/tmp/classincludes1": ensure => file, mode => 755 } +} + +class sub1 inherits base { + file { "/tmp/classincludes2": ensure => file, mode => 755 } +} + +class sub2 inherits base { + file { "/tmp/classincludes3": ensure => file, mode => 755 } +} + +$sub = "sub2" + +include sub1, $sub diff --git a/spec/fixtures/unit/parser/lexer/classpathtest.pp b/spec/fixtures/unit/parser/lexer/classpathtest.pp new file mode 100644 index 000000000..580333369 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/classpathtest.pp @@ -0,0 +1,11 @@ +# $Id$ + +define mytype { + file { "/tmp/classtest": ensure => file, mode => 755 } +} + +class testing { + mytype { "componentname": } +} + +include testing diff --git a/spec/fixtures/unit/parser/lexer/collection.pp b/spec/fixtures/unit/parser/lexer/collection.pp new file mode 100644 index 000000000..bc29510a9 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/collection.pp @@ -0,0 +1,10 @@ +class one { + @file { "/tmp/colltest1": content => "one" } + @file { "/tmp/colltest2": content => "two" } +} + +class two { + File <| content == "one" |> +} + +include one, two diff --git a/spec/fixtures/unit/parser/lexer/collection_override.pp b/spec/fixtures/unit/parser/lexer/collection_override.pp new file mode 100644 index 000000000..b1b39ab16 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/collection_override.pp @@ -0,0 +1,8 @@ +@file { + "/tmp/collection": + content => "whatever" +} + +File<| |> { + mode => 0600 +} diff --git a/spec/fixtures/unit/parser/lexer/collection_within_virtual_definitions.pp b/spec/fixtures/unit/parser/lexer/collection_within_virtual_definitions.pp new file mode 100644 index 000000000..3c21468b0 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/collection_within_virtual_definitions.pp @@ -0,0 +1,20 @@ +define test($name) { + file {"/tmp/collection_within_virtual_definitions1_$name.txt": + content => "File name $name\n" + } + Test2 <||> +} + +define test2() { + file {"/tmp/collection_within_virtual_definitions2_$name.txt": + content => "This is a test\n" + } +} + +node default { + @test {"foo": + name => "foo" + } + @test2 {"foo2": } + Test <||> +} diff --git a/spec/fixtures/unit/parser/lexer/componentmetaparams.pp b/spec/fixtures/unit/parser/lexer/componentmetaparams.pp new file mode 100644 index 000000000..7d9f0c2c1 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/componentmetaparams.pp @@ -0,0 +1,11 @@ +file { "/tmp/component1": + ensure => file +} + +define thing { + file { $name: ensure => file } +} + +thing { "/tmp/component2": + require => File["/tmp/component1"] +} diff --git a/spec/fixtures/unit/parser/lexer/componentrequire.pp b/spec/fixtures/unit/parser/lexer/componentrequire.pp new file mode 100644 index 000000000..a61d2050c --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/componentrequire.pp @@ -0,0 +1,8 @@ +define testfile($mode) { + file { $name: mode => $mode, ensure => present } +} + +testfile { "/tmp/testing_component_requires2": mode => 755 } + +file { "/tmp/testing_component_requires1": mode => 755, ensure => present, + require => Testfile["/tmp/testing_component_requires2"] } diff --git a/spec/fixtures/unit/parser/lexer/deepclassheirarchy.pp b/spec/fixtures/unit/parser/lexer/deepclassheirarchy.pp new file mode 100644 index 000000000..249e6334d --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/deepclassheirarchy.pp @@ -0,0 +1,23 @@ +# $Id$ + +class base { + file { "/tmp/deepclassheir1": ensure => file, mode => 755 } +} + +class sub1 inherits base { + file { "/tmp/deepclassheir2": ensure => file, mode => 755 } +} + +class sub2 inherits sub1 { + file { "/tmp/deepclassheir3": ensure => file, mode => 755 } +} + +class sub3 inherits sub2 { + file { "/tmp/deepclassheir4": ensure => file, mode => 755 } +} + +class sub4 inherits sub3 { + file { "/tmp/deepclassheir5": ensure => file, mode => 755 } +} + +include sub4 diff --git a/spec/fixtures/unit/parser/lexer/defineoverrides.pp b/spec/fixtures/unit/parser/lexer/defineoverrides.pp new file mode 100644 index 000000000..c68b139e3 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/defineoverrides.pp @@ -0,0 +1,17 @@ +# $Id$ + +$file = "/tmp/defineoverrides1" + +define myfile($mode) { + file { $name: ensure => file, mode => $mode } +} + +class base { + myfile { $file: mode => 644 } +} + +class sub inherits base { + Myfile[$file] { mode => 755, } # test the end-comma +} + +include sub diff --git a/spec/fixtures/unit/parser/lexer/emptyclass.pp b/spec/fixtures/unit/parser/lexer/emptyclass.pp new file mode 100644 index 000000000..48047e748 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/emptyclass.pp @@ -0,0 +1,9 @@ +# $Id$ + +define component { +} + +class testing { +} + +include testing diff --git a/spec/fixtures/unit/parser/lexer/emptyexec.pp b/spec/fixtures/unit/parser/lexer/emptyexec.pp new file mode 100644 index 000000000..847a30d18 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/emptyexec.pp @@ -0,0 +1,3 @@ +exec { "touch /tmp/emptyexectest": + path => "/usr/bin:/bin" +} diff --git a/spec/fixtures/unit/parser/lexer/emptyifelse.pp b/spec/fixtures/unit/parser/lexer/emptyifelse.pp new file mode 100644 index 000000000..598b486ac --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/emptyifelse.pp @@ -0,0 +1,9 @@ + +if false { +} else { + # nothing here +} + +if true { + # still nothing +} diff --git a/spec/fixtures/unit/parser/lexer/falsevalues.pp b/spec/fixtures/unit/parser/lexer/falsevalues.pp new file mode 100644 index 000000000..2143b79a7 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/falsevalues.pp @@ -0,0 +1,3 @@ +$value = false + +file { "/tmp/falsevalues$value": ensure => file } diff --git a/spec/fixtures/unit/parser/lexer/filecreate.pp b/spec/fixtures/unit/parser/lexer/filecreate.pp new file mode 100644 index 000000000..d7972c234 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/filecreate.pp @@ -0,0 +1,11 @@ +# $Id$ + +file { + "/tmp/createatest": ensure => file, mode => 755; + "/tmp/createbtest": ensure => file, mode => 755 +} + +file { + "/tmp/createctest": ensure => file; + "/tmp/createdtest": ensure => file; +} diff --git a/spec/fixtures/unit/parser/lexer/fqdefinition.pp b/spec/fixtures/unit/parser/lexer/fqdefinition.pp new file mode 100644 index 000000000..ddb0675a9 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/fqdefinition.pp @@ -0,0 +1,5 @@ +define one::two($ensure) { + file { "/tmp/fqdefinition": ensure => $ensure } +} + +one::two { "/tmp/fqdefinition": ensure => file } diff --git a/spec/fixtures/unit/parser/lexer/fqparents.pp b/spec/fixtures/unit/parser/lexer/fqparents.pp new file mode 100644 index 000000000..ee2f65423 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/fqparents.pp @@ -0,0 +1,11 @@ +class base { + class one { + file { "/tmp/fqparent1": ensure => file } + } +} + +class two::three inherits base::one { + file { "/tmp/fqparent2": ensure => file } +} + +include two::three diff --git a/spec/fixtures/unit/parser/lexer/funccomma.pp b/spec/fixtures/unit/parser/lexer/funccomma.pp new file mode 100644 index 000000000..32e34f92e --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/funccomma.pp @@ -0,0 +1,5 @@ +@file { + ["/tmp/funccomma1","/tmp/funccomma2"]: content => "1" +} + +realize( File["/tmp/funccomma1"], File["/tmp/funccomma2"] , ) diff --git a/spec/fixtures/unit/parser/lexer/hash.pp b/spec/fixtures/unit/parser/lexer/hash.pp new file mode 100644 index 000000000..d33249872 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/hash.pp @@ -0,0 +1,33 @@ + +$hash = { "file" => "/tmp/myhashfile1" } + +file { + $hash["file"]: + ensure => file, content => "content"; +} + +$hash2 = { "a" => { key => "/tmp/myhashfile2" }} + +file { + $hash2["a"][key]: + ensure => file, content => "content"; +} + +define test($a = { "b" => "c" }) { + file { + $a["b"]: + ensure => file, content => "content" + } +} + +test { + "test": + a => { "b" => "/tmp/myhashfile3" } +} + +$hash3 = { mykey => "/tmp/myhashfile4" } +$key = "mykey" + +file { + $hash3[$key]: ensure => file, content => "content" +} diff --git a/spec/fixtures/unit/parser/lexer/ifexpression.pp b/spec/fixtures/unit/parser/lexer/ifexpression.pp new file mode 100644 index 000000000..29a637291 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/ifexpression.pp @@ -0,0 +1,12 @@ +$one = 1 +$two = 2 + +if ($one < $two) and (($two < 3) or ($two == 2)) { + notice("True!") +} + +if "test regex" =~ /(.*) regex/ { + file { + "/tmp/${1}iftest": ensure => file, mode => 0755 + } +} diff --git a/spec/fixtures/unit/parser/lexer/implicititeration.pp b/spec/fixtures/unit/parser/lexer/implicititeration.pp new file mode 100644 index 000000000..6f34cb29c --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/implicititeration.pp @@ -0,0 +1,15 @@ +# $Id$ + +$files = ["/tmp/iterationatest", "/tmp/iterationbtest"] + +file { $files: ensure => file, mode => 755 } + +file { ["/tmp/iterationctest", "/tmp/iterationdtest"]: + ensure => file, + mode => 755 +} + +file { + ["/tmp/iterationetest", "/tmp/iterationftest"]: ensure => file, mode => 755; + ["/tmp/iterationgtest", "/tmp/iterationhtest"]: ensure => file, mode => 755; +} diff --git a/spec/fixtures/unit/parser/lexer/multilinecomments.pp b/spec/fixtures/unit/parser/lexer/multilinecomments.pp new file mode 100644 index 000000000..f9819c020 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/multilinecomments.pp @@ -0,0 +1,10 @@ + +/* +file { + "/tmp/multilinecomments": content => "pouet" +} +*/ + +/* and another one for #2333, the whitespace after the +end comment is here on purpose */ + diff --git a/spec/fixtures/unit/parser/lexer/multipleclass.pp b/spec/fixtures/unit/parser/lexer/multipleclass.pp new file mode 100644 index 000000000..ae02edc38 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/multipleclass.pp @@ -0,0 +1,9 @@ +class one { + file { "/tmp/multipleclassone": content => "one" } +} + +class one { + file { "/tmp/multipleclasstwo": content => "two" } +} + +include one diff --git a/spec/fixtures/unit/parser/lexer/multipleinstances.pp b/spec/fixtures/unit/parser/lexer/multipleinstances.pp new file mode 100644 index 000000000..2f9b3c2e8 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/multipleinstances.pp @@ -0,0 +1,7 @@ +# $Id$ + +file { + "/tmp/multipleinstancesa": ensure => file, mode => 755; + "/tmp/multipleinstancesb": ensure => file, mode => 755; + "/tmp/multipleinstancesc": ensure => file, mode => 755; +} diff --git a/spec/fixtures/unit/parser/lexer/multisubs.pp b/spec/fixtures/unit/parser/lexer/multisubs.pp new file mode 100644 index 000000000..bcec69e2a --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/multisubs.pp @@ -0,0 +1,13 @@ +class base { + file { "/tmp/multisubtest": content => "base", mode => 644 } +} + +class sub1 inherits base { + File["/tmp/multisubtest"] { mode => 755 } +} + +class sub2 inherits base { + File["/tmp/multisubtest"] { content => sub2 } +} + +include sub1, sub2 diff --git a/spec/fixtures/unit/parser/lexer/namevartest.pp b/spec/fixtures/unit/parser/lexer/namevartest.pp new file mode 100644 index 000000000..dbee1c356 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/namevartest.pp @@ -0,0 +1,9 @@ +define filetest($mode, $ensure = file) { + file { $name: + mode => $mode, + ensure => $ensure + } +} + +filetest { "/tmp/testfiletest": mode => 644} +filetest { "/tmp/testdirtest": mode => 755, ensure => directory} diff --git a/spec/fixtures/unit/parser/lexer/scopetest.pp b/spec/fixtures/unit/parser/lexer/scopetest.pp new file mode 100644 index 000000000..331491766 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/scopetest.pp @@ -0,0 +1,13 @@ + +$mode = 640 + +define thing { + file { "/tmp/$name": ensure => file, mode => $mode } +} + +class testing { + $mode = 755 + thing {scopetest: } +} + +include testing diff --git a/spec/fixtures/unit/parser/lexer/selectorvalues.pp b/spec/fixtures/unit/parser/lexer/selectorvalues.pp new file mode 100644 index 000000000..d80d26c36 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/selectorvalues.pp @@ -0,0 +1,49 @@ +$value1 = "" +$value2 = true +$value3 = false +$value4 = yay + +$test = "yay" + +$mode1 = $value1 ? { + "" => 755, + default => 644 +} + +$mode2 = $value2 ? { + true => 755, + default => 644 +} + +$mode3 = $value3 ? { + false => 755, + default => 644 +} + +$mode4 = $value4 ? { + $test => 755, + default => 644 +} + +$mode5 = yay ? { + $test => 755, + default => 644 +} + +$mode6 = $mode5 ? { + 755 => 755 +} + +$mode7 = "test regex" ? { + /regex$/ => 755, + default => 644 +} + + +file { "/tmp/selectorvalues1": ensure => file, mode => $mode1 } +file { "/tmp/selectorvalues2": ensure => file, mode => $mode2 } +file { "/tmp/selectorvalues3": ensure => file, mode => $mode3 } +file { "/tmp/selectorvalues4": ensure => file, mode => $mode4 } +file { "/tmp/selectorvalues5": ensure => file, mode => $mode5 } +file { "/tmp/selectorvalues6": ensure => file, mode => $mode6 } +file { "/tmp/selectorvalues7": ensure => file, mode => $mode7 } diff --git a/spec/fixtures/unit/parser/lexer/simpledefaults.pp b/spec/fixtures/unit/parser/lexer/simpledefaults.pp new file mode 100644 index 000000000..63d199a68 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/simpledefaults.pp @@ -0,0 +1,5 @@ +# $Id$ + +File { mode => 755 } + +file { "/tmp/defaulttest": ensure => file } diff --git a/spec/fixtures/unit/parser/lexer/simpleselector.pp b/spec/fixtures/unit/parser/lexer/simpleselector.pp new file mode 100644 index 000000000..8b9bc7292 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/simpleselector.pp @@ -0,0 +1,38 @@ +# $Id$ + +$var = "value" + +file { "/tmp/snippetselectatest": + ensure => file, + mode => $var ? { + nottrue => 641, + value => 755 + } +} + +file { "/tmp/snippetselectbtest": + ensure => file, + mode => $var ? { + nottrue => 644, + default => 755 + } +} + +$othervar = "complex value" + +file { "/tmp/snippetselectctest": + ensure => file, + mode => $othervar ? { + "complex value" => 755, + default => 644 + } +} +$anothervar = Yayness + +file { "/tmp/snippetselectdtest": + ensure => file, + mode => $anothervar ? { + Yayness => 755, + default => 644 + } +} diff --git a/spec/fixtures/unit/parser/lexer/singleary.pp b/spec/fixtures/unit/parser/lexer/singleary.pp new file mode 100644 index 000000000..9ce56dd89 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/singleary.pp @@ -0,0 +1,19 @@ +# $Id$ + +file { "/tmp/singleary1": + ensure => file +} + +file { "/tmp/singleary2": + ensure => file +} + +file { "/tmp/singleary3": + ensure => file, + require => [File["/tmp/singleary1"], File["/tmp/singleary2"]] +} + +file { "/tmp/singleary4": + ensure => file, + require => [File["/tmp/singleary1"]] +} diff --git a/spec/fixtures/unit/parser/lexer/singlequote.pp b/spec/fixtures/unit/parser/lexer/singlequote.pp new file mode 100644 index 000000000..dc876a2f8 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/singlequote.pp @@ -0,0 +1,11 @@ +# $Id$ + +file { "/tmp/singlequote1": + ensure => file, + content => 'a $quote' +} + +file { "/tmp/singlequote2": + ensure => file, + content => 'some "\yayness\"' +} diff --git a/spec/fixtures/unit/parser/lexer/singleselector.pp b/spec/fixtures/unit/parser/lexer/singleselector.pp new file mode 100644 index 000000000..520a14017 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/singleselector.pp @@ -0,0 +1,22 @@ +$value1 = "" +$value2 = true +$value3 = false +$value4 = yay + +$test = "yay" + +$mode1 = $value1 ? { + "" => 755 +} + +$mode2 = $value2 ? { + true => 755 +} + +$mode3 = $value3 ? { + default => 755 +} + +file { "/tmp/singleselector1": ensure => file, mode => $mode1 } +file { "/tmp/singleselector2": ensure => file, mode => $mode2 } +file { "/tmp/singleselector3": ensure => file, mode => $mode3 } diff --git a/spec/fixtures/unit/parser/lexer/subclass_name_duplication.pp b/spec/fixtures/unit/parser/lexer/subclass_name_duplication.pp new file mode 100755 index 000000000..10f1d75ed --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/subclass_name_duplication.pp @@ -0,0 +1,11 @@ +#!/usr/bin/env puppet + +class one::fake { + file { "/tmp/subclass_name_duplication1": ensure => present } +} + +class two::fake { + file { "/tmp/subclass_name_duplication2": ensure => present } +} + +include one::fake, two::fake diff --git a/spec/fixtures/unit/parser/lexer/tag.pp b/spec/fixtures/unit/parser/lexer/tag.pp new file mode 100644 index 000000000..e6e770dd9 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/tag.pp @@ -0,0 +1,9 @@ +# $Id$ + +$variable = value + +tag yayness, rahness + +tag booness, $variable + +file { "/tmp/settestingness": ensure => file } diff --git a/spec/fixtures/unit/parser/lexer/tagged.pp b/spec/fixtures/unit/parser/lexer/tagged.pp new file mode 100644 index 000000000..7bf90a645 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/tagged.pp @@ -0,0 +1,35 @@ +# $Id$ + +tag testing +tag(funtest) + +class tagdefine { + $path = tagged(tagdefine) ? { + true => "true", false => "false" + } + + file { "/tmp/taggeddefine$path": ensure => file } +} + +include tagdefine + +$yayness = tagged(yayness) ? { + true => "true", false => "false" +} + +$funtest = tagged(testing) ? { + true => "true", false => "false" +} + +$both = tagged(testing, yayness) ? { + true => "true", false => "false" +} + +$bothtrue = tagged(testing, testing) ? { + true => "true", false => "false" +} + +file { "/tmp/taggedyayness$yayness": ensure => file } +file { "/tmp/taggedtesting$funtest": ensure => file } +file { "/tmp/taggedboth$both": ensure => file } +file { "/tmp/taggedbothtrue$bothtrue": ensure => file } diff --git a/spec/fixtures/unit/parser/lexer/virtualresources.pp b/spec/fixtures/unit/parser/lexer/virtualresources.pp new file mode 100644 index 000000000..a29406b84 --- /dev/null +++ b/spec/fixtures/unit/parser/lexer/virtualresources.pp @@ -0,0 +1,14 @@ +class one { + @file { "/tmp/virtualtest1": content => "one" } + @file { "/tmp/virtualtest2": content => "two" } + @file { "/tmp/virtualtest3": content => "three" } + @file { "/tmp/virtualtest4": content => "four" } +} + +class two { + File <| content == "one" |> + realize File["/tmp/virtualtest2"] + realize(File["/tmp/virtualtest3"], File["/tmp/virtualtest4"]) +} + +include one, two diff --git a/spec/fixtures/unit/provider/host/parsed/valid_hosts b/spec/fixtures/unit/provider/host/parsed/valid_hosts new file mode 100644 index 000000000..24636295d --- /dev/null +++ b/spec/fixtures/unit/provider/host/parsed/valid_hosts @@ -0,0 +1,19 @@ +# Some leading comment, that should be ignored +# The next line is empty so it should be ignored + +::1 localhost + +# We now try another delimiter: Several tabs +127.0.0.1 localhost + +# No test trailing spaces +10.0.0.1 host1 + +# Ok its time to test aliases +2001:252:0:1::2008:8 ipv6host alias1 +192.168.0.1 ipv4host alias2 alias3 + +# Testing inlinecomments now +192.168.0.2 host3 # This is host3 +192.168.0.3 host4 alias10 # This is host4 +192.168.0.4 host5 alias11 alias12 # This is host5 diff --git a/spec/fixtures/unit/provider/mount/parsed/freebsd.fstab b/spec/fixtures/unit/provider/mount/parsed/freebsd.fstab new file mode 100644 index 000000000..a41104236 --- /dev/null +++ b/spec/fixtures/unit/provider/mount/parsed/freebsd.fstab @@ -0,0 +1,7 @@ +# Device Mountpoint FStype Options Dump Pass# +/dev/ad0s1b none swap sw 0 0 +/dev/ad0s1a / ufs rw 1 1 +/dev/ad0s1e /tmp ufs rw 2 2 +/dev/ad0s1f /usr ufs rw 2 2 +/dev/ad0s1d /var ufs rw 2 2 +/dev/acd0 /cdrom cd9660 ro,noauto 0 0 diff --git a/spec/fixtures/unit/provider/mount/parsed/linux.fstab b/spec/fixtures/unit/provider/mount/parsed/linux.fstab new file mode 100644 index 000000000..b1debff9c --- /dev/null +++ b/spec/fixtures/unit/provider/mount/parsed/linux.fstab @@ -0,0 +1,11 @@ +# A sample fstab, typical for a Fedora system +/dev/vg00/lv00 / ext3 defaults 1 1 +LABEL=/boot /boot ext3 defaults 1 2 +devpts /dev/pts devpts gid=5,mode=620 0 +tmpfs /dev/shm tmpfs defaults 0 +LABEL=/home /home ext3 defaults 1 2 +/home /homes auto bind 0 2 +proc /proc proc defaults 0 0 +/dev/vg00/lv01 /spare ext3 defaults 1 2 +sysfs /sys sysfs defaults 0 0 +LABEL=SWAP-hda6 swap swap defaults 0 0 diff --git a/spec/fixtures/unit/provider/mount/parsed/solaris.fstab b/spec/fixtures/unit/provider/mount/parsed/solaris.fstab new file mode 100644 index 000000000..54afc898c --- /dev/null +++ b/spec/fixtures/unit/provider/mount/parsed/solaris.fstab @@ -0,0 +1,11 @@ +#device device mount FS fsck mount mount +#to mount to fsck point type pass at boot options +# +fd - /dev/fd fd - no - +/proc - /proc proc - no - +/dev/dsk/c0d0s0 /dev/rdsk/c0d0s0 / ufs 1 no - +/dev/dsk/c0d0p0:boot - /boot pcfs - no - +/devices - /devices devfs - no - +ctfs - /system/contract ctfs - no - +objfs - /system/object objfs - no - +#swap - /tmp tmpfs - yes - diff --git a/spec/fixtures/unit/provider/ssh_authorized_key/parsed/authorized_keys b/spec/fixtures/unit/provider/ssh_authorized_key/parsed/authorized_keys new file mode 100644 index 000000000..b22329dca --- /dev/null +++ b/spec/fixtures/unit/provider/ssh_authorized_key/parsed/authorized_keys @@ -0,0 +1,7 @@ +ssh-dss AAAAB3NzaC1kc3MAAACBAJkupmdsJSDXfUy5EU5NTRBDr9Woo3w0YnB8KmnJW9ghU8C7SkWPB1fIHVe+esFfd3qWBseb83PoFX63geZJAg6bjV4/Rdn1zEoa9EO2QyUdYUen4+rpsh3vVKZ6HFNsn3+W5+kPYgE1F/N4INqkbjY3sqCkP/W1BL9+sbVVbuJFAAAAFQCfjWDk5XhvGUkPjNWWVqltBYzHtwAAAIEAg/XL7ky7x9Ad5banzPFAfmM+DGFe0A/JEbLDjKmr5KBM5x4RFohtEvZ8ECuVGUOqBWdgAjyYwsG4oRVjLnKrf/rgmbNRzSFgEWkcAye3BVwk7Dt6hh4knEl+mNfOLq+FH0011UhecOiqTcESMzQDtgQ1vJh2VchElBLjl3x/ZugAAACAAh5jGQC338t5ObP8trSlOefkx0sXmmEzUbo3Mt8mGUuGJPx8m+X0L8Xd+l5rQxytqE3SmV/RD+6REqBuPqHM8RQuqAzfjdOeg/Ajdggx1CRMTVhltZsgQoxO30cz9Qo0SdPoL+Jp1fLuaLZq7m/RmsWYvoLT3jebBlpvvQE8YlI= francois.deppierraz@nimag.net +ssh-dss AAAAB3NzaC1kc3MAAACBAJkupmdsJSDXfUy5EU5NTRBDr9Woo3w0YnB8KmnJW9ghU8C7SkWPB1fIHVe+esFfd3qWBseb83PoFX63geZJAg6bjV4/Rdn1zEoa9EO2QyUdYUen4+rpsh3vVKZ6HFNsn3+W5+kPYgE1F/N4INqkbjY3sqCkP/W1BL9+sbVVbuJFAAAAFQCfjWDk5XhvGUkPjNWWVqltBYzHtwAAAIEAg/XL7ky7x9Ad5banzPFAfmM+DGFe0A/JEbLDjKmr5KBM5x4RFohtEvZ8ECuVGUOqBWdgAjyYwsG4oRVjLnKrf/rgmbNRzSFgEWkcAye3BVwk7Dt6hh4knEl+mNfOLq+FH0011UhecOiqTcESMzQDtgQ1vJh2VchElBLjl3x/ZugAAACAAh5jGQC338t5ObP8trSlOefkx0sXmmEzUbo3Mt8mGUuGJPx8m+X0L8Xd+l5rQxytqE3SmV/RD+6REqBuPqHM8RQuqAzfjdOeg/Ajdggx1CRMTVhltZsgQoxO30cz9Qo0SdPoL+Jp1fLuaLZq7m/RmsWYvoLT3jebBlpvvQE8YlI= Francois Deppierraz <francois@ctrlaltdel.ch> +from="192.168.1.1",command="/bin/false",no-pty,no-port-forwarding ssh-dss AAAAB3NzaC1kc3MAAACBAJkupmdsJSDXfUy5EU5NTRBDr9Woo3w0YnB8KmnJW9ghU8C7SkWPB1fIHVe+esFfd3qWBseb83PoFX63geZJAg6bjV4/Rdn1zEoa9EO2QyUdYUen4+rpsh3vVK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+SQXaQ5Z3BedIxZaoQthkDALlV/25A1COELrg9J2MqJNQc8Xe9XQOIkBQWWinUlD/BXwoOTWEy8C8zSZPHZ3getMMNhGTBO+q/O+qiJx3y5cA4MTbw2zSxukfWC87qWwcZ64UUlegIM056vPsdZWFclS9hsROVEa57YUMrehQ1EGxT4Z5j6zIopufGFiAPjZigq/vqgcAqhAKP6yu4/gwO6S9tatBeEjZ8fafvj1pmvvIplZeMr96gHE7xS3pEEQqnB3nd4RY7AF6j9kFixnsytAUO7STPh/M3pLiVQBN89TvWPQ== diff --git a/spec/fixtures/unit/provider/ssh_authorized_key/parsed/authorized_keys1 b/spec/fixtures/unit/provider/ssh_authorized_key/parsed/authorized_keys1 new file mode 100644 index 000000000..7aa0647ca --- /dev/null +++ b/spec/fixtures/unit/provider/ssh_authorized_key/parsed/authorized_keys1 @@ -0,0 +1,3 @@ +1024 35 167576894966720957580065952882142495543043407324667405194097438434880798807651864847570827148390962746149410384891026772700627764845955493549511618975091512997118590589399665757714186775228807376424903966072778732134483862302766419277581465932186641863495699668069439475320990051723279127881281145164415361627 francois@korn +2048 35 27332429396020032283276339339051507284036000350350092862949624519871013308460312287866673933080560923221560798334008554200019645416448528663000202951887890525621015333936122655294782671001073795264378070156670395703161543893088138531854776737799752600933431638059304355933305878665812555436198516842364330938321746086651639330436648850787370397302524667456837036413634152938122227368132322078811602953517461933179827432019932348409533535942749570969101453655028606209719023224268890314608444789012688070463327764203306501923404494017305972543000091038543051645924928018568725584728655193415567703220002707737714942757 francois@korn +from="192.168.1.1",command="/bin/false",no-pty,no-port-forwarding 2048 35 27332429396020032283276339339051507284036000350350092862949624519871013308460312287866673933080560923221560798334008554200019645416448528663000202951887890525621015333936122655294782671001073795264378070156670395703161543893088138531854776737799752600933431638059304355933305878665812555436198516842364330938321746086651639330436648850787370397302524667456837036413634152938122227368132322078811602953517461933179827432019932348409533535942749570969101453655028606209719023224268890314608444789012688070463327764203306501923404494017305972543000091038543051645924928018568725584728655193415567703220002707737714942757 francois@korn diff --git a/spec/fixtures/unit/provider/ssh_authorized_key/parsed/authorized_keys2 b/spec/fixtures/unit/provider/ssh_authorized_key/parsed/authorized_keys2 new file mode 100644 index 000000000..9bf830112 --- /dev/null +++ b/spec/fixtures/unit/provider/ssh_authorized_key/parsed/authorized_keys2 @@ -0,0 +1 @@ +false ssh-dss AAAAB3NzaC1kc3MAAACBAJkupmdsJSDXfUy5EU5NTRBDr9Woo3w0YnB8KmnJW9ghU8C7SkWPB1fIHVe+esFfd3qWBseb83PoFX63geZJAg6bjV4/Rdn1zEoa9EO2QyUdYUen4+rpsh3vVKZ6HFNsn3+W5+kPYgE1F/N4INqkbjY3sqCkP/W1BL9+sbVVbuJFAAAAFQCfjWDk5XhvGUkPjNWWVqltBYzHtwAAAIEAg/XL7ky7x9Ad5banzPFAfmM+DGFe0A/JEbLDjKmr5KBM5x4RFohtEvZ8ECuVGUOqBWdgAjyYwsG4oRVjLnKrf/rgmbNRzSFgEWkcAye3BVwk7Dt6hh4knEl+mNfOLq+FH0011UhecOiqTcESMzQDtgQ1vJh2VchElBLjl3x/ZugAAACAAh5jGQC338t5ObP8trSlOefkx0sXmmEzUbo3Mt8mGUuGJPx8m+X0L8Xd+l5rQxytqE3SmV/RD+6REqBuPqHM8RQuqAzfjdOeg/Ajdggx1CRMTVhltZsgQoxO30cz9Qo0SdPoL+Jp1fLuaLZq7m/RmsWYvoLT3jebBlpvvQE8YlI= Francois Deppierraz diff --git a/spec/fixtures/unit/reports/tagmail/tagmail_failers.conf b/spec/fixtures/unit/reports/tagmail/tagmail_failers.conf new file mode 100644 index 000000000..d116b5fc7 --- /dev/null +++ b/spec/fixtures/unit/reports/tagmail/tagmail_failers.conf @@ -0,0 +1,3 @@ +tag: +: abuse@domain.com +invalid!tag: abuse@domain.com diff --git a/spec/fixtures/unit/reports/tagmail/tagmail_passers.conf b/spec/fixtures/unit/reports/tagmail/tagmail_passers.conf new file mode 100644 index 000000000..ae6d2e7f2 --- /dev/null +++ b/spec/fixtures/unit/reports/tagmail/tagmail_passers.conf @@ -0,0 +1,30 @@ +# A comment +# or maybe two +# plus some blank lines + # with some blanks plus a comment + +# a simple tag report +one: abuse@domain.com + +# with weird spacing + one : abuse@domain.com + +# with multiple tags +one, two: abuse@domain.com + +# again with the weird syntax + one , two : abuse@domain.com + +# Some negations +one, !two: abuse@domain.com + +# some oddly-formatted tags +one, two-three, !four-five, !six: abuse@domain.com + +# multiple addresses +one, two: abuse@domain.com, testing@domain.com + +# and with weird spacing +one, two: abuse@domain.com , testing@domain.com + +# and a trailing comment |