-
Notifications
You must be signed in to change notification settings - Fork 7
/
service_test.go
32 lines (26 loc) · 995 Bytes
/
service_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package dev_test
import (
"github.com/google/go-cmp/cmp"
"github.com/spf13/afero"
"github.com/wish/dev"
"github.com/wish/dev/cmd"
"github.com/wish/dev/test"
"gotest.tools/v3/env"
"testing"
)
func TestCreateBuildableServiceList(t *testing.T) {
defer env.Patch(t, "DEV_CONFIG", "/home/test/.dev.yaml")()
defer env.Patch(t, "PATH", "/usr/bin:/usr/local/bin:/sbin")()
cmd.Reset()
cmd.AppConfig.SetFs(afero.NewMemMapFs())
test.CreateDockerComposeBinary(cmd.AppConfig.GetFs(), "/usr/local/bin")
test.CreateConfigFile(cmd.AppConfig.GetFs(), test.SmallCoConfig, "/home/test/.dev.yaml")
test.CreateConfigFile(cmd.AppConfig.GetFs(), test.AppCompose, "/home/test/db.docker-compose.yml")
cmd.Initialize()
proj := dev.NewProject(cmd.AppConfig.Projects["postgresql"])
got := dev.CreateBuildableServiceList(cmd.AppConfig, proj.Config)
want := []string{"app"}
if diff := cmp.Diff(want, got); diff != "" {
t.Errorf("CreateBuildableServiceList() mismatch (-want +got):\n%s", diff)
}
}