Roundup Tracker - Issues

Message8148

Author schlatterbeck
Recipients rouilj, schlatterbeck
Date 2024-10-21.16:03:19
Message-id <20241021160309.viyp6aej3xlo3xtl@runtux.com>
In-reply-to <20241021150630.F3E3B6A01A3@pe15.cs.umb.edu>
On Mon, Oct 21, 2024 at 11:06:30AM -0400, John P. Rouillard wrote:

> In message <1729520555.54.0.52150611584.issue2551366@roundup.psfhosted.org>,
> Ralf Schlatterbeck writes:
> >The README in the test directory doesn't contain any hints on what
> >is needed to run the tests:
> >- What database users do we need
> >- What passwords can we use
> >- Can we override the default config
> >
> >I think the tests should either honor settings in the environment or
> >have a small (optional, not checked into a version control system) config
> >file.
> 
> See docs/developer.txt - Testing Notes. It goes over the setup for
> developers. live-server tests need the requests package. If you don't
> have it the test are (supposed to be) skipped.

Thanks, that has some info. But it's missing the database users needed
etc for running the tests. This info probably *should* go into the
developers.txt in the Testing Notes section. And a pointer to this
should be in the README in the test directory.
[ah it's in the database docs]

I do have the requests package. I happen to run an uwsgi daemon on the
hard-coded port 9001. The port should be made configurable in the tests.
But I'll probably move my uwsgi somewhere else for now. Maybe we should
at least skip the tests if the port isn't free.

FAILED test/test_liveserver.py::BaseTestCases::test__generic_item_template_editok - OSError: Ports 9001-9001 are all already in use
[repeated for all tests in test_liveserver]

> Also there are notes in the mysql.txt and postgresql.txt.  Maybe
> developer/testing notes in the database docs should be moved to
> developers.txt? At least there should be links (currently missing)
> from developer.txt to the test sections in the db docs.

Yes links would be fine. And the sections should all be named the same.

> >The test *used to* honor the settings RDBMS_USER and RDBMS_PASSWORD
> >in the environment. They no longer seem to do this. Note that having
> >the password in an environment variable constitutes a security
> >risk. But it is still much better than requiring a hard-coded
> >password in the source.
> 
> Hmm, I never saw/knew that the environment vars were used by the
> tests.  I wonder if that changed as part of the patches to use
> postgres schemas as well as just a database.

Yes, that's possible. It was a long time ago and probably not the best
solution.

> I am a little worried that testing with environment variables that
> look like they could be production variables will result in problems
> as the tests nuke databases.

Good point. My preferred solution would be an optional config-file in
the test directory. With appropriate warnings in the README and the docs
sections.

Is there a technical reason why we need two test users in postgres
currently?

> See "Running the PostgreSQL unit tests" in ../../doc/postgresql.txt

Yes, found it now...

> Are they failing, or are they skipped? I thought I set them up to be
> skipped if the schema user/password failed.

They fail. They are skipped when I don't have any of the postgres users.
I *do* have the first postgres user but not the second one.

Something like:
E       psycopg2.OperationalError: connection to server at "localhost" (127.0.0.1), port 5432 failed: FATAL:  password authentication failed for user "rounduptest_schema"
E       connection to server at "localhost" (127.0.0.1), port 5432 failed: FATAL:  password authentication failed for user "rounduptest_schema"

> References to these docs in a test/README.txt is a good idea.
Yes, and a short summary in the README.

Thanks!
Ralf
-- 
Dr. Ralf Schlatterbeck                  Tel:   +43/2243/26465-16
Open Source Consulting                  www:   www.runtux.com
Reichergasse 131, A-3411 Weidling       email: office@runtux.com
History
Date User Action Args
2024-10-21 16:03:19schlatterbecksetrecipients: + schlatterbeck, rouilj
2024-10-21 16:03:19schlatterbecklinkissue2551366 messages
2024-10-21 16:03:19schlatterbeckcreate