Skip to content

Commit

Permalink
Merge pull request #1253 from microsoft/enhancement-ci-windows-test-i…
Browse files Browse the repository at this point in the history
…ntegration

[ci] Support Integration Tests for Windows
  • Loading branch information
ppenna authored Apr 29, 2024
2 parents ba498f1 + b558699 commit bdb1fe0
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 17 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/catloop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ jobs:
--branch origin/$branch_name \
--libos $LIBOS \
--debug \
--test-unit --test-system all --delay 2 --enable-nfs \
--test-unit --test-integration --test-system all \
--delay 2 --enable-nfs \
--server-addr $SERVER_ADDR \
--client-addr $CLIENT_ADDR
- name: Archive Logs
Expand Down Expand Up @@ -109,7 +110,8 @@ jobs:
--repository demikernel \
--branch origin/$branch_name \
--libos $LIBOS \
--test-unit --test-system all --delay 2 --enable-nfs \
--test-unit --test-integration --test-system all \
--delay 2 --enable-nfs \
--server-addr $SERVER_ADDR \
--client-addr $CLIENT_ADDR \
--connection-string "${{ secrets.AZURE_STORAGE_CONNECTION_STRING }}" \
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/catmem.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ jobs:
--branch origin/$branch_name \
--libos $LIBOS \
--debug \
--test-unit --test-system all --delay 2 --enable-nfs \
--test-unit --test-integration --test-system all \
--delay 2 --enable-nfs \
--server-addr $SERVER_ADDR \
--client-addr $CLIENT_ADDR
- name: Archive Logs
Expand Down Expand Up @@ -109,7 +110,8 @@ jobs:
--repository demikernel \
--branch origin/$branch_name \
--libos $LIBOS \
--test-unit --test-system all --delay 2 --enable-nfs \
--test-unit --test-integration --test-system all \
--delay 2 --enable-nfs \
--server-addr $SERVER_ADDR \
--client-addr $CLIENT_ADDR \
--connection-string "${{ secrets.AZURE_STORAGE_CONNECTION_STRING }}" \
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/catnap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ jobs:
--branch origin/$branch_name \
--libos $LIBOS \
--debug \
--test-unit --test-system all --delay 2 \
--test-unit --test-integration --test-system all \
--delay 2 \
--server-addr $SERVER_ADDR \
--client-addr $CLIENT_ADDR
- name: Archive Logs
Expand Down Expand Up @@ -109,7 +110,8 @@ jobs:
--repository demikernel \
--branch origin/$branch_name \
--libos $LIBOS \
--test-unit --test-system all --delay 2 \
--test-unit --test-integration --test-system all \
--delay 2 \
--server-addr $SERVER_ADDR \
--client-addr $CLIENT_ADDR \
--connection-string "${{ secrets.AZURE_STORAGE_CONNECTION_STRING }}" \
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/catnip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ jobs:
--branch origin/$branch_name \
--debug \
--libos $LIBOS \
--test-unit --test-system all --delay 2 \
--test-unit --test-integration --test-system all \
--delay 2 \
--server-addr $SERVER_ADDR \
--client-addr $CLIENT_ADDR
- name: Archive Logs
Expand Down Expand Up @@ -109,7 +110,8 @@ jobs:
--repository demikernel \
--branch origin/$branch_name \
--libos $LIBOS \
--test-unit --test-system all --delay 2 \
--test-unit --test-integration --test-system all \
--delay 2 \
--server-addr $SERVER_ADDR \
--client-addr $CLIENT_ADDR \
--connection-string "${{ secrets.AZURE_STORAGE_CONNECTION_STRING }}" \
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/catpowder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ jobs:
--branch origin/$branch_name \
--debug \
--libos $LIBOS \
--test-unit --test-system all --delay 2 \
--test-unit --test-integration --test-system all \
--delay 2 \
--server-addr $SERVER_ADDR \
--client-addr $CLIENT_ADDR
- name: Archive Logs
Expand Down Expand Up @@ -109,7 +110,8 @@ jobs:
--repository demikernel \
--branch origin/$branch_name \
--libos $LIBOS \
--test-unit --test-system all --delay 2 \
--test-unit --test-integration --test-system all \
--delay 2 \
--server-addr $SERVER_ADDR \
--client-addr $CLIENT_ADDR \
--connection-string "${{ secrets.AZURE_STORAGE_CONNECTION_STRING }}" \
Expand Down
2 changes: 1 addition & 1 deletion tools/ci/job/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def unit_test(self, test_name: str) -> BaseJob:

