Skip to content

Commit e405e94

Browse files
lsimonswilderrodrigues
authored andcommitted
Replace serverspec with nose in systemvm test.sh
Also remove the serverspec-specific files.
1 parent 2188d8d commit e405e94

File tree

11 files changed

+36
-144
lines changed

11 files changed

+36
-144
lines changed

test/systemvm/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ see ../../tools/vagrant/systemvm.
55

66
Then, install dependencies
77

8-
pip install nose paramiko python-vagrant envassert cuisine
8+
pip install nose paramiko python-vagrant envassert cuisine fabric
99

1010
Running tests
1111
=============

test/systemvm/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18+
from __future__ import with_statement
1819
from vagrant import Vagrant
1920
from unittest import TestCase
2021
from paramiko.config import SSHConfig
2122
from paramiko.client import SSHClient, AutoAddPolicy
2223
from fabric.api import env
24+
from fabric.api import run, hide
2325
from envassert import file, detect
2426

2527
from StringIO import StringIO
@@ -147,3 +149,9 @@ def setUp(self):
147149
# this could break down when executing multiple test cases in parallel in the same python process
148150
# def tearDown(self):
149151
# env.host_string = self._env_host_string_orig
152+
153+
154+
def has_line(location, line):
155+
with hide("everything"):
156+
text = run('cat "%s"' % location)
157+
return text.find(line) >= 0

test/systemvm/test_hello_systemvm.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
from envassert import file, package, user
2222
from cuisine import file_write
2323
try:
24-
from . import SystemVMTestCase
24+
from . import SystemVMTestCase, has_line
2525
except (ImportError, ValueError):
26-
from systemvm import SystemVMTestCase
26+
from systemvm import SystemVMTestCase, has_line
2727

2828

2929
class HelloSystemVMTestCase(SystemVMTestCase):
@@ -47,5 +47,5 @@ def test_hello_systemvm_envassert(self):
4747
@attr(tags=["systemvm"], required_hardware="true")
4848
def test_hello_systemvm_cuisine(self):
4949
"""Test we can run cuisine on the systemvm"""
50-
file_write('/tmp/run_cuisine', 'success!\n')
51-
assert file.has_line('/tmp/run_cuisine', 'success!')
50+
file_write('/tmp/run_cuisine', '\n\nsuccess!\n')
51+
assert has_line('/tmp/run_cuisine', 'success!')

tools/vagrant/systemvm/.rspec

Lines changed: 0 additions & 3 deletions
This file was deleted.

tools/vagrant/systemvm/Gemfile

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,4 @@
1717

1818
source 'https://rubygems.org'
1919

20-
gem 'rake'
21-
gem 'rspec', '~> 2.99'
22-
gem 'serverspec', '~> 1.11.0'
23-
gem 'rspec_junit_formatter'
2420
gem 'vagrant-wrapper'

tools/vagrant/systemvm/README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ under the License.
1818
===========================================================
1919

2020
Allows spinning up the systemvm appliance from ../../appliance inside
21-
vagrant, and then running tests against it with serverspec.
21+
vagrant, and then running tests against it with nose.
2222

23-
To use, install vagrant, rvm, ruby, and bundler. Then run ./test.sh.
23+
To use, install vagrant, rvm, ruby, bundler, python and pip.
24+
Then run ./test.sh.
25+
26+
To write tests, create files underneath ../../../test/systemvm
27+
named test_xxx.py. These tests are standard python unit tests with
28+
some logic to SSH into the SystemVM. See
29+
../../../test/systemvm/README.md for more info.
2430

25-
To write tests, create files underneath spec/ whose names end in
26-
_spec.rb. These tests are [RSpec](http://rspec.info/) tests that use
27-
[Serverspec](http://serverspec.org/) matchers. Basically, they log
28-
in using SSH and then inspect files and processes. See the list of
29-
[Serverspec matchers](http://serverspec.org/resource_types.html)
30-
for inspiration.

tools/vagrant/systemvm/Rakefile

Lines changed: 0 additions & 25 deletions
This file was deleted.

tools/vagrant/systemvm/Vagrantfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ include RbConfig
2222

2323
VAGRANTFILE_API_VERSION = '2'
2424

25-
if ENV['VPC_IP']
25+
unless ENV['VPC_IP']
2626
puts 'You did not specify the VPC IP by settings the VPC_IP environment variable'
2727
puts 'Using the default VPC_IP=192.168.56.30'
2828
end

tools/vagrant/systemvm/spec/spec_helper.rb

Lines changed: 0 additions & 69 deletions
This file was deleted.

tools/vagrant/systemvm/spec/test_cloudstack_metadata_spec.rb

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)