On 5/26/2020 10:36 PM, Robert Postill
wrote:
Inspired by the reply to
https://stackoverflow.com/questions/62014612/how-to-test-a-racket-package-self-sufficiently, I
decided to ask the question here. So a little background to
the discussion. I've been looking at a racket package, and
the package has a couple of collections. It's been dormant
for a few years, and so when I ran the tests they didn't work
(it's a driver, and the database it works with had moved on in
the intervening time). So I started thinking about the
tests. One thing that troubled me was that the tests seemed
to be dependant on the package already being installed.
Ryan Culpepper's comment on the stack
overflow question
(https://stackoverflow.com/a/62027185/11219) suggests that
the tests should be run once the package is under raco pkg's
management.
The problem is that any particular package may require a specific
runtime environment: e.g., many packages provide Racket interfaces
to 3rd party libraries. And those libraries have their own sets of
dependencies. And many libraries have compatibility problems with
others, so having many libraries available in a "generic" test
environment is not possible.
But even if the package host did maintain custom test environments
(VM or container or ...) for every contributed package - that STILL
does not guarantee that any given package will work on YOUR system,
with YOUR particular set of libraries.
You say the package that inspired this question used a database.
Which database? What version? There are dozens of DBMS available -
many are NOT $$$ free to own, and all of them have multiple versions
having various compatibility problems (i.e. what works with v8.2 may
not work with v10.4 - or the reverse). Many server class DBMS will
not peacefully co-exist with another on the same system, so then
you're talking about many virtual machines or containers (if the
DBMS in question even works in a container - some don't).
In the generally excellent docs for racket, I haven't
found advice relating to the right way to structure the
tests for a package.
Right. Because many packages interface to 3rd party software, and
so a lot of - so called - advice would, of necessity, be generic to
the point of being useless.
Now I think I should explain why I'm thinking that
way. FYI I've been a part of the ruby community, and so my
thinking has a ruby-ish colour. Which makes me think I'm maybe
off in my community norms for racket. I've always considered the
point at which a package gets transferred into the domain of
raco pkg's management to be a pivotal moment. It has this
implied social contract that if I'm mixing with code into a
system area managed by the language, the package needs to be
trustworthy.
If the Ruby maintainers told me that they were able to test every
contributed package in that package's expected runtime environment,
I simply would not believe them.
I wouldn't believe it if Google, or Apple, or Oracle, or Microsoft,
or Redhat, or Ubuntu said it either. Nobody can do it - the expense
is prohibitive.
Testing *after* installing seems
a bit like I'm putting the cart before the horse? It feels
like saying here's my code, put it in a system-wide place, I
hope it works.
I understand both the motivation and the frustration. For a long
time I developed embedded software under situations where I
controlled everything: the hardware, the OS (if there was one), my
application, the libraries it depended on, etc. I knew exactly the
conditions my software was expected to operate under, and and the
complete set of input it could possibly receive.
But 99+% of all software has to run under an uncertain environment
that, at best, is only partly know to its developer, depending (at
least transitively) on a lot of 3rd party software that the
developer often is completely unaware of.
YMMV,
George