Skip to content

Commit

Permalink
Merge pull request #88 from lsst-ts/develop
Browse files Browse the repository at this point in the history
Cycle34 release - v0.17.0
  • Loading branch information
rbovill authored Nov 29, 2023
2 parents 8ed83cf + 34913c1 commit cf8b241
Show file tree
Hide file tree
Showing 15 changed files with 307 additions and 38 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,6 @@ ospl*log
.flake8
.isort.cfg
.mypy.ini
.clang-format
.ruff.toml
towncrier.toml
6 changes: 6 additions & 0 deletions doc/version-history.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ Version History
.. No new work should be required in order to complete this section.
.. Below is an example of a version history format.
v0.17.0
-------
* Parameterized the OCSP 2||3 index, determined by test environment.
* Updated love_stress_test to define the LOVE 'location' URL based on the test environment.
* Added LOVE kubernetes instance testing.

v0.16.0
-------
* Added Watcher to the ObsSys State transition tests.
Expand Down
1 change: 1 addition & 0 deletions python/lsst/ts/IntegrationTests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,5 @@
from .obssys_standby_disabled import *
from .script_queue_controller import *
from .testutils import *
from .utils import *
from .yaml_test_strings import *
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
- [Scheduler:1, OFFLINE]
- [Scheduler:2, OFFLINE]
- [OCPS:1, OFFLINE]
- [OCPS:2, OFFLINE]
- [replace_me, OFFLINE]
"""
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

registry["love_stress"] = yaml.safe_dump(
{
"location": "love1.tu.lsst.org",
"location": "replace_me",
"number_of_clients": 50,
"number_of_messages": 5000,
"data": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
- [Scheduler:1, DISABLED]
- [Scheduler:2, DISABLED]
- [OCPS:1, DISABLED]
- [OCPS:2, DISABLED]
- [replace_me, DISABLED]
- [Watcher, DISABLED]
"""
)
Expand All @@ -50,7 +50,7 @@
- [Scheduler:1, ENABLED]
- [Scheduler:2, ENABLED]
- [OCPS:1, ENABLED]
- [OCPS:2, ENABLED]
- [replace_me, ENABLED]
- [Watcher, ENABLED]
"""
)
Expand Down
64 changes: 59 additions & 5 deletions python/lsst/ts/IntegrationTests/enabled_offline.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@

__all__ = ["EnabledOffline", "run_enabled_offline"]

import argparse
import asyncio

import yaml
from lsst.ts.IntegrationTests import BaseScript

from .configs.config_registry import registry
Expand Down Expand Up @@ -63,12 +65,64 @@ class EnabledOffline(BaseScript):
("set_summary_state.py", BaseScript.is_standard),
]

def __init__(self) -> None:
def __init__(self, test_env: str) -> None:
super().__init__()
# Set the OCPS index based on test environment
self.test_env = test_env
self.env_configs = yaml.safe_load(self.configs[1])
if test_env.lower() == "bts":
# Running on BTS with OCPS:3
self.ocps = "OCPS:3"
else:
# Running on TTS or Summit with OCPS:2
self.ocps = "OCPS:2"
self.env_configs["data"][3][0] = self.ocps
# Update the self.configs tuple with the updated
# registry["sched_ocps_enabled_offline"] configuration.
# Do this by converting the tuple to a list, replacing the
# updated entry and converting it back to a tuple.
temp_list = list(self.configs)
temp_list[1] = yaml.safe_dump(
self.env_configs, explicit_start=True, canonical=True
)
self.configs = tuple(temp_list)


def run_enabled_offline() -> None:
script_class = EnabledOffline()
num_scripts = len(script_class.scripts)
print(f"\nEnabled to Offline; running {num_scripts} scripts")
asyncio.run(script_class.run())
# Define the script arguments.
parser = argparse.ArgumentParser()
parser.add_argument(
"test_env",
nargs="?",
type=str.lower,
choices=["bts", "tts", "summit"],
help="Specify on which environment the tests are running (case insensitive).",
)
args = parser.parse_args()
# Print the help if the environment is not defined.
if not (args.test_env):
parser.print_help()
exit()
main(args)


def main(opts: argparse.Namespace) -> None:
# Ensure the invocation is correct.
# If not, raise KeyError.
# If it is correct, execute the state transition.
try:
script_class = EnabledOffline(
test_env=opts.test_env,
)
except KeyError as ke:
print(repr(ke))
else:
num_scripts = len(script_class.scripts)
print(
f"\nEnabled to Offline; "
f"running {num_scripts} scripts "
f"on the '{opts.test_env}' environment. "
f"with this configuration: \n"
f"{script_class.configs}"
)
asyncio.run(script_class.run())
63 changes: 58 additions & 5 deletions python/lsst/ts/IntegrationTests/love_stress_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,26 @@

import asyncio

import yaml
from lsst.ts.IntegrationTests import BaseScript

from .configs.config_registry import registry
from .utils import get_test_env_arg


class LoveStressTest(BaseScript):
"""Execute the given Standard or External script,
with the given Yaml configuration,
placed in the given ScriptQueue location.
Attributes
----------
test_env : `str`
Defines which test environment the script is running.
Choices are ['bts', 'tts', 'summit'].
k8s : `bool`
Indicates if the script should run against the kubernetes
instance. Default is False.
"""

index: int = 1
Expand All @@ -42,12 +52,55 @@ class LoveStressTest(BaseScript):
("make_love_stress_tests.py", BaseScript.is_external),
]

def __init__(self) -> None:
def __init__(self, test_env: str, k8s: bool = False) -> None:
super().__init__()
# Set the LOVE location based on test environment
self.test_env = test_env
self.k8s = k8s
self.env_configs = yaml.safe_load(registry["love_stress"])
if test_env.lower() == "summit":
# Running on Summit
if self.k8s:
self.location = "https://summit-lsp.lsst.codes/love"
else:
self.location = "http://love01.cp.lsst.org"
elif test_env.lower() == "tts":
# Running on TTS
if self.k8s:
self.location = "https://tucson-teststand.lsst.codes/love"
else:
self.location = "http://love1.tu.lsst.org"
elif test_env.lower() == "bts":
# Running on BTS
if self.k8s:
self.location = "https://base-lsp.lsst.codes/love"
else:
self.location = "http://love01.ls.lsst.org"
else:
raise Exception(
"Please choose one of the proper locations: ['bts', 'tts', 'summit']"
)
self.env_configs["location"] = self.location
self.configs = (yaml.safe_dump(self.env_configs),)


def run_love_stress_test() -> None:
script_class = LoveStressTest()
num_scripts = len(script_class.scripts)
print(f"\nLOVE Stress Test; running {num_scripts} scripts")
asyncio.run(script_class.run())
# Ensure the invocation is correct.
# If not, raise KeyError.
# If it is correct, execute the Stress Test.
args = get_test_env_arg()
try:
script_class = LoveStressTest(
test_env=args.test_env,
k8s=args.k8s,
)
except KeyError as ke:
print(repr(ke))
else:
num_scripts = len(script_class.scripts)
print(
f"\nLOVE Stress Test; running {num_scripts} scripts"
f" with this configuration:\n"
f"{script_class.configs}"
)
asyncio.run(script_class.run())
39 changes: 34 additions & 5 deletions python/lsst/ts/IntegrationTests/obssys_disabled_enabled.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@

import asyncio

import yaml
from lsst.ts.IntegrationTests import BaseScript

from .configs.config_registry import registry
from .utils import get_test_env_arg


class ObsSysDisabledEnabled(BaseScript):
Expand All @@ -42,12 +44,39 @@ class ObsSysDisabledEnabled(BaseScript):
("set_summary_state.py", BaseScript.is_standard),
]

def __init__(self) -> None:
def __init__(self, test_env: str) -> None:
super().__init__()
# Set the OCPS index based on test environment
self.test_env = test_env
self.env_configs = yaml.safe_load(registry["obssys_disabled_enabled"])
if test_env.lower() == "bts":
# Running on BTS with OCPS:3
self.ocps = "OCPS:3"
else:
# Running on TTS or Summit with OCPS:2
self.ocps = "OCPS:2"
self.env_configs["data"][3][0] = self.ocps
self.configs = (yaml.safe_dump(self.env_configs),)


def run_obssys_disabled_enabled() -> None:
script_class = ObsSysDisabledEnabled()
num_scripts = len(script_class.scripts)
print(f"\nObsSys Disabled to Enabled; running {num_scripts} scripts")
asyncio.run(script_class.run())
# Ensure the invocation is correct.
# If not, raise KeyError.
# If it is correct, execute the state transition.
args = get_test_env_arg()
try:
script_class = ObsSysDisabledEnabled(
test_env=args.test_env,
)
except KeyError as ke:
print(repr(ke))
else:
num_scripts = len(script_class.scripts)
print(
f"\nObsSys Disabled to Enabled; "
f"running {num_scripts} scripts "
f"on the '{args.test_env}' environment, "
f"with this configuration: \n"
f"{script_class.configs}"
)
asyncio.run(script_class.run())
39 changes: 34 additions & 5 deletions python/lsst/ts/IntegrationTests/obssys_standby_disabled.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@

import asyncio

import yaml
from lsst.ts.IntegrationTests import BaseScript

from .configs.config_registry import registry
from .utils import get_test_env_arg


class ObsSysStandbyDisabled(BaseScript):
Expand All @@ -42,12 +44,39 @@ class ObsSysStandbyDisabled(BaseScript):
("set_summary_state.py", BaseScript.is_standard),
]

def __init__(self) -> None:
def __init__(self, test_env: str) -> None:
super().__init__()
# Set the OCPS index based on test environment
self.test_env = test_env
self.env_configs = yaml.safe_load(registry["obssys_standby_disabled"])
if test_env.lower() == "bts":
# Running on BTS with OCPS:3
self.ocps = "OCPS:3"
else:
# Running on TTS or Summit with OCPS:2
self.ocps = "OCPS:2"
self.env_configs["data"][3][0] = self.ocps
self.configs = (yaml.safe_dump(self.env_configs),)


def run_obssys_standby_disabled() -> None:
script_class = ObsSysStandbyDisabled()
num_scripts = len(script_class.scripts)
print(f"\nObsSys Standby to Disabled; running {num_scripts} scripts")
asyncio.run(script_class.run())
# Ensure the invocation is correct.
# If not, raise KeyError.
# If it is correct, execute the state transition.
args = get_test_env_arg()
try:
script_class = ObsSysStandbyDisabled(
test_env=args.test_env,
)
except KeyError as ke:
print(repr(ke))
else:
num_scripts = len(script_class.scripts)
print(
f"\nObsSys Standby to Disabled; "
f"running {num_scripts} scripts "
f"on the '{args.test_env}' environment. "
f"with this configuration: \n"
f"{script_class.configs}"
)
asyncio.run(script_class.run())
47 changes: 47 additions & 0 deletions python/lsst/ts/IntegrationTests/utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This file is part of ts_IntegrationTests.
#
# Developed for the Vera C. Rubin Observatory Telescope & Site Software system.
# This product includes software developed by the Vera C. Rubin Observatory
# Project (https://www.lsst.org).
# See the COPYRIGHT file at the top-level directory of this distribution
# for details of code ownership.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License

import argparse


def get_test_env_arg() -> None:
# Define the script arguments.
parser = argparse.ArgumentParser()
parser.add_argument(
"test_env",
nargs="?",
type=str.lower,
choices=["bts", "tts", "summit"],
help="Specify on which environment the tests are running (case insensitive).",
)
parser.add_argument(
"--k8s",
default=False,
action="store_true",
help="Specify if the tests are running against the kubernetes instance.",
)
args = parser.parse_args()
# Print the help if the environment is not defined.
if not (args.test_env):
parser.print_help()
exit()
return args
Loading

0 comments on commit cf8b241

Please sign in to comment.