Repository navigation
Expand file tree
/
Copy pathpublic_test.go
More file actions
68 lines (62 loc) · 1.96 KB
/
Copy pathpublic_test.go
File metadata and controls
68 lines (62 loc) · 1.96 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package kwt_test
import (
"context"
"io"
"testing"
kwt "go.kenn.io/kwt"
)
func TestRootPackageExposesWorktreeServices(t *testing.T) {
if kwt.NewInventoryService(kwt.InventoryServiceOptions{}) == nil {
t.Fatal("inventory service is unavailable from the root package")
}
if kwt.NewRemovalService(kwt.RemovalServiceOptions{}) == nil {
t.Fatal("removal service is unavailable from the root package")
}
}
func TestRootPackageExposesInspectionService(t *testing.T) {
inspector := kwt.NewInspectionService(kwt.InspectionServiceOptions{})
if inspector == nil {
t.Fatal("inspection service is unavailable from the root package")
}
var _ = kwt.InspectionRequest{}
var _ = kwt.InspectionResult{
Worktree: kwt.WorktreeIdentity{},
Changes: kwt.ChangeSet{
State: kwt.ChangeStateClean,
Files: []kwt.FileChange{{
Index: kwt.FileStateAdded,
}},
},
}
}
func TestRootPackageExposesSSHAskpassDispatch(t *testing.T) {
exitCode, handled := kwt.RunSSHAskpassHelper(
[]string{"host-application"},
nil,
io.Discard,
)
if handled || exitCode != 0 {
t.Fatal("ordinary host process invocation was treated as SSH askpass")
}
}
func TestRootPackageExposesSSHResolutionService(t *testing.T) {
service := kwt.NewSSHService(kwt.SSHServiceOptions{})
if service == nil {
t.Fatal("SSH resolution service is unavailable from the root package")
}
var _ interface {
Resolve(context.Context, kwt.SSHResolveRequest) (kwt.SSHRouteSnapshot, error)
Acquire(context.Context, kwt.SSHLeaseRequest) (kwt.SSHLease, error)
} = service
if kwt.SSHProjectionPolicyV1 != "kwt.openssh.projection.v1" {
t.Fatal("deprecated SSH projection policy changed its public value")
}
if kwt.SSHProjectionPolicyV2 == "" {
t.Fatal("SSH projection policy is unavailable from the root package")
}
requireLeaseMode := func(kwt.SSHLeaseMode) {}
requireLeaseMode(kwt.SSHLeaseModeMultiplexed)
if kwt.SSHEventStateConnected == "" {
t.Fatal("SSH event states are unavailable from the root package")
}
}