atomspace icon indicating copy to clipboard operation
atomspace copied to clipboard

Hardcoded postgresql configuration in VectorAPIUTest

Open mmmkkaaayy opened this issue 4 years ago • 3 comments

When I run unit tests with make -j8 test, all tests except 92/154 (VectorAPIUTest) pass.

The error at the top of the stack trace is:

Cannot connect to database: FATAL:  password authentication failed for user "opencog_tester"

I've traced it to this line of code

https://github.com/opencog/atomspace/blob/66177528e33b3ae6c3d46ebe6a5008fa12d87a58/tests/matrix/VectorAPIUTest.cxxtest#L175

When I modify it with the correct credentials, the test passes. Should this be trying to read creds from lib/atomspace-test.conf instead?

Note that there's another instance of this hardcoded creds later on in the file, but I didn't need to change that to get the test passing:

https://github.com/opencog/atomspace/blob/66177528e33b3ae6c3d46ebe6a5008fa12d87a58/tests/matrix/VectorAPIUTest.cxxtest#L451

Side question: How do I run a specific test instead of running all tests with make -j8 test?

mmmkkaaayy avatar Jun 24 '20 08:06 mmmkkaaayy

Should this be trying to read creds from lib/atomspace-test.conf instead?

Yes. And the easiest way to do that would be to add a fourth line:

TEST_DB_URL = "postgres:///opencog_test?user=opencog_tester&password=cheese"

Side question:

You can name tests individually, e.g. say ./tests/matrix/VectorAPIUTest from the build directory.

There are also four custom targets to run subsests of the unit tests make test_query, make test_python a few others (adding them to README now). There is no test-sql-only target, but I will add that now.

linas avatar Jun 24 '20 17:06 linas

Wouldn't it be better to use config.get() like the other sql tests? That way the dev doesn't have to do an extra step to get all tests passing.

mmmkkaaayy avatar Jun 25 '20 02:06 mmmkkaaayy

Yes, I meant config.get()

linas avatar Jun 25 '20 02:06 linas