From 00dee343488232edb3e52dfb89b88705f945676e Mon Sep 17 00:00:00 2001 From: Frederick Date: Tue, 7 Jan 2025 09:19:38 -0700 Subject: [PATCH] Add user & password envvar tests (#43) There weren't any tests for `EDGEDB/GEL_USER/PASSWORD` environment variables. This adds a very basic test for each. --- README.md | 4 +- connection_testcases.json | 92 +++++++++++++++++++++++++++++++++++++++ tests/basic/env.jsonc | 56 ++++++++++++++++++++++++ 3 files changed, 150 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5a30509..49ca719 100644 --- a/README.md +++ b/README.md @@ -61,8 +61,8 @@ Environment variables present at the time of connecting. Possible values: | -------------------------- | --------------------------------------------------- | | `GEL_HOST` | same as `host` above | | `GEL_PORT` | same as `port` above | -| `EDGEDB_USER` | same as `user` above | -| `EDGEDB_PASSWORD` | same as `password` above | +| `GEL_USER` | same as `user` above | +| `GEL_PASSWORD` | same as `password` above | | `EDGEDB_SECRET_KEY` | same as `secretKey` above | | `EDGEDB_DATABASE` | same as `database` above | | `GEL_BRANCH` | same as `branch` above | diff --git a/connection_testcases.json b/connection_testcases.json index ca5f656..4e8da12 100644 --- a/connection_testcases.json +++ b/connection_testcases.json @@ -1,6 +1,98 @@ [ { " ": "/*** WARNING: do not edit this file. This is automatically rebuilt using tools/rebuild.ts ***/", + "env": { + "EDGEDB_PASSWORD": "secret", + "EDGEDB_PORT": "1234" + }, + "name": "basic_env_EDGEDB_PASSWORD is recognised", + "result": { + "address": [ + "localhost", + 1234 + ], + "branch": "__default__", + "database": "edgedb", + "password": "secret", + "secretKey": null, + "serverSettings": {}, + "tlsCAData": null, + "tlsSecurity": "strict", + "tlsServerName": null, + "user": "edgedb", + "waitUntilAvailable": "PT30S" + } + }, + { + "env": { + "EDGEDB_PORT": "1234", + "EDGEDB_USER": "testuser" + }, + "name": "basic_env_EDGEDB_USER is recognised", + "result": { + "address": [ + "localhost", + 1234 + ], + "branch": "__default__", + "database": "edgedb", + "password": null, + "secretKey": null, + "serverSettings": {}, + "tlsCAData": null, + "tlsSecurity": "strict", + "tlsServerName": null, + "user": "testuser", + "waitUntilAvailable": "PT30S" + } + }, + { + "env": { + "GEL_PASSWORD": "secret", + "GEL_PORT": "1234" + }, + "name": "basic_env_GEL_PASSWORD is recognised", + "result": { + "address": [ + "localhost", + 1234 + ], + "branch": "__default__", + "database": "edgedb", + "password": "secret", + "secretKey": null, + "serverSettings": {}, + "tlsCAData": null, + "tlsSecurity": "strict", + "tlsServerName": null, + "user": "edgedb", + "waitUntilAvailable": "PT30S" + } + }, + { + "env": { + "GEL_PORT": "1234", + "GEL_USER": "testuser" + }, + "name": "basic_env_GEL_USER is recognised", + "result": { + "address": [ + "localhost", + 1234 + ], + "branch": "__default__", + "database": "edgedb", + "password": null, + "secretKey": null, + "serverSettings": {}, + "tlsCAData": null, + "tlsSecurity": "strict", + "tlsServerName": null, + "user": "testuser", + "waitUntilAvailable": "PT30S" + } + }, + { "env": { "EDGEDB_PORT": "1234" }, diff --git a/tests/basic/env.jsonc b/tests/basic/env.jsonc index 66ee9ad..1ff8a68 100644 --- a/tests/basic/env.jsonc +++ b/tests/basic/env.jsonc @@ -11,6 +11,62 @@ ] } }, + { + "name": "EDGEDB_USER is recognised", + "env": { + "EDGEDB_PORT": "1234", + "EDGEDB_USER": "testuser" + }, + "result": { + "address": [ + "localhost", + 1234 + ], + "user": "testuser" + } + }, + { + "name": "GEL_USER is recognised", + "env": { + "GEL_PORT": "1234", + "GEL_USER": "testuser" + }, + "result": { + "address": [ + "localhost", + 1234 + ], + "user": "testuser" + } + }, + { + "name": "EDGEDB_PASSWORD is recognised", + "env": { + "EDGEDB_PORT": "1234", + "EDGEDB_PASSWORD": "secret" + }, + "result": { + "address": [ + "localhost", + 1234 + ], + "password": "secret" + } + }, + { + "name": "GEL_PASSWORD is recognised", + "env": { + "GEL_PORT": "1234", + "GEL_PASSWORD": "secret" + }, + "result": { + "address": [ + "localhost", + 1234 + ], + "password": "secret" + } + }, { "env": { "EDGEDB_DSN": "edgedb://user3:123123@localhost:5555/abcdef",