def integration_test(self, run_mode="") -> BaseJob:
if self.config["platform"] == "windows":
raise Exception("Integration tests are not supported on Windows")
return windows.TcpIntegrationTestJobOnWindows(self.config)
else:
if self.config["libos"] == "catmem":
return linux.PipeIntegrationTestJobOnLinux(self.config, run_mode=run_mode)
Expand Down
24 changes: 24 additions & 0 deletions tools/ci/job/windows.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.

import subprocess
import time
from ci.task.windows import BaseWindowsTask, CheckoutOnWindows, CompileOnWindows, RunOnWindows, CleanupOnWindows
from ci.job.utils import wait_and_report
from ci.job.generic import BaseJob
Expand Down Expand Up @@ -94,3 +96,25 @@ def __init__(self, config: dict):

def execute(self) -> bool:
return super().execute()


class IntegrationTestJobOnWindows(BaseWindowsJob):
def __init__(self, config: dict, name: str):
super().__init__(config, name)

def execute(self, server_cmd: str) -> bool:
serverTask: RunOnWindows = RunOnWindows(
super().server(), super().repository(), server_cmd, super().is_debug(), super().is_sudo(), super().config_path())
return super().execute(serverTask)


class TcpIntegrationTestJobOnWindows(IntegrationTestJobOnWindows):

def __init__(self, config: dict):
config["all_pass"] = True
super().__init__(config, "integration-test")
self.server_args: str = f"--local-address {super().server_addr()}:12345 --remote-address {super().client_addr()}:23456"

def execute(self) -> bool:
server_cmd: str = f"test-integration-rust TEST_INTEGRATION=tcp-test LIBOS={super().libos()} ARGS=\'{self.server_args}\'"
return super().execute(server_cmd)
19 changes: 13 additions & 6 deletions tools/demikernel_ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@

# Runs the CI pipeline.
def run_pipeline(
log_directory: str,
repository: str, branch: str, libos: str, is_debug: bool, server: str, client: str,
test_unit: bool, test_system: str, server_addr: str, client_addr: str, delay: float, config_path: str,
log_directory: str, repository: str, branch: str, libos: str, is_debug:
bool, server: str, client: str, test_unit: bool, test_integration: bool,
test_system: str, server_addr: str, client_addr: str, delay: float, config_path: str,
output_dir: str, enable_nfs: bool, install_prefix: str) -> int:
is_sudo: bool = True if libos == "catnip" or libos == "catpowder" or libos == "catloop" else False
status: dict[str, bool] = {}
Expand Down Expand Up @@ -67,7 +67,11 @@ def run_pipeline(
status["unit_tests"] = True
status["unit_tests"] &= factory.unit_test(test_name="test-unit-rust").execute()
status["unit_tests"] &= factory.unit_test(test_name="test-unit-c").execute()
if libos == "catnap" or libos == "catloop":

# STEP 4: Run integration tests.
if test_integration:
if status["checkout"] and status["compile"]:
if libos == "catnap" or libos == "catnapw" or libos == "catloop":
status["integration_tests"] = factory.integration_test().execute()
elif libos == "catmem":
status["integration_tests"] = factory.integration_test("standalone").execute()
Expand All @@ -76,7 +80,7 @@ def run_pipeline(
status["integration_tests"] = factory.integration_test("push-wait-async").execute()
status["integration_tests"] = factory.integration_test("pop-wait-async").execute()

# STEP 4: Run system tests.
# STEP 5: Run system tests.
if test_system and config["platform"] == "linux":
if status["checkout"] and status["compile"]:
ci_map = read_yaml(libos)
Expand Down Expand Up @@ -240,6 +244,8 @@ def read_args() -> argparse.Namespace:
# Test options.
parser.add_argument("--test-unit", action='store_true',
required=False, help="run unit tests")
parser.add_argument("--test-integration", action='store_true',
required=False, help="run integration tests")
parser.add_argument("--test-system", type=str,
required=False, help="run system tests")
parser.add_argument("--test-redis", action='store_true', required=False, help="run redis tests")
Expand Down Expand Up @@ -283,6 +289,7 @@ def main():

# Extract test options.
test_unit: bool = args.test_unit
test_integration: bool = args.test_integration
test_system: str = args.test_system
test_redis: bool = args.test_redis
server_addr: str = args.server_addr
Expand All @@ -309,7 +316,7 @@ def main():
mkdir(log_directory)

status: dict = run_pipeline(log_directory, repository, branch, libos, is_debug, server,
client, test_unit, test_system, server_addr,
client, test_unit, test_integration, test_system, server_addr,
client_addr, delay, config_path, output_dir, enable_nfs, install_prefix)

if test_redis:
Expand Down

0 comments on commit bdb1fe0

Please sign in to comment.