Skip to content

Commit

Permalink
Move freeze into system startup and rollback into After hook
Browse files Browse the repository at this point in the history
This is tricky because if the box were started outside this system in
an unfrozen state, the code as written would not notice that. need to
think on that

also rollback and possibly freeze doesn't seem to be actually
working, just noticed, but suspect the bug's been there for some time.
  • Loading branch information
jon-proulx committed Mar 17, 2012
1 parent 52fd52f commit 9c3dcf7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
4 changes: 4 additions & 0 deletions features/step_definitions/steps.rb
@@ -1,3 +1,7 @@
After do
@mybox.rollback
end

Given /^a vagrant vm (\w+) (?:is running|is up|)$/ do |box|
@mybox=VagrantBox.new(box)
@mybox.up
Expand Down
2 changes: 2 additions & 0 deletions features/support/vagrantbox.rb
Expand Up @@ -22,6 +22,8 @@ def up
if @env.primary_vm.state != :running
print "Booting #{@name} patience..."
@env.cli("up")
puts "frezzing mv state..."
self.freeze
puts "done"
end
raise "Failed to start vm #{@name} " if @env.primary_vm.state != :running
Expand Down
11 changes: 3 additions & 8 deletions features/vagrant_boots.feature
@@ -1,15 +1,11 @@
Feature: Booting

I want to cold boot a development VM
freeze state
run Scenario
revert state
loop
shutdown develoment VM
I want changes cause be each scenario to be isolated
(currently constuctor to freeze before and After hook roll back)

Background:
Background: have a running system
Given a vagrant vm puppetsqueeze64 is running
And the vm is frozen

Scenario: access motd
When the command cp /etc/motd /vagrant/motd.first is executed on the vm
Expand All @@ -21,6 +17,5 @@ Scenario: change motd
Then the contents of motd.second should be FOO

Scenario: access motd after change
Given I rollback the vm
When the command cp /etc/motd /vagrant/motd.second is executed on the vm
Then the files motd.first and motd.second should be the same

0 comments on commit 9c3dcf7

Please sign in to comment.