@@ -66,7 +66,7 @@ module Puppet
66
66
} }
67
67
} ,
68
68
} ,
69
- 'm2' => {
69
+ 'm2' => {
70
70
'lib' => { 'puppet' => { 'type' => {
71
71
'test2.rb' => <<-EOF
72
72
module Puppet
@@ -184,9 +184,7 @@ module Puppet
184
184
# create them (first run)
185
185
genface . types
186
186
stats_before = [ Puppet ::FileSystem . stat ( File . join ( outputdir , 'test1.pp' ) ) , Puppet ::FileSystem . stat ( File . join ( outputdir , 'test2.pp' ) ) ]
187
- # fake change in input test1 - sorry about the sleep (which there was a better way to change the modtime
188
- sleep ( 1 )
189
- Puppet ::FileSystem . touch ( File . join ( m1 , 'lib' , 'puppet' , 'type' , 'test1.rb' ) )
187
+ Puppet ::FileSystem . touch ( File . join ( m1 , 'lib' , 'puppet' , 'type' , 'test1.rb' ) , :mtime => Time . now + 10 )
190
188
# generate again
191
189
genface . types
192
190
# assert that test1 was overwritten (later) but not test2 (same time)
@@ -199,8 +197,7 @@ module Puppet
199
197
# create them (first run)
200
198
genface . types
201
199
stats_before = [ Puppet ::FileSystem . stat ( File . join ( outputdir , 'test1.pp' ) ) , Puppet ::FileSystem . stat ( File . join ( outputdir , 'test2.pp' ) ) ]
202
- # generate again
203
- sleep ( 1 ) # sorry, if there is no delay the stats will be the same
200
+ Puppet ::FileSystem . touch ( File . join ( outputdir , 'test2.pp' ) , :mtime => Time . now + 10 )
204
201
genface . types ( :force => true )
205
202
stats_after = [ Puppet ::FileSystem . stat ( File . join ( outputdir , 'test1.pp' ) ) , Puppet ::FileSystem . stat ( File . join ( outputdir , 'test2.pp' ) ) ]
206
203
expect ( stats_before <=> stats_after ) . to be ( -1 )
@@ -220,6 +217,18 @@ module Puppet
220
217
expect ( stat_before <=> stats_after ) . to be ( 0 )
221
218
end
222
219
220
+ it 'overwrites if ruby files in lib/puppet_x/ are updated' do
221
+ # create them (first run)
222
+ puppet_x_lib = File . join ( m1 , 'lib' , 'puppet_x' , 'foo' , 'library.rb' )
223
+ Puppet ::FileSystem . mkpath ( puppet_x_lib )
224
+ genface . types
225
+ stat_before = Puppet ::FileSystem . stat ( File . join ( outputdir , 'test1.pp' ) )
226
+ Puppet ::FileSystem . touch ( puppet_x_lib , :mtime => Time . now + 10 )
227
+ genface . types
228
+ stat_after = Puppet ::FileSystem . stat ( File . join ( outputdir , 'test1.pp' ) )
229
+ expect ( stat_before <=> stat_after ) . to be ( -1 )
230
+ end
231
+
223
232
end
224
233
225
234
context "in an environment with a faulty type" do
0 commit comments