mirror of
https://github.com/vale981/ray
synced 2025-03-06 02:21:39 -05:00

OSS release tests currently run with hardcoded Python 3.7 base. In the future we will want to run tests on different python versions. This PR adds support for a new `python` field in the test configuration. The python field will determine both the base image used in the Buildkite runner docker container (for Ray client compatibility) and the base image for the Anyscale cluster environments. Note that in Buildkite, we will still only wait for the python 3.7 base image before kicking off tests. That is acceptable, as we can assume that most wheels finish in a similar time, so even if we wait for the 3.7 image and kick off a 3.8 test, that runner will wait maybe for 5-10 more minutes.
99 lines
3.2 KiB
Python
99 lines
3.2 KiB
Python
import os
|
|
import sys
|
|
import unittest
|
|
|
|
from ray_release.config import (
|
|
read_and_validate_release_test_collection,
|
|
Test,
|
|
validate_release_test_collection,
|
|
)
|
|
from ray_release.exception import ReleaseTestConfigError
|
|
|
|
|
|
class ConfigTest(unittest.TestCase):
|
|
def setUp(self) -> None:
|
|
self.test_collection_file = os.path.join(
|
|
os.path.dirname(__file__), "..", "..", "release_tests.yaml"
|
|
)
|
|
|
|
self.valid_test = Test(
|
|
**{
|
|
"name": "validation_test",
|
|
"group": "validation_group",
|
|
"working_dir": "validation_dir",
|
|
"legacy": {
|
|
"test_name": "validation_test",
|
|
"test_suite": "validation_suite",
|
|
},
|
|
"python": "3.7",
|
|
"frequency": "nightly",
|
|
"team": "release",
|
|
"cluster": {
|
|
"cluster_env": "app_config.yaml",
|
|
"cluster_compute": "tpl_cpu_small.yaml",
|
|
"autosuspend_mins": 10,
|
|
},
|
|
"run": {
|
|
"timeout": 100,
|
|
"script": "python validate.py",
|
|
"wait_for_nodes": {"num_nodes": 2, "timeout": 100},
|
|
"type": "client",
|
|
},
|
|
"smoke_test": {"run": {"timeout": 20}, "frequency": "multi"},
|
|
"alert": "default",
|
|
}
|
|
)
|
|
|
|
def testSchemaValidation(self):
|
|
test = self.valid_test.copy()
|
|
|
|
validate_release_test_collection([test])
|
|
|
|
# Remove some optional arguments
|
|
del test["alert"]
|
|
del test["python"]
|
|
del test["run"]["wait_for_nodes"]
|
|
del test["cluster"]["autosuspend_mins"]
|
|
|
|
validate_release_test_collection([test])
|
|
|
|
# Add some faulty arguments
|
|
|
|
# Faulty frequency
|
|
invalid_test = test.copy()
|
|
invalid_test["frequency"] = "invalid"
|
|
with self.assertRaises(ReleaseTestConfigError):
|
|
validate_release_test_collection([invalid_test])
|
|
|
|
# Faulty job type
|
|
invalid_test = test.copy()
|
|
invalid_test["run"]["type"] = "invalid"
|
|
with self.assertRaises(ReleaseTestConfigError):
|
|
validate_release_test_collection([invalid_test])
|
|
|
|
# Faulty file manager type
|
|
invalid_test = test.copy()
|
|
invalid_test["run"]["file_manager"] = "invalid"
|
|
with self.assertRaises(ReleaseTestConfigError):
|
|
validate_release_test_collection([invalid_test])
|
|
|
|
# Faulty smoke test
|
|
invalid_test = test.copy()
|
|
del invalid_test["smoke_test"]["frequency"]
|
|
with self.assertRaises(ReleaseTestConfigError):
|
|
validate_release_test_collection([invalid_test])
|
|
|
|
# Faulty Python version
|
|
invalid_test = test.copy()
|
|
invalid_test["python"] = "invalid"
|
|
with self.assertRaises(ReleaseTestConfigError):
|
|
validate_release_test_collection([invalid_test])
|
|
|
|
def testLoadAndValidateTestCollectionFile(self):
|
|
read_and_validate_release_test_collection(self.test_collection_file)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
import pytest
|
|
|
|
sys.exit(pytest.main(["-v", __file__]))
|