test: fix test failure in case of different default branch#6857
Conversation
|
Hi @amritghimire ! Nice catch! Btw, would it make sense to maybe patch/reset global config before running all of our tests? Or could there be some important config options that might be required to run our tests? Just worried that someone will introduce a new test and will not know to put |
@efiop , most of the test cases has used But yes, as you mentioned, it would be good to patch or reset the global config itself. I will look into it. |
|
@efiop I have introduced config change in global for |
|
Switch to |
|
@amritghimire ping. Let us know if you are available, we can take over this PR otherwise. 🙂 |
|
I ran into a few issues with the isolation, need to investigate. Most likely this is an issue with our tests how some of the tests don't use FAILED tests/func/test_ls.py::test_ls_remote_git_only_repo_recursive - dvc.config.ConfigError: config file error: expected 'url' for dictionary value @ data['remot...
FAILED tests/func/test_ls.py::test_subrepo[False-git_dir] - dvc.config.ConfigError: config file error: expected 'url' for dictionary value @ data['remote']['minio']
FAILED tests/unit/command/test_add.py::test_add_to_remote - dvc.config.ConfigError: config file error: expected 'url' for dictionary value @ data['remote']['minio']
FAILED tests/unit/command/test_add.py::test_add_to_remote_invalid_combinations - dvc.config.ConfigError: config file error: expected 'url' for dictionary value @ d...
FAILED tests/unit/command/test_add.py::test_add_to_cache_invalid_combinations - dvc.config.ConfigError: config file error: expected 'url' for dictionary value @ da...
FAILED tests/unit/command/test_data_sync.py::test_pull - dvc.config.ConfigError: config file error: expected 'url' for dictionary value @ data['remote']['minio']
FAILED tests/unit/command/test_data_sync.py::test_push - dvc.config.ConfigError: config file error: expected 'url' for dictionary value @ data['remote']['minio']
FAILED tests/unit/command/test_diff.py::test_default - dvc.config.ConfigError: config file error: expected 'url' for dictionary value @ data['remote']['minio']
FAILED tests/unit/command/test_diff.py::test_show_hash - dvc.config.ConfigError: config file error: expected 'url' for dictionary value @ data['remote']['minio']
FAILED tests/unit/command/test_diff.py::test_show_json - dvc.config.ConfigError: config file error: expected 'url' for dictionary value @ data['remote']['minio']
FAILED tests/unit/command/test_diff.py::test_show_json_and_hash - dvc.config.ConfigError: config file error: expected 'url' for dictionary value @ data['remote']['...
FAILED tests/unit/command/test_diff.py::test_show_json_hide_missing - dvc.config.ConfigError: config file error: expected 'url' for dictionary value @ data['remote...
FAILED tests/unit/command/test_diff.py::test_diff_show_markdown_and_hash[None] - dvc.config.ConfigError: config file error: expected 'url' for dictionary value @ d...
FAILED tests/unit/command/test_diff.py::test_diff_show_markdown_and_hash[True] - dvc.config.ConfigError: config file error: expected 'url' for dictionary value @ d...
FAILED tests/unit/command/test_diff.py::test_diff_show_markdown_and_hash[False] - dvc.config.ConfigError: config file error: expected 'url' for dictionary value @ ...
FAILED tests/unit/command/test_diff.py::test_no_changes - dvc.config.ConfigError: config file error: expected 'url' for dictionary value @ data['remote']['minio']
FAILED tests/unit/command/test_diff.py::test_hide_missing - dvc.config.ConfigError: config file error: expected 'url' for dictionary value @ data['remote']['minio']
FAILED tests/unit/command/test_experiments.py::test_experiments_diff_revs - dvc.config.ConfigError: config file error: expected 'url' for dictionary value @ data['...
FAILED tests/unit/command/test_data_sync.py::test_fetch - dvc.config.ConfigError: config file error: expected 'url' for dictionary value @ data['remote']['minio']
FAILED tests/unit/command/test_imp.py::test_import - dvc.config.ConfigError: config file error: expected 'url' for dictionary value @ data['remote']['minio']
FAILED tests/unit/command/test_imp.py::test_import_no_exec - dvc.config.ConfigError: config file error: expected 'url' for dictionary value @ data['remote']['minio']
FAILED tests/unit/command/test_imp_url.py::test_import_url - dvc.config.ConfigError: config file error: expected 'url' for dictionary value @ data['remote']['minio']
FAILED tests/unit/command/test_imp_url.py::test_failed_import_url - dvc.config.ConfigError: config file error: expected 'url' for dictionary value @ data['remote']...
FAILED tests/unit/command/test_imp_url.py::test_import_url_no_exec - dvc.config.ConfigError: config file error: expected 'url' for dictionary value @ data['remote'...
FAILED tests/unit/command/test_imp_url.py::test_import_url_to_remote - dvc.config.ConfigError: config file error: expected 'url' for dictionary value @ data['remot...
FAILED tests/unit/command/test_imp_url.py::test_import_url_to_remote_invalid_combination - dvc.config.ConfigError: config file error: expected 'url' for dictionary...So, I have some global dvc configs, and it's causing it to fail somehow, which it should not have been able to see. It worked fine before. |
|
@skshetry Can you check if the config file use absolute path for config or something to fetch the global dvc config? |
|
For the record, I have taken over this PR. Thanks @amritghimire, we'll take it from here. 🙂 |
|
For the record, we may just end up isolating git for the first part as done in https://github.com/iterative/scmrepo/blob/9dcd9061cf5e529ebddca5ff9056d26fae1372f6/tests/conftest.py#L37-L62 stolen from this PR. Isolating |
When the git config has set global `init.defaultBranch` different than master, a few test cases were failing. Currently, the test case is assuming the default branch to be set as master. This commit will introduce **initial_branch** option to git init call which will ensure *master* branch is used as default for out test cases. Set default git branch to main for test CI Since main is going to be new default branch, it will let the test case handle the scenario where default branch is set other than master. Introduce isolation for git configuration
|
@dtrifiro, did this fix the issue that you were having? |
|
Merging this, thanks @amritghimire. Note that this only provides isolation for git, DVC's own global/system configs are not isolated yet. :) |
|
@amritghimire @skshetry thank you guys, outstanding work! 🔥 |
When the git config has set global
init.defaultBranchdifferent than master,a few test cases were failing.
Currently, the test case is assuming the default branch to be set as
master.
This commit will introduce initial_branch option to git init call
which will ensure master branch is used as default for out test cases.
❗ I have followed the Contributing to DVC checklist.
📖 If this PR requires documentation updates, I have created a separate PR (or issue, at least) in dvc.org and linked it here.
Fixes #6043.
Thank you for the contribution - we'll try to review it as soon as possible. 🙏