fix: rename config -> env and handle env interface better

This commit is contained in:
Lakhan Samani
2022-01-20 16:52:37 +05:30
parent 7785f98dcd
commit 38419a4ef4
60 changed files with 668 additions and 610 deletions

View File

@@ -15,19 +15,19 @@ func TestResolvers(t *testing.T) {
// constants.DbTypeArangodb: "http://localhost:8529",
// constants.DbTypeMongodb: "mongodb://localhost:27017",
}
envstore.EnvInMemoryStoreObj.UpdateEnvVariable(constants.EnvKeyVersion, "test")
envstore.EnvInMemoryStoreObj.UpdateEnvVariable(constants.StringStoreIdentifier, constants.EnvKeyVersion, "test")
for dbType, dbURL := range databases {
envstore.EnvInMemoryStoreObj.UpdateEnvVariable(constants.EnvKeyDatabaseURL, dbURL)
envstore.EnvInMemoryStoreObj.UpdateEnvVariable(constants.EnvKeyDatabaseType, dbType)
envstore.EnvInMemoryStoreObj.UpdateEnvVariable(constants.StringStoreIdentifier, constants.EnvKeyDatabaseURL, dbURL)
envstore.EnvInMemoryStoreObj.UpdateEnvVariable(constants.StringStoreIdentifier, constants.EnvKeyDatabaseType, dbType)
env.InitEnv()
db.InitDB()
// clean the persisted config for test to use fresh config
config, err := db.Mgr.GetConfig()
envData, err := db.Mgr.GetEnv()
if err == nil {
config.Config = []byte{}
db.Mgr.UpdateConfig(config)
envData.EnvData = []byte{}
db.Mgr.UpdateEnv(envData)
}
env.PersistEnv()
@@ -44,8 +44,8 @@ func TestResolvers(t *testing.T) {
adminLoginTests(t, s)
adminLogoutTests(t, s)
adminSessionTests(t, s)
updateConfigTests(t, s)
configTests(t, s)
updateEnvTests(t, s)
envTests(t, s)
// user tests
loginTests(t, s)