diff options
Diffstat (limited to 'cucumber/features/step_definitions/snapshots.rb')
-rw-r--r-- | cucumber/features/step_definitions/snapshots.rb | 119 |
1 files changed, 0 insertions, 119 deletions
diff --git a/cucumber/features/step_definitions/snapshots.rb b/cucumber/features/step_definitions/snapshots.rb deleted file mode 100644 index 16e59a4b..00000000 --- a/cucumber/features/step_definitions/snapshots.rb +++ /dev/null @@ -1,119 +0,0 @@ -def checkpoints - cp = Hash.new - cp['disk-for-d-i'] = { - :temporary => true, - :description => "a disk is created for Debian Installer tests", - :parent_checkpoint => nil, - :steps => [ - 'I create a 8 GiB disk named "'+JOB_NAME+'"', - 'I plug sata drive "'+JOB_NAME+'"', - ] - } - - cp['disk-for-deb-edu'] = { - :temporary => true, - :description => "a disk is created for Debian Edu tests", - :parent_checkpoint => nil, - :steps => [ - 'I create a 64 GiB disk named "'+JOB_NAME+'"', - 'I plug sata drive "'+JOB_NAME+'"', - ] - } - - ['text', 'gui'].each do |m| - cp["boot-d-i-#{m}-to-tasksel"] = { - :temporary => true, - :description => "I have started Debian Installer in #{m} mode and stopped at the Tasksel prompt", - :parent_checkpoint => 'disk-for-d-i', - :steps => [ - "I intend to use #{m} mode", - 'I start the computer', - 'I select the install mode', - 'I select British English', - 'I accept the hostname, using "example.com" as the domain', - 'I set the root password to "rootme"', - 'I set the password for "Philip Hands" to be "verysecret"', - 'I select full-disk, single-filesystem partitioning', - 'I note that the Base system is being installed', - 'I accept the default mirror', - 'I ignore Popcon', - 'we reach the Tasksel prompt', - ] - } - - ['minimal', 'non-GUI', 'Gnome', 'XFCE', 'LXDE', 'KDE'].each do |de| - cp["debian-#{m}-#{de}-install"] = { - :temporary => true, - :description => "I install a #{de} Debian system, in #{m} mode", - :parent_checkpoint => "boot-d-i-#{m}-to-tasksel", - :steps => [ - "I intend to use #{m} mode", - "I select the #{de} task", - 'I wait while the bulk of the packages are installed', - 'I install GRUB', - 'I allow reboot after the install is complete', - 'I wait for the reboot', - 'I power off the computer', - 'the computer is set to boot from sata drive', - ] - } - end - end - - return cp -end - -def reach_checkpoint(name) - scenario_indent = " "*4 - step_indent = " "*6 - - step "a computer" - if VM.snapshot_exists?(name) - $vm.restore_snapshot(name) - post_snapshot_restore_hook - else - checkpoint = checkpoints[name] - checkpoint_description = checkpoint[:description] - parent_checkpoint = checkpoint[:parent_checkpoint] - steps = checkpoint[:steps] - if parent_checkpoint - if VM.snapshot_exists?(parent_checkpoint) - $vm.restore_snapshot(parent_checkpoint) - else - reach_checkpoint(parent_checkpoint) - end - post_snapshot_restore_hook - end - debug_log(scenario_indent + "Checkpoint: #{checkpoint_description}", - color: :white, timestamp: false) - step_action = "Given" - if parent_checkpoint - parent_description = checkpoints[parent_checkpoint][:description] - debug_log(step_indent + "#{step_action} #{parent_description}", - color: :green, timestamp: false) - step_action = "And" - end - steps.each do |s| - begin - step(s) - rescue Exception => e - debug_log(scenario_indent + - "Step failed while creating checkpoint: #{s}", - color: :red, timestamp: false) - raise e - end - debug_log(step_indent + "#{step_action} #{s}", - color: :green, timestamp: false) - step_action = "And" - end - $vm.save_snapshot(name) - end -end - -# For each checkpoint we generate a step to reach it. -checkpoints.each do |name, desc| - step_regex = Regexp.new("^#{Regexp.escape(desc[:description])}$") - Given step_regex do - reach_checkpoint(name) - end -end |