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

Improve testing with plugin repositories #1512

Open
acidghost opened this issue Mar 24, 2023 · 2 comments
Open

Improve testing with plugin repositories #1512

acidghost opened this issue Mar 24, 2023 · 2 comments

Comments

@acidghost
Copy link
Contributor

Is your feature request related to a problem? Please describe

As mentioned in #1507 some features need actually remote repositories for their tests to be complete.

This example only tests for repo "remote" URL that is a local folder, doesn't test other forms of URLs (http, ssh):

asdf/test/asdf_nu.bats

Lines 102 to 115 in 05a8bb9

@test "parses the output of asdf plugin list --urls" {
setup_repo
install_mock_plugin_repo "dummy"
asdf plugin add "dummy" "${BASE_DIR}/repo-dummy"
run_nushell "asdf plugin list --urls | to csv -n"
[ "$status" -eq 0 ]
local repo_url
repo_url=$(get_plugin_remote_url "dummy")
[ "$output" = "dummy,$repo_url" ]
}

A similar thing also happens here:

asdf/test/asdf_nu.bats

Lines 150 to 160 in 05a8bb9

@test "parses the output of asdf plugin list all" {
setup_repo
install_dummy_plugin
run_nushell "asdf plugin list all | to csv -n"
[ "$status" -eq 0 ]
[ "$output" = "\
bar,false,http://example.com/bar
dummy,true,http://example.com/dummy
foo,false,http://example.com/foo" ]
}

Describe the proposed solution

One solution would be to have dummy remote repositories that are cloned in different ways.
ATM the dummy repository is exclusively cloned from a local directory.

Another solution is to manually add a fake "remote origin" (e.g. git remote remove origin && git remote add origin http://example.com); branch and ref can be faked as they are now.

Describe similar asdf features and why they are not sufficient

n/a

Describe other workarounds you've considered

n/a

@jthegedus
Copy link
Contributor

Is this what you mean when you say "fake remote origin"?

git --git-dir "$ASDF_DIR/.git" remote add origin https://github.com/asdf-vm/asdf.git

@acidghost
Copy link
Contributor Author

Yes, precisely! This would enable testing different URL formats in the first example I provided.

For the second one example I think the only way is to add more plugins (with different URL formats) to the dummy_plugins_repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants