~ubuntu-branches/ubuntu/trusty/puppet/trusty

« back to all changes in this revision

Viewing changes to acceptance/tests/resource/file/source_attribtute.rb

  • Committer: Package Import Robot
  • Author(s): Stig Sandbeck Mathisen
  • Date: 2011-10-22 14:08:22 UTC
  • mfrom: (1.1.25) (3.1.32 sid)
  • Revision ID: package-import@ubuntu.com-20111022140822-odxde5lohc45yhuz
Tags: 2.7.6-1
* New upstream release (CVE-2011-3872)
* Remove cherry-picked "groupadd_aix_warning" patch
* Install all new manpages

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
test_name "The source attribute"
2
 
 
3
 
step "Ensure the test environment is clean"
4
 
on agents, 'rm -f /tmp/source_file_test.txt'
5
 
 
6
 
# TODO: Add tests for puppet:// URIs with master/agent setups.
7
 
step "when using a puppet:/// URI with a master/agent setup"
8
 
step "when using a puppet://$server/ URI with a master/agent setup"
9
 
 
10
 
step "when using a local file path"
11
 
 
12
 
on agents, "echo 'Yay, this is the local file.' > /tmp/local_source_file_test.txt"
13
 
 
14
 
manifest = "file { '/tmp/source_file_test.txt': source => '/tmp/local_source_file_test.txt', ensure => present }"
15
 
 
16
 
apply_manifest_on agents, manifest
17
 
 
18
 
on agents, 'test "$(cat /tmp/source_file_test.txt)" = "Yay, this is the local file."'
19
 
 
20
 
step "Ensure the test environment is clean"
21
 
on agents, 'rm -f /tmp/source_file_test.txt'
22
 
 
23
 
step "when using a puppet:/// URI with puppet apply"
24
 
 
25
 
on agents, 'puppet agent --configprint modulepath' do
26
 
  modulepath = stdout.split(':')[0]
27
 
  modulepath = modulepath.chomp
28
 
  on agents, "mkdir -p #{modulepath}/test_module/files"
29
 
  on agents, "echo 'Yay, this is the puppet:/// file.' > #{modulepath}/test_module/files/test_file.txt"
30
 
end
31
 
 
32
 
on agents, %q{echo "file { '/tmp/source_file_test.txt': source => 'puppet:///modules/test_module/test_file.txt', ensure => present }" > /tmp/source_test_manifest.pp}
33
 
on agents, "puppet apply /tmp/source_test_manifest.pp"
34
 
 
35
 
on agents, 'test "$(cat /tmp/source_file_test.txt)" = "Yay, this is the puppet:/// file."'
36
 
 
37
 
# Oops. We (Jesse & Jacob) ended up writing this before realizing that you
38
 
# can't actually specify "source => 'http://...'".  However, we're leaving it
39
 
# here, since there have been feature requests to support doing this.
40
 
# -- Mon, 07 Mar 2011 16:12:56 -0800
41
 
#
42
 
#step "Ensure the test environment is clean"
43
 
#on agents, 'rm -f /tmp/source_file_test.txt'
44
 
#
45
 
#step "when using an http:// file path"
46
 
#
47
 
#File.open '/tmp/puppet-acceptance-webrick-script.rb', 'w' do |file|
48
 
#  file.puts %q{#!/usr/bin/env ruby
49
 
#
50
 
#require 'webrick'
51
 
#
52
 
#class Simple < WEBrick::HTTPServlet::AbstractServlet
53
 
#  def do_GET(request, response)
54
 
#    status, content_type, body = do_stuff_with(request)
55
 
#
56
 
#    response.status = status
57
 
#    response['Content-Type'] = content_type
58
 
#    response.body = body
59
 
#  end
60
 
#
61
 
#  def do_stuff_with(request)
62
 
#    return 200, "text/plain", "you got a page"
63
 
#  end
64
 
#end
65
 
#
66
 
#class SimpleTwo < WEBrick::HTTPServlet::AbstractServlet
67
 
#  def do_GET(request, response)
68
 
#    status, content_type, body = do_stuff_with(request)
69
 
#
70
 
#    response.status = status
71
 
#    response['Content-Type'] = content_type
72
 
#    response.body = body
73
 
#  end
74
 
#
75
 
#  def do_stuff_with(request)
76
 
#    return 200, "text/plain", "you got a different page"
77
 
#  end
78
 
#end
79
 
#
80
 
#server = WEBrick::HTTPServer.new :Port => 8081
81
 
#trap "INT"  do server.shutdown end
82
 
#trap "TERM" do server.shutdown end
83
 
#trap "QUIT" do server.shutdown end
84
 
#
85
 
#server.mount "/", SimpleTwo
86
 
#server.mount "/foo.txt", Simple
87
 
#server.start
88
 
#}
89
 
#end
90
 
#
91
 
#scp_to master, '/tmp/puppet-acceptance-webrick-script.rb', '/tmp'
92
 
#on master, "chmod +x /tmp/puppet-acceptance-webrick-script.rb && /tmp/puppet-acceptance-webrick-script.rb &"
93
 
#
94
 
#manifest = "file { '/tmp/source_file_test.txt': source => 'http://#{master}:8081/foo.txt', ensure => present }"
95
 
#
96
 
#apply_manifest_on agents, manifest
97
 
#
98
 
#on agents, 'test "$(cat /tmp/source_file_test.txt)" = "you got a page"'
99
 
#
100
 
#on master, "killall puppet-acceptance-webrick-script.rb"