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

CART-831 TEST: add support for arbitrary envariables in yaml files #4445

Merged
merged 42 commits into from
Mar 11, 2021
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
44bd102
CART-831 tests: Add special other_env_vars param
mallove79 Jan 27, 2021
d102ccb
CART-831 tests: Use Yaml array syntax
mallove79 Jan 28, 2021
cc9d127
CART-831 tests: Fix pylint messages
mallove79 Jan 29, 2021
3de71a5
CART-831 tests: Resolve pylint warnings
mallove79 Feb 1, 2021
cf43b31
CART-831 tests: Method can be a function
mallove79 Feb 3, 2021
ef8c5fe
CART-831 tests: Add set_other_env_vars test
mallove79 Feb 4, 2021
9430ca3
CART-831 tests: main() is not needed
mallove79 Feb 5, 2021
7cecc44
CART-831 tests: Put all env vars in one yaml param
mallove79 Feb 9, 2021
578b9c5
Merge branch 'master' of https://github.com/daos-stack/daos into emal…
mallove79 Feb 9, 2021
862cfde
CART-831 tests: Merge master. Rerun CI tests.
mallove79 Feb 9, 2021
e2f522d
CART-831 tests: Protect against null env vars
mallove79 Feb 9, 2021
e1f9f3c
CART-831 tests: Remove set_other_env_vars script
mallove79 Feb 10, 2021
6cc1e12
CART-654 tests: Artifact archival issue? Re-try.
mallove79 Feb 10, 2021
589f7e9
Merge branch 'master' of https://github.com/daos-stack/daos into emal…
mallove79 Feb 11, 2021
7910a54
CART-831 tests: merge w/ master, and re-run.
mallove79 Feb 11, 2021
7636910
Merge branch 'master' of https://github.com/daos-stack/daos into emal…
mallove79 Feb 11, 2021
5bc5d57
CART-831 tests: Merge w/ master. Re-run.
mallove79 Feb 11, 2021
0c9c262
CART-831 tests: orterun CLI vars default to None
mallove79 Feb 11, 2021
966b445
Merge branch 'master' of https://github.com/daos-stack/daos into emal…
mallove79 Feb 16, 2021
502210c
CART-831 tests: Merge w/ master. Re-run.
mallove79 Feb 16, 2021
fd6637a
CART-831 tests: Oops -- missing "import os"
mallove79 Feb 16, 2021
2e2ffda
CART-831 tests: no camelCase, no aligning on '='
mallove79 Feb 16, 2021
8588d5e
CART-831 tests: pylint dislikes visual (=) align
mallove79 Feb 16, 2021
69f6b9e
CART-831 tests: Pylint dislikes os.environ["F"]
mallove79 Feb 16, 2021
903c4a5
CART-831 tests: pass_env needn't be class member
mallove79 Feb 17, 2021
5c75a2e
CART-831 tests: Adjust skip- pragmas
mallove79 Feb 17, 2021
25412f9
CART-831 tests: Remove unneeded YAML file
mallove79 Feb 23, 2021
a614036
CART-831 tests: Remove unhelpful print statements
mallove79 Feb 26, 2021
4a76526
Merge branch 'master' of https://github.com/daos-stack/daos into emal…
mallove79 Mar 2, 2021
f5dcccb
Merge branch 'master' of https://github.com/daos-stack/daos into emal…
mallove79 Mar 4, 2021
09adc5d
CART-831 tests: Check for dict key existence
mallove79 Mar 4, 2021
5f04779
Merge branch 'master' of https://github.com/daos-stack/daos into emal…
mallove79 Mar 4, 2021
86294b4
CART-831 tests: No more args to super in python 3
mallove79 Mar 5, 2021
28b66cd
CART-831 tests: python 3 super doesn't need args
mallove79 Mar 5, 2021
28f106d
CART-831 tests: Fix python indentation for pylint
mallove79 Mar 5, 2021
db256a9
Merge branch 'master' of https://github.com/daos-stack/daos into emal…
mallove79 Mar 9, 2021
2094671
CART-831 tests: Revert to python 2 super()
mallove79 Mar 9, 2021
7bccab9
CART-831 tests: Stringify all keys/vals in dict
mallove79 Mar 9, 2021
8cdc8a9
CART-654 tests: Supprese Pytnon 3 pylint messages
mallove79 Mar 9, 2021
286521a
CART-831 tests: params.get now returns OrderedDict
mallove79 Mar 10, 2021
b780fb8
CART-831 tests: Call super(.setUp) in py scripts
mallove79 Mar 10, 2021
44c9acd
CART-831 tests: Fix pylint indentation issues
mallove79 Mar 11, 2021
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
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def setUp(self):
print("Running setup\n")
self.utils = CartUtils()
self.env = self.utils.get_env(self)
self.utils.set_other_env_vars(self)
crt_phy_addr = self.params.get("CRT_PHY_ADDR_STR", '/run/defaultENV/')
ofi_interface = self.params.get("OFI_INTERFACE", '/run/defaultENV/')
ofi_ctx_num = self.params.get("CRT_CTX_NUM", '/run/defaultENV/')
Expand All @@ -61,6 +62,7 @@ def tearDown(self):

super(CartNoPmixOneNodeTest, self).tearDown()
self.utils.cleanup_processes()
self.utils.unset_other_env_vars(self)

def test_cart_no_pmix(self):
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ defaultENV:
OFI_INTERFACE: "eth0"
CRT_CTX_NUM: "8"
CRT_CTX_SHARE_ADDR: "0"
other_env_vars:
- ARBITRARY_ENV_VAR1: apple
- ARBITRARY_ENV_VAR2: orange
- ARBITRARY_ENV_VAR3: banana pear
tests: !mux
no_pmix_multi_ctx:
name: no_pmix_multi_ctx
Expand Down
28 changes: 28 additions & 0 deletions src/tests/ftest/cart/util/cart_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,34 @@ def stop_process(proc):

return procrtn

@staticmethod
def set_other_env_vars(cartobj):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we want to make it so that every cart test automatically calls this without having to do anything extra

""" import env vars from other_env_var param """
other_env_vars = cartobj.params.get("other_env_vars",
"/run/defaultENV/")
if other_env_vars is None:
print("other_env_vars was not set in yaml file.\n")
return

for kv_pair in other_env_vars:
key, value = kv_pair[0]
print("Adding {}={} to environment.\n".format(key, value))
os.environ[key] = value

@staticmethod
def unset_other_env_vars(cartobj):
""" import env vars from other_env_var param """
other_env_vars = cartobj.params.get("other_env_vars",
"/run/defaultENV/")
if other_env_vars is None:
print("other_env_vars was not set in yaml file.\n")
return

for kv_pair in other_env_vars:
key = kv_pair[0][0]
print("Removing key {} from environment.\n".format(key))
del os.environ[key]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure i see the purpose of this function


# What is special about pylint's 15 variable limit?
# pylint: disable=too-many-locals
def get_env(self, cartobj):
Expand Down