Skip to content

Commit

Permalink
Add user & password envvar tests (#43)
Browse files Browse the repository at this point in the history
There weren't any tests for `EDGEDB/GEL_USER/PASSWORD` environment
variables. This adds a very basic test for each.
  • Loading branch information
fmoor authored Jan 7, 2025
1 parent eb8b4d9 commit 00dee34
Show file tree
Hide file tree
Showing 3 changed files with 150 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
92 changes: 92 additions & 0 deletions connection_testcases.json
Original file line number Diff line number Diff line change
@@ -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"
},
Expand Down
56 changes: 56 additions & 0 deletions tests/basic/env.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 00dee34

Please sign in to comment.