Fix the gate jobs

Enable unit tests and fix gate jobs.

Change-Id: Ie9c4b2357820b0180cabcbc9de196d09f7e0b6a8
This commit is contained in:
Radoslav Gerganov 2017-02-22 10:18:26 -05:00
parent d29b44bdf3
commit 80c44388b1
5 changed files with 37 additions and 2 deletions

4
.testr.conf Normal file
View File

@ -0,0 +1,4 @@
[DEFAULT]
test_command=python -m subunit.run discover -t ./ ./vspc/tests $LISTOPT $IDOPTION
test_id_option=--load-list $IDFILE
test_list_option=--list

View File

@ -1,2 +1,4 @@
flake8
testrepository
testtools
mock

View File

@ -5,7 +5,7 @@ skipsdist = True
[testenv]
deps = -rrequirements.txt
-rtest-requirements.txt
#commands = python setup.py testr --slowest --testr-args='{posargs}'
commands = python setup.py testr --slowest --testr-args='{posargs}'
[testenv:pep8]
basepython = /usr/bin/python3

0
vspc/tests/__init__.py Normal file
View File

29
vspc/tests/test_server.py Normal file
View File

@ -0,0 +1,29 @@
# Copyright (c) 2017 VMware Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import mock
import testtools
from vspc import server
class VspcServerTest(testtools.TestCase):
def test_handle_vm_vc_uuid(self):
mock_socket = mock.Mock()
srv = server.VspcServer()
data = b'11 22 33 44 55'
srv.handle_vm_vc_uuid(mock_socket, data)
actual_uuid = srv.sock_to_uuid[mock_socket]
self.assertEqual('1122334455', actual_uuid)