From d9803726ebe9434d0635f3c0b63cdd349f80e7d9 Mon Sep 17 00:00:00 2001 From: Frederick Date: Thu, 16 Jan 2025 12:21:53 -0700 Subject: [PATCH] Add more tests with gel_and_edgedb warnings (#47) --- connection_testcases.json | 109 ++++++++++++++++++++++++++++++++++++- tests/basic/env.jsonc | 66 ++++++++++++++++++++++ tests/override/other.jsonc | 5 +- 3 files changed, 178 insertions(+), 2 deletions(-) diff --git a/connection_testcases.json b/connection_testcases.json index 1ece712..889b205 100644 --- a/connection_testcases.json +++ b/connection_testcases.json @@ -46,6 +46,56 @@ "waitUntilAvailable": "PT30S" } }, + { + "env": { + "EDGEDB_PORT": "12345", + "GEL_HOST": "test.local" + }, + "name": "basic_env_GEL_HOST is respected", + "result": { + "address": [ + "test.local", + 12345 + ], + "branch": "__default__", + "database": "edgedb", + "password": null, + "secretKey": null, + "serverSettings": {}, + "tlsCAData": null, + "tlsSecurity": "strict", + "tlsServerName": null, + "user": "edgedb", + "waitUntilAvailable": "PT30S" + } + }, + { + "env": { + "EDGEDB_HOST": "test.local1", + "GEL_HOST": "test.local", + "GEL_PORT": "12345" + }, + "name": "basic_env_GEL_HOST is used instead of EDGEDB_HOST", + "result": { + "address": [ + "test.local", + 12345 + ], + "branch": "__default__", + "database": "edgedb", + "password": null, + "secretKey": null, + "serverSettings": {}, + "tlsCAData": null, + "tlsSecurity": "strict", + "tlsServerName": null, + "user": "edgedb", + "waitUntilAvailable": "PT30S" + }, + "warnings": [ + "gel_and_edgedb" + ] + }, { "env": { "GEL_PASSWORD": "secret", @@ -69,6 +119,33 @@ "waitUntilAvailable": "PT30S" } }, + { + "env": { + "EDGEDB_PASSWORD": "secret2", + "GEL_PASSWORD": "secret", + "GEL_PORT": "1234" + }, + "name": "basic_env_GEL_PASSWORD is used instead of EDGEDB_PASSWORD", + "result": { + "address": [ + "localhost", + 1234 + ], + "branch": "__default__", + "database": "edgedb", + "password": "secret", + "secretKey": null, + "serverSettings": {}, + "tlsCAData": null, + "tlsSecurity": "strict", + "tlsServerName": null, + "user": "edgedb", + "waitUntilAvailable": "PT30S" + }, + "warnings": [ + "gel_and_edgedb" + ] + }, { "env": { "GEL_PORT": "1234", @@ -92,6 +169,33 @@ "waitUntilAvailable": "PT30S" } }, + { + "env": { + "EDGEDB_USER": "testuser2", + "GEL_PORT": "1234", + "GEL_USER": "testuser" + }, + "name": "basic_env_GEL_USER is used instead of EDGEDB_USER", + "result": { + "address": [ + "localhost", + 1234 + ], + "branch": "__default__", + "database": "edgedb", + "password": null, + "secretKey": null, + "serverSettings": {}, + "tlsCAData": null, + "tlsSecurity": "strict", + "tlsServerName": null, + "user": "testuser", + "waitUntilAvailable": "PT30S" + }, + "warnings": [ + "gel_and_edgedb" + ] + }, { "env": { "EDGEDB_PORT": "1234" @@ -3759,7 +3863,10 @@ "tlsServerName": null, "user": "edgedb", "waitUntilAvailable": "PT30S" - } + }, + "warnings": [ + "gel_and_edgedb" + ] }, { "fs": { diff --git a/tests/basic/env.jsonc b/tests/basic/env.jsonc index 23decbe..317fca6 100644 --- a/tests/basic/env.jsonc +++ b/tests/basic/env.jsonc @@ -39,6 +39,24 @@ "user": "testuser" } }, + { + "name": "GEL_USER is used instead of EDGEDB_USER", + "env": { + "GEL_PORT": "1234", + "GEL_USER": "testuser", + "EDGEDB_USER": "testuser2" + }, + "result": { + "address": [ + "localhost", + 1234 + ], + "user": "testuser" + }, + "warnings": [ + "gel_and_edgedb" + ] + }, { "name": "EDGEDB_PASSWORD is recognised", "env": { @@ -67,6 +85,24 @@ "password": "secret" } }, + { + "name": "GEL_PASSWORD is used instead of EDGEDB_PASSWORD", + "env": { + "GEL_PORT": "1234", + "GEL_PASSWORD": "secret", + "EDGEDB_PASSWORD": "secret2" + }, + "result": { + "address": [ + "localhost", + 1234 + ], + "password": "secret" + }, + "warnings": [ + "gel_and_edgedb" + ] + }, { "env": { "EDGEDB_DSN": "edgedb://user3:123123@localhost:5555/abcdef", @@ -120,6 +156,36 @@ ] } }, + { + "env": { + "GEL_HOST": "test.local", + "EDGEDB_PORT": "12345" + }, + "name": "GEL_HOST is respected", + "result": { + "address": [ + "test.local", + 12345 + ] + } + }, + { + "env": { + "GEL_HOST": "test.local", + "EDGEDB_HOST": "test.local1", + "GEL_PORT": "12345" + }, + "name": "GEL_HOST is used instead of EDGEDB_HOST", + "result": { + "address": [ + "test.local", + 12345 + ] + }, + "warnings": [ + "gel_and_edgedb" + ] + }, { "env": { "EDGEDB_DATABASE": "test_db", diff --git a/tests/override/other.jsonc b/tests/override/other.jsonc index 3afb630..493a296 100644 --- a/tests/override/other.jsonc +++ b/tests/override/other.jsonc @@ -676,7 +676,10 @@ 5656 ], "secretKey": "nbwt_eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJlZGdlZGIuc2VydmVyLmFueV9yb2xlIjp0cnVlLCJpYXQiOjE2NjkzMTE3NjMsImlzcyI6ImxvY2FsLTEuaW50ZXJuYWwiLCJuZWJ1bGEuc2NvcGVzIjpbImFkbWluIl0sIm5lYnVsYS51c2VyX2lkIjoiM2U3ODU4YTgtNmJjNy0xMWVkLWFmNTAtMTdiMzkzMjlmZmEyIn0.9cS6-rR00fgmEmGu423IP3snJvmXe7ZGol7ZlYuHBNqmKGrWtTsMZPj-3C7dmureUmk3ZUttxioouPeAreKueg" - } + }, + "warnings": [ + "gel_and_edgedb" + ] }, { "env": {