From 7eb1b72e74eda1d700ffcf8bc2a51b0cf92d31bf Mon Sep 17 00:00:00 2001 From: Dominic Sudy Date: Wed, 30 Aug 2023 13:48:10 +0200 Subject: [PATCH] Fix tests --- README.md | 8 ++++++- grpc-service-support/test/conftest.py | 1 - grpc-service-support/test/test_integration.py | 24 +++++++++++++++++++ setup/README.md | 1 + setup/test/test_integration.py | 2 +- vehicle-model-lifecycle/README.md | 1 + vehicle-model-lifecycle/test/conftest.py | 2 ++ 7 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 setup/README.md create mode 100644 vehicle-model-lifecycle/README.md diff --git a/README.md b/README.md index ae353a19..0bcb050f 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,9 @@ -# devenv-devcontainer-setup +# Velocitas Package for DevContainer Setup Repo for Devcontainer Configuration and vehicle model generation on container startup. + +## Components in this package + +* [Basic Setup](./setup/README.md) +* [gRPC Interface Support](./grpc-service-support/README.md) +* [Vehicle Signal Interface Support](./vehicle-model-lifecycle/README.md) diff --git a/grpc-service-support/test/conftest.py b/grpc-service-support/test/conftest.py index 3dcc5582..e8b27be6 100644 --- a/grpc-service-support/test/conftest.py +++ b/grpc-service-support/test/conftest.py @@ -20,4 +20,3 @@ def pytest_sessionstart(session): subprocess.check_call(["python", "-m", "pip", "install", "conan==1.60.2"]) subprocess.check_call(["velocitas", "init", "-f", "-v"], stdin=subprocess.PIPE) - subprocess.check_call(["velocitas", "sync"], stdin=subprocess.PIPE) diff --git a/grpc-service-support/test/test_integration.py b/grpc-service-support/test/test_integration.py index 201f31bd..ee009a39 100644 --- a/grpc-service-support/test/test_integration.py +++ b/grpc-service-support/test/test_integration.py @@ -1,4 +1,5 @@ import os +import subprocess from typing import List @@ -19,3 +20,26 @@ def test_grpc_package_is_generated(): assert os.path.exists(os.path.join(service_path, "conanfile.py")) assert os.path.exists(os.path.join(service_path, "include")) assert os.path.exists(os.path.join(service_path, "src")) + + +def test_project_depends_on_grpc_package(): + # Use a number rather than a bool to ensure + # the generator has added the dependency only + # once. + dependency_count = 0 + in_requires_section = False + for line in open("./conanfile.txt"): + if line.trim() == "[requires]": + in_requires_section = True + elif line.startswith("["): + in_requires_section = False + + if in_requires_section and line.trim() == "seats-service-sdk/auto": + dependency_count = dependency_count + 1 + + assert dependency_count == 1 + + +def test_project_is_buildable(): + assert subprocess.check_call(["./install_dependencies.sh"]) == 0 + assert subprocess.check_call(["./build.sh"]) == 0 diff --git a/setup/README.md b/setup/README.md new file mode 100644 index 00000000..cdfb4519 --- /dev/null +++ b/setup/README.md @@ -0,0 +1 @@ +# Basic Setup \ No newline at end of file diff --git a/setup/test/test_integration.py b/setup/test/test_integration.py index 6e3eac4b..b5967a8b 100644 --- a/setup/test/test_integration.py +++ b/setup/test/test_integration.py @@ -105,7 +105,7 @@ def test_files_synced(): changed_file.find(f"setup/src/{language}") != -1 ) - subprocess.check_call(["velocitas", "init", "-f", "-v"]) + subprocess.check_call(["velocitas", "init", "-f", "-v"], stdin=subprocess.PIPE) subprocess.check_call(["velocitas", "sync"]) git_status_output = subprocess.check_output( diff --git a/vehicle-model-lifecycle/README.md b/vehicle-model-lifecycle/README.md new file mode 100644 index 00000000..f8f6d753 --- /dev/null +++ b/vehicle-model-lifecycle/README.md @@ -0,0 +1 @@ +# Vehicle Signal Interface Support diff --git a/vehicle-model-lifecycle/test/conftest.py b/vehicle-model-lifecycle/test/conftest.py index c23feaab..51b8449c 100644 --- a/vehicle-model-lifecycle/test/conftest.py +++ b/vehicle-model-lifecycle/test/conftest.py @@ -1,4 +1,5 @@ import os +import subprocess def pytest_sessionstart(session): @@ -8,3 +9,4 @@ def pytest_sessionstart(session): """ os.chdir(os.environ["VELOCITAS_TEST_ROOT"]) + subprocess.check_call(["velocitas", "init", "-f", "-v"], stdin=subprocess.PIPE)