tests: online variants#5234
Open
pks-t wants to merge 12 commits into
Open
Conversation
Member
|
Yes! They're already there, in fact: https://dev.azure.com/libgit2/test/_git/empty and |
Member
Author
|
Oh, perfect, thanks for letting me know, in that case I'll make use of them. Will have to find out why there is a new memory leak in libssh2 now that even exists if the SSH tests aren't executed at all. Will do after I've polished up the other PRs. |
aeda027 to
1412769
Compare
Member
Author
|
There was one real memory leak on macOS which I've fixed. The other leaks already exist in master, no idea why I uncovered them just now :/ |
Member
Author
|
Well, they do exist on master now, too. Meh. Will fix... https://dev.azure.com/libgit2/libgit2/_build/results?buildId=2664 |
eff7a20 to
d549369
Compare
Member
Author
|
Rebased on top of #5240. Added "test" and "empty" repos to the Azure variant |
c5b197f to
f1665a5
Compare
On reading from an HTTP stream, when the server has closed a keepalive socket or when receiving a 401 Unauthorized error, we try to re-connect the HTTP stream in order to replay the authentication. When failing to reconnect, we exit directly from the function and thus fail to cleanup the request buffer. Fix the memory leak by using `goto done` instead.
When trying to allocate the username that is required to ask for SSH authentification methods, we check the return value of `git__strdup` but will not set up a proper error code. Because of this, `_git_ssh_setup_conn` may return successfully while there was in fact an out of memory error. Fix the issue by calling `git_error_set_oom` and setting the error code to `-1`.
When creating the reflog message "clone: from %s", we do not check the call to `git_buf_printf` for an error. As we use `git_buf_cstr` immediately afterwards, we may thus try to use the `git_buf_oom` buffer without noticing. While this is unproblematic due to the buffer containing a single NUL byte, only, we should certainly notice out-of-memory situations early. Fix this by checking the return value of `git_buf_printf`.
In order to be able to verify that SSH authentication with user and password works correctly, we need to first set up a password and make it available via the GITTEST_REMOTE_PASS environment variable.
The test suite online::clone::env will by default refuse any certificates presented by the remote configured via environment variables. In order for the tests to succeed with our instance of sshd, we should either make the expected host key available via the environment or alternatively just override it by setting GITTEST_REMOTE_SSL_NOVERIFY. This commit goes the easier way of just overriding the check, as the point of the whole series is to first get the online::clone test suite into a state where it's much easier to improve it at a later point in time.
The libssh2 library may leak memory when performing the session handshake in various edge cases, like e.g. timeouts. As there is multiple memleaks that may happen, depending on when the exact failure happens inside of libssh2_session_handshake, we shouldn't specify a detailed stack of which memleaks to suppress, but just suppress all that happen with `libssh2_session_handshake`.
The clone::nonetwork test suite still has a define for a GitHub repository URL, which naturally is not tested in the no-network test suite anymore. Remove it.
Modernize coding style of the clone test suite. Most importantly, we introduce defines for each of the repo URLS and consistently rely on the cleanup function to remove the sandbox repository for us.
The test suite online::clone is quite huge and hard to grasp. It intermingles tests for HTTP and SSH-based clones as well as the ones that make use of a server defined via environment variables. Split these all up into different tests to make the suites more focused as well as easier to understand. Furthermore, this will allow us to introduce variants for our HTTP tests to more thoroughly test against different external hosting services.
Right now, we only run each clone test against a single Git provider, making it hard to understand which features are tested against which provide. Furthermore, more intricate behaviour like e.g. authentication is thus not thoroughly tested against the different implementations, which may differ slightly across hosters. Introduce test variants to start fixing this. For each provider, we will initialize an optional set of URLs to test against where each URL aims to exercise some specific behaviour. For now, we implement tests against GitHub, Bitbucket, Azure and GitLab. Tests against GitLab and Azure are completely new. The variants also uncovered behavioural inconsistencies in how Bitbucket handles nonexistent repositories: instead of trying to authenticate, it will directly return a 404 status code and thus reveal that no such repo exists, not even in private. We thus special-case this behaviour in our test suite.
f1665a5 to
e980cf5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
My initial goal has been to clean up our online tests a bit, because I had quite some problems to grasp everything that's going on with environment variables etc. While splitting up the tests I realized that it's quite easy to use our new clar variants for online::clone::http, so I've implemented them.
Due to this we now have additional tests with GitLab (I manage the libgit2 group in GitLab and thus added the required repos). I'd love to test against Azure more thoroughly as well, but I'll have to defer to @ethomson for this. Could you maybe push our libgit2/testgitrepository and libgit2/testemptyproject repos to Azure so that we can add these as variants?