Skip to content

Commit

Permalink
tag-agnostic comparison, simplify tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Kristian Aune committed Apr 4, 2022
1 parent 89cb018 commit c45fdcb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 17 deletions.
4 changes: 2 additions & 2 deletions vespa/deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def __init__(
container_memory: Union[str, int] = 4 * (1024 ** 3),
output_file: IO = sys.stdout,
container: Optional[docker.models.containers.Container] = None,
container_image: str = "vespaengine/vespa:latest"
container_image: str = "vespaengine/vespa"
) -> None:
"""
Manage Docker deployments.
Expand Down Expand Up @@ -425,7 +425,7 @@ def __repr__(self):
repr(self.container_name),
repr(self.container_id),
repr(self.container_memory),
repr(self.container_image),
repr(self.container_image.split(":")[0]),
)


Expand Down
24 changes: 9 additions & 15 deletions vespa/test_integration_docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ def create_sequence_classification_task():


class TestDockerCommon(unittest.TestCase):
def deploy(self, application_package, disk_folder, container_image=""):
if len(container_image) > 0:
def deploy(self, application_package, disk_folder, container_image=None):
if container_image:
self.vespa_docker = VespaDocker(port=8089, disk_folder=disk_folder, container_image=container_image)
else:
self.vespa_docker = VespaDocker(port=8089, disk_folder=disk_folder)
Expand All @@ -150,9 +150,10 @@ def deploy(self, application_package, disk_folder, container_image=""):
# Test VespaDocker serialization
#
self.assertEqual(
self.vespa_docker, VespaDocker.from_dict(self.vespa_docker.to_dict)
repr(self.vespa_docker), repr(VespaDocker.from_dict(self.vespa_docker.to_dict))
)


def deploy_from_disk_with_disk_folder(self, application_package, disk_folder):
self.vespa_docker = VespaDocker(port=8089, disk_folder=disk_folder)
self.vespa_docker.export_application_package(
Expand Down Expand Up @@ -1086,26 +1087,19 @@ def setUp(self) -> None:

def test_deploy(self):
self.deploy(application_package=self.app_package, disk_folder=self.disk_folder)

def tearDown(self) -> None:
shutil.rmtree(self.disk_folder, ignore_errors=True)
self.vespa_docker.container.stop()
self.vespa_docker.container.remove()

class TestQaDockerDeploymentImage(TestDockerCommon):
def setUp(self) -> None:
self.app_package = create_qa_application_package()
self.disk_folder = os.path.join(os.getenv("WORK_DIR"), "sample_application")

def test_deploy(self):
def test_deploy_image(self):
self.deploy(application_package=self.app_package,
disk_folder=self.disk_folder,
container_image="vespaengine/vespa:7.567.26")
container_image="vespaengine/vespa:7.566.21")
self.vespa_docker.container.stop()
self.vespa_docker.container.remove()

def tearDown(self) -> None:
shutil.rmtree(self.disk_folder, ignore_errors=True)
self.vespa_docker.container.stop()
self.vespa_docker.container.remove()


class TestMsmarcoApplication(TestApplicationCommon):
def setUp(self) -> None:
Expand Down

0 comments on commit c45fdcb

Please sign in to comment.