On Thu, Jul 25, 2019 at 12:34:13AM +0100, Howard Chu wrote:
Ondřej Kuzník wrote:
Historically, there has been a decent coverage in the test suite and that's what's being run before anyone pushes, but it's not been enough to capture some of the issues. It also takes ages to finish, and is very limited in what can be tested, mostly because we can only rely on POSIX shell and command line tools.
That means a lot of boilerplate (and since shell functions are not available, that boilerplate has to be copy-pasted everywhere)
We could always push common stuff into a script that gets sourced from the individual test scripts.
That would work some way to replace functions, fair point. But array variables are not available either AFAIK so even this is limited.
And it still doesn't give us a good way to test things like response controls.
and we can never actively do two things at the same time
Like what?
There have been times I could opt for an easier/more efficient/more readable test if I could use several connections simultaneously.
But these are currently impossible: - slapd-sock testing - refreshAndPersist (and as a result, more intelligent MMR convergence monitoring) - transaction interaction - one client starts it and another one comes in while it's not committed yet
let alone submit several operations over the same connection.
We can always write specific slapd-tester programs for whatever purpose arises.
That doesn't really scale. Testing SASL bind handling, e.g. transition between mechanisms, is one example where you just need to be able to send a few requests that you can craft.
There is no way we can get notified when things happen (servers have started up, all members think they're in sync, ...) so we have to rely on polling and manual delays which slows it down significantly, or introduces false positives on hosts where these delays are too short.
No matter what we use, polling is still needed.
There's polling and polling. If you can do an equivalent of select() on a file descriptor or a few, you can do orders of magnitude better than a sleep-ldapsearch cycle ever could.
And once it's possible to react to things as soon as they happen, we can have a global timeout in order of minutes, not seconds because we know it's only there to recover from a lockup.
The tests can't be run in parallel either, not from the same build environment.
All of the environment params are in overridable shell variables. We can have as many instances running as we want, but nobody has ever expressed a desire to run things in parallel before.
Not all of them, but that's not the point. It's ok if you want to test two different codebases, you just set SLAPD_BASEPORT and you're done.
For parallel tests you need a mktemp-like testrun directory and better (but unpredictable) listen port allocation. And I never bothered to complain/improve on this because it's so hard to write a decent test already.
An overhaul solves many other issues, so might as well add this as a requirement since it's cheap if you design for it.
None of the above can be resolved without a major overhaul.
I think you're overestimating the problem. AFAICS it wasn't even a "problem" until just now, nobody has ever mentioned this before.
All of the above have been a persistent problem for me whenever a new test needed to be written. But no point for me to ask for things that can't be done if we're explicitly targeting POSIX shell and nothing else.
If you want an example where this is a major issue, imagine testing the load balancer if the only tool you have is slapd. If only you could put slapd-sock into the mix and observe/interact through it you would get quite far but not even that's available.
I've been thinking about all of that for a while now and want to get started improving the situation.
If we switched to an actual programming language to write the tests in, something like Python 3, Golang or Rust,
Not golang, not rust. They don't have nearly enough platform coverage, nor actual maturity.
Sure, I prefer Python anyway, but if we had noone willing to do that, but a healthy number from another camp, I was willing to at least consider it.
Not many people understand how to do asyncio in Python yet that stuff is easy in Golang.
we could build a support library including a harness to manage slapd through,
Sounds like the library should be in C, which is then binary compatible with any other language you'd care to use.
I was thinking more along the lines of: - set up a new empty slapd - restart it - set up an n-way MMR and give me a list of servers I can talk to (this is popular among our regression tests already) - let me resume my test once a given replica/all servers are in sync