forked from hashicorp/hc-install
/
fs_test.go
60 lines (47 loc) · 1.17 KB
/
fs_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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package fs
import (
"context"
"testing"
"github.com/hashicorp/go-version"
"github.com/hashicorp/hc-install/internal/testutil"
"github.com/hashicorp/hc-install/product"
"github.com/hashicorp/hc-install/src"
)
var (
_ src.Findable = &AnyVersion{}
_ src.LoggerSettable = &AnyVersion{}
_ src.Findable = &ExactVersion{}
_ src.LoggerSettable = &ExactVersion{}
_ src.Findable = &Version{}
_ src.LoggerSettable = &Version{}
)
func TestExactVersion(t *testing.T) {
t.Skip("TODO")
testutil.EndToEndTest(t)
// TODO: mock out command execution?
t.Setenv("PATH", "")
ev := &ExactVersion{
Product: product.Terraform,
Version: version.Must(version.NewVersion("0.14.0")),
}
ev.SetLogger(testutil.TestLogger())
_, err := ev.Find(context.Background())
if err != nil {
t.Fatal(err)
}
}
func TestVersion(t *testing.T) {
t.Skip("TODO")
testutil.EndToEndTest(t)
// TODO: mock out command execution?
t.Setenv("PATH", "")
v := &Version{
Product: product.Terraform,
Constraints: version.MustConstraints(version.NewConstraint(">= 1.0")),
}
v.SetLogger(testutil.TestLogger())
_, err := v.Find(context.Background())
if err != nil {
t.Fatal(err)
}
}