-
Notifications
You must be signed in to change notification settings - Fork 70
/
Copy pathcmd_test.go
44 lines (34 loc) · 1002 Bytes
/
cmd_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
33
34
35
36
37
38
39
40
41
42
43
44
package build
import (
"context"
"kitops/pkg/lib/constants"
"path/filepath"
"testing"
"github.com/stretchr/testify/assert"
)
func TestNewCmdBuild(t *testing.T) {
cmd := BuildCommand()
assert.NotNil(t, cmd)
assert.Equal(t, "build", cmd.Use)
assert.Equal(t, shortDesc, cmd.Short)
assert.Equal(t, longDesc, cmd.Long)
}
func TestBuildOptions_Complete(t *testing.T) {
options := &buildOptions{}
flags := &buildFlags{}
ctx := context.WithValue(context.Background(), constants.ConfigKey{}, "/home/user/.kitops")
args := []string{"arg1"}
err := options.complete(ctx, flags, args)
assert.NoError(t, err)
assert.Equal(t, args[0], options.contextDir)
assert.Equal(t, filepath.Join(args[0], constants.DefaultKitFileName), options.modelFile)
}
func TestBuildOptions_RunBuild(t *testing.T) {
t.Skip("Skipping test for now")
options := &buildOptions{
modelFile: "Kitfile",
contextDir: "/path/to/context",
}
err := RunBuild(context.Background(), options)
assert.NoError(t, err)
}