-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathcompose_test.go
More file actions
46 lines (40 loc) · 1.07 KB
/
compose_test.go
File metadata and controls
46 lines (40 loc) · 1.07 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package command
import (
"bytes"
"os"
"testing"
"github.com/DefangLabs/defang/src/pkg/cli"
cliClient "github.com/DefangLabs/defang/src/pkg/cli/client"
"github.com/DefangLabs/defang/src/pkg/term"
defangv1 "github.com/DefangLabs/defang/src/protos/io/defang/v1"
)
func TestInitializeTailCmd(t *testing.T) {
t.Run("", func(t *testing.T) {
for _, cmd := range RootCmd.Commands() {
if cmd.Use == "logs" {
cmd.Execute()
return
}
}
})
}
func TestPrintPlaygroundPortalServiceURLs(t *testing.T) {
defaultTerm := term.DefaultTerm
t.Cleanup(func() {
term.DefaultTerm = defaultTerm
})
var stdout, stderr bytes.Buffer
term.DefaultTerm = term.NewTerm(os.Stdin, &stdout, &stderr)
providerID = cliClient.ProviderDefang
cluster = cli.DefaultCluster
printPlaygroundPortalServiceURLs([]*defangv1.ServiceInfo{
{
Service: &defangv1.Service{Name: "service1"},
}})
const want = ` * Monitor your services' status in the defang portal
- https://portal.defang.io/service/service1
`
if got := stdout.String(); got != want {
t.Errorf("got %q, want %q", got, want)
}
}