...
1 package cmd
2
3 import (
4 "fmt"
5 "os"
6 "testing"
7
8 "gotest.tools/v3/icmd"
9
10 "edge-infra.dev/pkg/f8n/warehouse/lift/cmd/internal/lifttest"
11 "edge-infra.dev/pkg/lib/build/bazel"
12 )
13
14 func TestBinary(t *testing.T) {
15 dir, err := bazel.NewTestTmpDir("lift-test")
16 if err != nil {
17 t.Fatal(err)
18 }
19 defer os.RemoveAll(dir)
20 lifttest.Setup(t, dir)
21 path, err := lifttest.CreateLiftBinary()
22 if err != nil {
23 t.Fatal(err)
24 }
25 result := icmd.RunCommand(path)
26 fmt.Println(result.String())
27 icmd.RunCommand(path).Assert(t, icmd.Success)
28 }
29
30 func TestBinaryWithFixtures(t *testing.T) {
31 dir, err := bazel.NewTestTmpDir("lift-test")
32 if err != nil {
33 t.Fatal(err)
34 }
35 defer os.RemoveAll(dir)
36 lifttest.Setup(t, dir, lifttest.WithFixtures())
37 path, err := lifttest.CreateLiftBinary()
38 if err != nil {
39 t.Fatal(err)
40 }
41 icmd.RunCommand(path).Assert(t, icmd.Success)
42 }
43
View as plain text