Skip to content

Commit fb63e81

Browse files
authored
Merge pull request #117 from konstruktoid/pyconv
test: validate Vagrant version and add suspend(), resume() cycle
2 parents df4291d + 566c2c5 commit fb63e81

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tests/test_vagrant.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
from __future__ import print_function
1818
import os
19+
import re
1920
import shutil
2021
import subprocess
2122
import sys
@@ -328,6 +329,20 @@ def test_vm_lifecycle(vm_dir):
328329
os.unlink(f"{VAGRANT_DIR}/Vagrantfile")
329330

330331

332+
def test_vm_resumecycle(vm_dir):
333+
"""Test methods controlling the VM - up(), suspend(), resume()."""
334+
v = vagrant.Vagrant(vm_dir)
335+
336+
v.up()
337+
assert v.RUNNING == v.status()[0].state
338+
339+
v.suspend()
340+
assert v.SAVED == v.status()[0].state
341+
342+
v.resume()
343+
assert v.RUNNING == v.status()[0].state
344+
345+
331346
def test_valid_config(vm_dir):
332347
v = vagrant.Vagrant(vm_dir)
333348
v.up()
@@ -688,6 +703,14 @@ def test_make_file_cm(test_dir):
688703
assert read_fh.read() == "one\ntwo\n"
689704

690705

706+
def test_vagrant_version():
707+
v = vagrant.Vagrant()
708+
VAGRANT_VERSION = v.version()
709+
sys.stdout.write(f"vagrant_version(): {VAGRANT_VERSION}\n")
710+
version_result = bool(re.match("^[0-9.]+$", VAGRANT_VERSION))
711+
assert version_result is True
712+
713+
691714
def _execute_command_in_vm(v, command):
692715
"""
693716
Run command via ssh on the test vagrant box. Returns a tuple of the

0 commit comments

Comments
 (0)