-
Notifications
You must be signed in to change notification settings - Fork 287
/
executables.go
59 lines (47 loc) · 1.38 KB
/
executables.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package framework
import (
"context"
"testing"
"github.com/aws/eks-anywhere/pkg/executables"
"github.com/aws/eks-anywhere/pkg/filewriter"
)
func buildKubectl(t *testing.T) *executables.Kubectl {
ctx := context.Background()
kubectl := executableBuilder(t, ctx).BuildKubectlExecutable()
return kubectl
}
func buildLocalKubectl() *executables.Kubectl {
return executables.NewLocalExecutableBuilder().BuildKubectlExecutable()
}
func executableBuilder(t *testing.T, ctx context.Context) *executables.ExecutableBuilder {
executableBuilder, close, err := executables.NewExecutableBuilder(ctx, executables.DefaultEksaImage())
if err != nil {
t.Fatalf("Unable initialize executable builder: %v", err)
}
t.Cleanup(func() {
if err := close(ctx); err != nil {
t.Fatal(err)
}
})
return executableBuilder
}
func buildGovc(t *testing.T) *executables.Govc {
ctx := context.Background()
tmpWriter, err := filewriter.NewWriter("unique-ip")
if err != nil {
t.Fatalf("Error creating tmp writer")
}
govc := executableBuilder(t, ctx).BuildGovcExecutable(tmpWriter)
t.Cleanup(func() {
govc.Close(ctx)
})
return govc
}
func buildDocker(t *testing.T) *executables.Docker {
return executables.BuildDockerExecutable()
}
func buildHelm(t *testing.T) *executables.Helm {
ctx := context.Background()
helm := executableBuilder(t, ctx).BuildHelmExecutable(executables.WithInsecure())
return helm
}