From 9c3dcf7a543f1696c4b52b9bc0088f1f202ee390 Mon Sep 17 00:00:00 2001 From: Jon Proulx Date: Sat, 17 Mar 2012 19:00:59 -0400 Subject: [PATCH] Move freeze into system startup and rollback into After hook 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. --- features/step_definitions/steps.rb | 4 ++++ features/support/vagrantbox.rb | 2 ++ features/vagrant_boots.feature | 11 +++-------- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/features/step_definitions/steps.rb b/features/step_definitions/steps.rb index 7afdd3b..2003b7f 100644 --- a/features/step_definitions/steps.rb +++ b/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 diff --git a/features/support/vagrantbox.rb b/features/support/vagrantbox.rb index e079ef4..9663f58 100644 --- a/features/support/vagrantbox.rb +++ b/features/support/vagrantbox.rb @@ -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 diff --git a/features/vagrant_boots.feature b/features/vagrant_boots.feature index a6a4817..f2ad055 100644 --- a/features/vagrant_boots.feature +++ b/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 @@ -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