Skip to content

test: validate Vagrant version and add suspend(), resume() cycle #117

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 31, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions tests/test_vagrant.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

from __future__ import print_function
import os
import re
import shutil
import subprocess
import sys
Expand Down Expand Up @@ -307,6 +308,20 @@ def test_vm_lifecycle(vm_dir):
assert v.NOT_CREATED == v.status()[0].state


def test_vm_resumecycle(vm_dir):
"""Test methods controlling the VM - up(), suspend(), resume()."""
v = vagrant.Vagrant(vm_dir)

v.up()
assert v.RUNNING == v.status()[0].state

v.suspend()
assert v.SAVED == v.status()[0].state

v.resume()
assert v.RUNNING == v.status()[0].state


def test_valid_config(vm_dir):
v = vagrant.Vagrant(vm_dir)
v.up()
Expand Down Expand Up @@ -668,6 +683,14 @@ def test_make_file_cm(test_dir):
assert read_fh.read() == "one\ntwo\n"


def test_vagrant_version():
v = vagrant.Vagrant()
VAGRANT_VERSION = v.version()
sys.stdout.write(f"vagrant_version(): {VAGRANT_VERSION}\n")
version_result = bool(re.match("^[0-9.]+$", VAGRANT_VERSION))
assert version_result is True


def _execute_command_in_vm(v, command):
"""
Run command via ssh on the test vagrant box. Returns a tuple of the
Expand Down