forked from toolshed/abra
test: fix imports
This commit is contained in:
@ -3,17 +3,59 @@ package app_test
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
"path"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
appPkg "coopcloud.tech/abra/pkg/app"
|
||||
"coopcloud.tech/abra/pkg/config"
|
||||
"coopcloud.tech/abra/pkg/envfile"
|
||||
"coopcloud.tech/abra/pkg/recipe"
|
||||
"github.com/docker/docker/api/types/filters"
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
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,
|
||||
}
|
||||
|
||||
func TestNewApp(t *testing.T) {
|
||||
app, err := appPkg.NewApp(ExpectedAppEnv, AppName, ExpectedAppFile)
|
||||
if err != nil {
|
||||
@ -83,7 +125,7 @@ func TestGetComposeFiles(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
composeFiles, err := appPkg.GetComposeFiles(r.Name, test.appEnv)
|
||||
composeFiles, err := recipe.GetComposeFiles(r.Name, test.appEnv)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@ -104,7 +146,7 @@ func TestGetComposeFilesError(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
_, err := appPkg.GetComposeFiles(r.Name, test.appEnv)
|
||||
_, err := recipe.GetComposeFiles(r.Name, test.appEnv)
|
||||
if err == nil {
|
||||
t.Fatalf("should have failed: %v", test.appEnv)
|
||||
}
|
||||
@ -118,7 +160,7 @@ func TestFilters(t *testing.T) {
|
||||
config.RECIPES_DIR = oldDir
|
||||
}()
|
||||
|
||||
app, err := appPkg.NewApp(appPkg.AppEnv{
|
||||
app, err := appPkg.NewApp(envfile.AppEnv{
|
||||
"DOMAIN": "test.example.com",
|
||||
"RECIPE": "test-recipe",
|
||||
}, "test_example_com", appPkg.AppFile{
|
||||
|
Reference in New Issue
Block a user