Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cycle34 release - v0.17.0 #88

Merged
merged 21 commits into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
ee47c29
Updated the config files with OCPS:2 to make the string 'replace_me' …
rbovill Oct 25, 2023
ebb593a
Updated obssys_disabled_enabled.py to define with OCPS index to use b…
rbovill Oct 25, 2023
af035b0
Updated .gitignore with new pre-commit items.
rbovill Oct 26, 2023
de8de2a
Updated obssys_standby_disabled.py to define with OCPS index to use b…
rbovill Oct 26, 2023
1053f4f
Updated enabled_offline.pyto define with OCPS index to use based on t…
rbovill Oct 26, 2023
685f773
Mocking the command-line argument.
rbovill Oct 26, 2023
ec068ac
Updated unit tests to verify OCPS index based on test environment.
rbovill Oct 30, 2023
62a51cc
Removed unnecessary use of sys.argv from test_load_camera_playlist.py.
rbovill Oct 27, 2023
dc6827b
Updated version-history.
rbovill Oct 27, 2023
2dba287
Moved the test_env argument definition to a function in the new utils…
rbovill Oct 30, 2023
fe19a48
Added more verbose logging to the tests/test_obssys_state_transitions…
rbovill Oct 30, 2023
648e17e
Merge pull request #85 from lsst-ts/tickets/DM-41263
rbovill Oct 30, 2023
1aa2095
Updated love_stress_test.py and love_stress_test_configs.py to define…
rbovill Oct 31, 2023
2d169d3
Updated test_love_stress.py unit test with new 'location' defintion.
rbovill Oct 31, 2023
32daa3a
Updated version-history.
rbovill Oct 31, 2023
2098d0e
Merge pull request #86 from lsst-ts/tickets/DM-41284
rbovill Nov 2, 2023
866ccac
Added the 'k8s' boolean argument to utils.py.
rbovill Nov 3, 2023
b0d288c
Added handling of the 'location' value if the script is running again…
rbovill Nov 3, 2023
150bdd4
Added a unit test test_love_stress.py for the kubernetes location.
rbovill Nov 3, 2023
b23fcdc
Updated version-history.
rbovill Nov 3, 2023
34913c1
Merge pull request #87 from lsst-ts/tickets/DM-41552
rbovill Nov 7, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading