FCO / Red

A WiP ORM for Raku
Artistic License 2.0
68 stars 27 forks source link

How to pass creds for mysql db to Red tests? #549

Closed melezhik closed 2 years ago

melezhik commented 2 years ago

Hi @FCO I am experimenting with SparkyCI and want to run Red tests against some test mysql database. Say I have all the credential provided by sparrow plugin - http://sparrowhub.io/plugin/sparkyci-service-mysql/0.000009 , how can I pass them to Red tests? (t/), what should be format of RED_DATABASE env var?

Thank you.

melezhik commented 2 years ago

Oh, looks like there is no MySQL support in Red, right ?

FCO commented 2 years ago

Hi! Yes, not yet, but working on it... but for passing connection details for the tests, you should create a env var called RED_DATABASE and the value will be the driver name and any parameter (name=value) separated by space, so, for example to connect to Postgres on 10.0.0.1 on port 9999, you could do:

RED_DATABASE="Pg host=10.0.0.1 port=9999" mi6 test

Not every test is using it though.

melezhik commented 2 years ago

Cool! What about user and password ?

FCO commented 2 years ago

The same way, this accepts any parameter the driver accepts, eg:

RED_DATABASE=“Pg host=bla.ble.com port=9999 user=FCO password=my-password dbname=my-db"

https://github.com/FCO/Red/blob/master/lib/Red/Driver/Pg.pm6#L22-L28

melezhik commented 2 years ago

Thanks