test: run openedx and common tests with both lms and cms settings - #29676
Conversation
7b0a319 to
d6fe637
Compare
| "common-1": "common/djangoapps/", | ||
| "common-2": "common/lib/" | ||
| "lms-1": { | ||
| "path": ["lms/djangoapps/badges/","lms/djangoapps/branding/","lms/djangoapps/bulk_email/","lms/djangoapps/bulk_enroll/","lms/djangoapps/bulk_user_retirement/","lms/djangoapps/ccx/","lms/djangoapps/certificates/","lms/djangoapps/commerce/"], |
There was a problem hiding this comment.
Please format this list with one item per line so that diffs will make more sense. (Also, "path" is an odd name for a list of paths?)
There was a problem hiding this comment.
current formatting is more readable since it shows which apps are being tested against cms or lms settings, in my opinion, this is easier to understand for developers not aware of the whole sharding strategy
we can change the formatting but we'd have to scroll to the end to see the config for each shard
There was a problem hiding this comment.
Sorry, I worded it poorly. I was suggesting it look like this:
{
"lms-1": {
"settings": "lms.envs.test",
"paths": [
"lms/djangoapps/badges/",
"lms/djangoapps/branding/",
"lms/djangoapps/bulk_email/",
"lms/djangoapps/bulk_enroll/",
..etc..
]
},
"lms-2": {
...
},
...
}
| sys.stdout.write(unit_test_paths) | ||
| modules = get_unit_test_modules("cms") if argument.cms_only else get_unit_test_modules("lms") | ||
| paths_output = ' '.join(modules) | ||
| sys.stdout.write(paths_output) |
There was a problem hiding this comment.
There's no reason to use sys.stdout.write. Just use print.
|
|
||
| unit_test_paths = ' '.join(modules) | ||
| sys.stdout.write(unit_test_paths) | ||
| modules = get_unit_test_modules("cms") if argument.cms_only else get_unit_test_modules("lms") |
There was a problem hiding this comment.
| modules = get_unit_test_modules("cms") if argument.cms_only else get_unit_test_modules("lms") | |
| modules = get_unit_test_modules("cms" if argument.cms_only else "lms") |
|
|
||
| def get_test_paths_for_shard(shard_name): | ||
| def load_unit_test_shards(shard_name): | ||
| unit_tests_json = f'{os.getcwd()}/.github/workflows/unit-test-shards.json' |
There was a problem hiding this comment.
There's no need to put getcwd into this path, the current directory is the default for opening files.
| def load_unit_test_shards(shard_name): | ||
| unit_tests_json = f'{os.getcwd()}/.github/workflows/unit-test-shards.json' | ||
| with open(unit_tests_json) as file: | ||
| unit_test_workflow_shards = json.loads(file.read()) |
There was a problem hiding this comment.
| unit_test_workflow_shards = json.loads(file.read()) | |
| unit_test_workflow_shards = json.load(file) |
| output = get_settings_for_shard(argument.shard_name) if argument.output == "settings" \ | ||
| else " ".join(get_test_paths_for_shard(argument.shard_name)) | ||
| sys.stdout.write(output) |
There was a problem hiding this comment.
Don't use an if expression if you have to split it across lines:
| output = get_settings_for_shard(argument.shard_name) if argument.output == "settings" \ | |
| else " ".join(get_test_paths_for_shard(argument.shard_name)) | |
| sys.stdout.write(output) | |
| if argument.output == "settings": | |
| print(get_settings_for_shard(argument.shard_name)) | |
| else: | |
| print(" ".join(get_test_paths_for_shard(argument.shard_name)) |
|
|
||
|
|
||
| def get_modules_except_cms(): | ||
| def get_unit_test_modules(module_name="lms"): |
There was a problem hiding this comment.
If you always call the function with an explicit argument, it's better to leave off the default.
b6cce2c to
4fa6cf8
Compare
4fa6cf8 to
ca08b63
Compare
|
I was first looking at this code because I had a PR failing because the test counts were wrong. I couldn't figure out how to fix things. Will you be adding some explanation about what to do if the check fails? |
6297ffd to
f4ecded
Compare
6b2ed1d to
504596c
Compare
504596c to
1b4d236
Compare
nedbat
left a comment
There was a problem hiding this comment.
One real question: how to decide where to add new apps?
319534a to
2aa13fd
Compare
226abee to
606d4ab
Compare
606d4ab to
4700a70
Compare
|
EdX Release Notice: This PR has been deployed to the staging environment in preparation for a release to production. |
|
EdX Release Notice: This PR has been deployed to the production environment. |
1 similar comment
|
EdX Release Notice: This PR has been deployed to the production environment. |
…enedx#29676) (cherry picked from commit 4e22a38)
…enedx#29676) (cherry picked from commit 4e22a38)
Previously some tests from openedx and common were running in both lms and cms test suite under Jenkins. But after shifting CI to GHA, those tests were running only with lms settings so now updated that run with both settings.
More details: BOM-3103