forked from toolshed/abra
test: reduce duplication
This commit is contained in:
@ -3,10 +3,52 @@ package test
|
||||
import (
|
||||
"log"
|
||||
"os"
|
||||
"path"
|
||||
|
||||
appPkg "coopcloud.tech/abra/pkg/app"
|
||||
"coopcloud.tech/abra/pkg/envfile"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
var (
|
||||
TestFolder = os.ExpandEnv("$PWD/../../tests/resources/test_folder")
|
||||
ValidAbraConf = os.ExpandEnv("$PWD/../../tests/resources/valid_abra_config")
|
||||
)
|
||||
|
||||
// make sure these are in alphabetical order
|
||||
var (
|
||||
TFolders = []string{"folder1", "folder2"}
|
||||
TFiles = []string{"bar.env", "foo.env"}
|
||||
)
|
||||
|
||||
var (
|
||||
AppName = "ecloud"
|
||||
ServerName = "evil.corp"
|
||||
)
|
||||
|
||||
var ExpectedAppEnv = envfile.AppEnv{
|
||||
"DOMAIN": "ecloud.evil.corp",
|
||||
"RECIPE": "ecloud",
|
||||
}
|
||||
|
||||
var ExpectedApp = appPkg.App{
|
||||
Name: AppName,
|
||||
Recipe: ExpectedAppEnv["RECIPE"],
|
||||
Domain: ExpectedAppEnv["DOMAIN"],
|
||||
Env: ExpectedAppEnv,
|
||||
Path: ExpectedAppFile.Path,
|
||||
Server: ExpectedAppFile.Server,
|
||||
}
|
||||
|
||||
var ExpectedAppFile = appPkg.AppFile{
|
||||
Path: path.Join(ValidAbraConf, "servers", ServerName, AppName+".env"),
|
||||
Server: ServerName,
|
||||
}
|
||||
|
||||
var ExpectedAppFiles = map[string]appPkg.AppFile{
|
||||
AppName: ExpectedAppFile,
|
||||
}
|
||||
|
||||
// RmServerAppRecipe deletes the test server / app / recipe.
|
||||
func RmServerAppRecipe() {
|
||||
testAppLink := os.ExpandEnv("$HOME/.abra/servers/foo.com")
|
||||
|
Reference in New Issue
Block a user