zpm-project / zpm-zsh

zsh plugin manager in ansi C.
GNU General Public License v3.0
5 stars 3 forks source link

Tests performance: review network access #9

Open desyncr opened 7 years ago

desyncr commented 7 years ago

Currently our test suite does real network access. This make test run extra slow and make them unavailable working offline.

The idea is to create some git repositories at run-time and accessing them, now that zpm supports local repositories.

TODO

fennecdjay commented 7 years ago

would'nt that mean running a local git server?

desyncr commented 7 years ago

No need for that. git doesn't need a server for it (unlike, subversion). Just a couple of commands away:

$ /tmp git init test-repo
Initialized empty Git repository in /private/tmp/test-repo/.git/

Then in /tmp/test-repo you can perform all git commands you need, clone, commit.

fennecdjay commented 7 years ago

very nice! Thanks for the tip.

fennecdjay commented 7 years ago

so it just needs to had a .sh file with a hello_world function in it, then test the function?

desyncr commented 7 years ago

Yeah, exactly, as we're not testing the plugins themselves, but how zpm handles the cloning, listing, removal and so forth. We'll need to have at least two of them, in order to test properly.

desyncr commented 7 years ago

If we need in the future we may have specific test repositories to test special cases, such as what happens if the plugin as no ".sh", for example.

fennecdjay commented 7 years ago

Yes. Shouldn't we also test wether plugins contains _xxx file, or even file with #compdef xxx for shebang?


that would probably mean reworking the plugin_entry function:

fennecdjay commented 7 years ago

two more question:

-  What's the way to test completions?
-  Should'nt we use zpm directory to test both binary install and completion(once we have the ompletion file working.)?
desyncr commented 7 years ago

I haven't tested completions ever. So there is a room for investigation. Maybe looking at https://github.com/zsh-users/zsh-autosuggestions would give us a clue.

desyncr commented 7 years ago

Yes. Shouldn't we also test wether plugins contains _xxx file, or even file with #compdef xxx for shebang?

Yeah, those are great ideas. Should target v1.0.0.

fennecdjay commented 7 years ago

I use zpm self install feature, which puts zpm in the PATH, along with a small (and full of sxxx) _zpm completion file, and it works well. To me, the question remains: how do we test it programmtically?


We should probably use gist to share _zpm file while working on it, like we did for .travis.yml

desyncr commented 7 years ago

A working _zpm is better than nothing. So please go ahead and create a PR.

desyncr commented 7 years ago

I'm working on test's performance.