Debian Codegraph @

lfshttp/ssh_test.go

raw symbols SCIP
1 package lfshttpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/
2
3 import (
4 goerrorsscip-go gomod github.com/golang/go/src go1.25.0 errors/ "errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/"
5 "fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/"
6 "os/execscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/"
7 "syncscip-go gomod github.com/golang/go/src go1.25.0 sync/"
8 "testingscip-go gomod github.com/golang/go/src go1.25.0 testing/"
9 "timescip-go gomod github.com/golang/go/src go1.25.0 time/"
10
11 "github.com/git-lfs/git-lfs/v3/errorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/"
12 sshpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/ "github.com/git-lfs/git-lfs/v3/sshscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/"
13 "github.com/stretchr/testify/assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/"
14 "github.com/stretchr/testify/requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/"
15 )
16
17 func TestSSHCacheResolveFromCachescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/TestSSHCacheResolveFromCache().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
18 ssh := newFakeResolverscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/newFakeResolver().()
19 cache := withSSHCachescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/withSSHCache().(ssh).(*sshCachescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshCache#)
20 cache.endpointsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshCache#endpoints..Storescip-go gomod github.com/golang/go/src go1.25.0 sync/Map#Store().("userandhost//1//path//post", &sshAuthResponsescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#{
21 Hrefscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#Href.: "cache",
22 createdAtscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#createdAt.: timescip-go gomod github.com/golang/go/src go1.25.0 time/.Nowscip-go gomod github.com/golang/go/src go1.25.0 time/Now().(),
23 })
24 ssh.responsesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/fakeResolver#responses.["userandhost"] = sshAuthResponsescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#{Hrefscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#Href.: "real"}
25
26 e := Endpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint#{
27 SSHMetadatascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint#SSHMetadata.: sshpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/.SSHMetadatascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/SSHMetadata#{
28 UserAndHostscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/SSHMetadata#UserAndHost.: "userandhost",
29 Portscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/SSHMetadata#Port.: "1",
30 Pathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/SSHMetadata#Path.: "path",
31 },
32 }
33
34 res, err := cache.Resolvescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshCache#Resolve().(e, "post")
35 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, err)
36 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "cache", res.Hrefscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#Href.)
37 }
38
39 func TestSSHCacheResolveFromCacheWithFutureExpiresAtscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/TestSSHCacheResolveFromCacheWithFutureExpiresAt().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
40 ssh := newFakeResolverscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/newFakeResolver().()
41 cache := withSSHCachescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/withSSHCache().(ssh).(*sshCachescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshCache#)
42 cache.endpointsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshCache#endpoints..Storescip-go gomod github.com/golang/go/src go1.25.0 sync/Map#Store().("userandhost//1//path//post", &sshAuthResponsescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#{
43 Hrefscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#Href.: "cache",
44 ExpiresAtscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#ExpiresAt.: timescip-go gomod github.com/golang/go/src go1.25.0 time/.Nowscip-go gomod github.com/golang/go/src go1.25.0 time/Now().().Addscip-go gomod github.com/golang/go/src go1.25.0 time/Time#Add().(timescip-go gomod github.com/golang/go/src go1.25.0 time/.Durationscip-go gomod github.com/golang/go/src go1.25.0 time/Duration#(1) * timescip-go gomod github.com/golang/go/src go1.25.0 time/.Hourscip-go gomod github.com/golang/go/src go1.25.0 time/Hour.),
45 createdAtscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#createdAt.: timescip-go gomod github.com/golang/go/src go1.25.0 time/.Nowscip-go gomod github.com/golang/go/src go1.25.0 time/Now().(),
46 })
47 ssh.responsesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/fakeResolver#responses.["userandhost"] = sshAuthResponsescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#{Hrefscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#Href.: "real"}
48
49 e := Endpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint#{
50 SSHMetadatascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint#SSHMetadata.: sshpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/.SSHMetadatascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/SSHMetadata#{
51 UserAndHostscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/SSHMetadata#UserAndHost.: "userandhost",
52 Portscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/SSHMetadata#Port.: "1",
53 Pathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/SSHMetadata#Path.: "path",
54 },
55 }
56
57 res, err := cache.Resolvescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshCache#Resolve().(e, "post")
58 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, err)
59 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "cache", res.Hrefscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#Href.)
60 }
61
62 func TestSSHCacheResolveFromCacheWithFutureExpiresInscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/TestSSHCacheResolveFromCacheWithFutureExpiresIn().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
63 ssh := newFakeResolverscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/newFakeResolver().()
64 cache := withSSHCachescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/withSSHCache().(ssh).(*sshCachescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshCache#)
65 cache.endpointsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshCache#endpoints..Storescip-go gomod github.com/golang/go/src go1.25.0 sync/Map#Store().("userandhost//1//path//post", &sshAuthResponsescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#{
66 Hrefscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#Href.: "cache",
67 ExpiresInscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#ExpiresIn.: 60 * 60,
68 createdAtscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#createdAt.: timescip-go gomod github.com/golang/go/src go1.25.0 time/.Nowscip-go gomod github.com/golang/go/src go1.25.0 time/Now().(),
69 })
70 ssh.responsesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/fakeResolver#responses.["userandhost"] = sshAuthResponsescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#{Hrefscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#Href.: "real"}
71
72 e := Endpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint#{
73 SSHMetadatascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint#SSHMetadata.: sshpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/.SSHMetadatascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/SSHMetadata#{
74 UserAndHostscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/SSHMetadata#UserAndHost.: "userandhost",
75 Portscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/SSHMetadata#Port.: "1",
76 Pathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/SSHMetadata#Path.: "path",
77 },
78 }
79
80 res, err := cache.Resolvescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshCache#Resolve().(e, "post")
81 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, err)
82 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "cache", res.Hrefscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#Href.)
83 }
84
85 func TestSSHCacheResolveFromCacheWithPastExpiresAtscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/TestSSHCacheResolveFromCacheWithPastExpiresAt().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
86 ssh := newFakeResolverscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/newFakeResolver().()
87 cache := withSSHCachescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/withSSHCache().(ssh).(*sshCachescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshCache#)
88 cache.endpointsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshCache#endpoints..Storescip-go gomod github.com/golang/go/src go1.25.0 sync/Map#Store().("userandhost//1//path//post", &sshAuthResponsescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#{
89 Hrefscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#Href.: "cache",
90 ExpiresAtscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#ExpiresAt.: timescip-go gomod github.com/golang/go/src go1.25.0 time/.Nowscip-go gomod github.com/golang/go/src go1.25.0 time/Now().().Addscip-go gomod github.com/golang/go/src go1.25.0 time/Time#Add().(timescip-go gomod github.com/golang/go/src go1.25.0 time/.Durationscip-go gomod github.com/golang/go/src go1.25.0 time/Duration#(-1) * timescip-go gomod github.com/golang/go/src go1.25.0 time/.Hourscip-go gomod github.com/golang/go/src go1.25.0 time/Hour.),
91 createdAtscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#createdAt.: timescip-go gomod github.com/golang/go/src go1.25.0 time/.Nowscip-go gomod github.com/golang/go/src go1.25.0 time/Now().(),
92 })
93 ssh.responsesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/fakeResolver#responses.["userandhost"] = sshAuthResponsescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#{Hrefscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#Href.: "real"}
94
95 e := Endpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint#{
96 SSHMetadatascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint#SSHMetadata.: sshpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/.SSHMetadatascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/SSHMetadata#{
97 UserAndHostscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/SSHMetadata#UserAndHost.: "userandhost",
98 Portscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/SSHMetadata#Port.: "1",
99 Pathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/SSHMetadata#Path.: "path",
100 },
101 }
102
103 res, err := cache.Resolvescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshCache#Resolve().(e, "post")
104 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, err)
105 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "real", res.Hrefscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#Href.)
106 }
107
108 func TestSSHCacheResolveFromCacheWithPastExpiresInscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/TestSSHCacheResolveFromCacheWithPastExpiresIn().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
109 ssh := newFakeResolverscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/newFakeResolver().()
110 cache := withSSHCachescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/withSSHCache().(ssh).(*sshCachescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshCache#)
111 cache.endpointsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshCache#endpoints..Storescip-go gomod github.com/golang/go/src go1.25.0 sync/Map#Store().("userandhost//1//path//post", &sshAuthResponsescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#{
112 Hrefscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#Href.: "cache",
113 ExpiresInscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#ExpiresIn.: -60 * 60,
114 createdAtscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#createdAt.: timescip-go gomod github.com/golang/go/src go1.25.0 time/.Nowscip-go gomod github.com/golang/go/src go1.25.0 time/Now().(),
115 })
116 ssh.responsesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/fakeResolver#responses.["userandhost"] = sshAuthResponsescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#{Hrefscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#Href.: "real"}
117
118 e := Endpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint#{
119 SSHMetadatascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint#SSHMetadata.: sshpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/.SSHMetadatascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/SSHMetadata#{
120 UserAndHostscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/SSHMetadata#UserAndHost.: "userandhost",
121 Portscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/SSHMetadata#Port.: "1",
122 Pathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/SSHMetadata#Path.: "path",
123 },
124 }
125
126 res, err := cache.Resolvescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshCache#Resolve().(e, "post")
127 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, err)
128 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "real", res.Hrefscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#Href.)
129 }
130
131 func TestSSHCacheResolveFromCacheWithAmbiguousExpirationInfoscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/TestSSHCacheResolveFromCacheWithAmbiguousExpirationInfo().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
132 ssh := newFakeResolverscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/newFakeResolver().()
133 cache := withSSHCachescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/withSSHCache().(ssh).(*sshCachescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshCache#)
134 cache.endpointsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshCache#endpoints..Storescip-go gomod github.com/golang/go/src go1.25.0 sync/Map#Store().("userandhost//1//path//post", &sshAuthResponsescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#{
135 Hrefscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#Href.: "cache",
136 ExpiresInscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#ExpiresIn.: 60 * 60,
137 ExpiresAtscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#ExpiresAt.: timescip-go gomod github.com/golang/go/src go1.25.0 time/.Nowscip-go gomod github.com/golang/go/src go1.25.0 time/Now().().Addscip-go gomod github.com/golang/go/src go1.25.0 time/Time#Add().(-1 * timescip-go gomod github.com/golang/go/src go1.25.0 time/.Hourscip-go gomod github.com/golang/go/src go1.25.0 time/Hour.),
138 createdAtscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#createdAt.: timescip-go gomod github.com/golang/go/src go1.25.0 time/.Nowscip-go gomod github.com/golang/go/src go1.25.0 time/Now().(),
139 })
140 ssh.responsesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/fakeResolver#responses.["userandhost"] = sshAuthResponsescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#{Hrefscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#Href.: "real"}
141
142 e := Endpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint#{
143 SSHMetadatascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint#SSHMetadata.: sshpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/.SSHMetadatascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/SSHMetadata#{
144 UserAndHostscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/SSHMetadata#UserAndHost.: "userandhost",
145 Portscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/SSHMetadata#Port.: "1",
146 Pathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/SSHMetadata#Path.: "path",
147 },
148 }
149
150 res, err := cache.Resolvescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshCache#Resolve().(e, "post")
151 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, err)
152 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "cache", res.Hrefscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#Href.)
153 }
154
155 func TestSSHCacheResolveWithoutErrorscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/TestSSHCacheResolveWithoutError().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
156 ssh := newFakeResolverscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/newFakeResolver().()
157 cache := withSSHCachescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/withSSHCache().(ssh).(*sshCachescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshCache#)
158
159 assertCacheLenscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/assertCacheLen().(t, cache, 0)
160
161 ssh.responsesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/fakeResolver#responses.["userandhost"] = sshAuthResponsescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#{Hrefscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#Href.: "real"}
162
163 e := Endpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint#{
164 SSHMetadatascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint#SSHMetadata.: sshpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/.SSHMetadatascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/SSHMetadata#{
165 UserAndHostscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/SSHMetadata#UserAndHost.: "userandhost",
166 Portscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/SSHMetadata#Port.: "1",
167 Pathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/SSHMetadata#Path.: "path",
168 },
169 }
170
171 res, err := cache.Resolvescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshCache#Resolve().(e, "post")
172 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, err)
173 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "real", res.Hrefscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#Href.)
174
175 assertCacheLenscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/assertCacheLen().(t, cache, 1)
176 val, ok := cache.endpointsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshCache#endpoints..Loadscip-go gomod github.com/golang/go/src go1.25.0 sync/Map#Load().("userandhost//1//path//post")
177 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Truescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/True().(t, ok)
178 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NotNilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NotNil().(t, val)
179 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "real", val.(*sshAuthResponsescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#).Hrefscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#Href.)
180
181 delete(ssh.responsesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/fakeResolver#responses., "userandhost")
182 res2, err := cache.Resolvescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshCache#Resolve().(e, "post")
183 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, err)
184 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "real", res2.Hrefscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#Href.)
185 }
186
187 func TestSSHCacheResolveWithErrorscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/TestSSHCacheResolveWithError().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
188 ssh := newFakeResolverscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/newFakeResolver().()
189 cache := withSSHCachescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/withSSHCache().(ssh).(*sshCachescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshCache#)
190
191 assertCacheLenscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/assertCacheLen().(t, cache, 0)
192
193 ssh.responsesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/fakeResolver#responses.["userandhost"] = sshAuthResponsescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#{Messagescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#Message.: "resolve error", Hrefscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#Href.: "real"}
194
195 e := Endpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint#{
196 SSHMetadatascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint#SSHMetadata.: sshpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/.SSHMetadatascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/SSHMetadata#{
197 UserAndHostscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/SSHMetadata#UserAndHost.: "userandhost",
198 Portscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/SSHMetadata#Port.: "1",
199 Pathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/SSHMetadata#Path.: "path",
200 },
201 }
202
203 res, err := cache.Resolvescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshCache#Resolve().(e, "post")
204 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NotNilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NotNil().(t, err)
205 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "real", res.Hrefscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#Href.)
206
207 assertCacheLenscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/assertCacheLen().(t, cache, 0)
208 delete(ssh.responsesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/fakeResolver#responses., "userandhost")
209 res2, err := cache.Resolvescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshCache#Resolve().(e, "post")
210 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, err)
211 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "", res2.Hrefscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#Href.)
212 }
213
214 // countingResolver always returns the configured error and records how many
215 // times Resolve was called.
216 type countingResolverscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/countingResolver# struct {
217 errscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/countingResolver#err. error
218 callsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/countingResolver#calls. int
219 }
220
221 func (r *countingResolverscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/countingResolver#) Resolvescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/countingResolver#Resolve().(e Endpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint#, method string) (sshAuthResponsescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#, error) {
222 r.callsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/countingResolver#calls.++
223 return sshAuthResponsescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#{}, r.errscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/countingResolver#err.
224 }
225
226 func newTestClientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/newTestClient().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#, resolver SSHResolverscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/SSHResolver#) *Clientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client# {
227 t.Helperscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Helper().()
228 c := NewClientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/NewClient().(NewContextscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/NewContext().(nil, nil, nil))
229 c.SSHscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#SSH. = resolver
230 c.sshTriesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#sshTries. = 5
231 return c
232 }
233
234 func testSSHEndpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/testSSHEndpoint().() Endpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint# {
235 return Endpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint#{
236 Urlscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint#Url.: "https://git-server.com/foo/bar.git/info/lfs",
237 OriginalUrlscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint#OriginalUrl.: "[email protected]:foo/bar.git",
238 SSHMetadatascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint#SSHMetadata.: sshpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/.SSHMetadatascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/SSHMetadata#{
239 UserAndHostscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/SSHMetadata#UserAndHost.: "[email protected]",
240 Pathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/SSHMetadata#Path.: "foo/bar.git",
241 },
242 }
243 }
244
245 func TestSSHResolveFallsBackWhenAuthenticateUnavailablescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/TestSSHResolveFallsBackWhenAuthenticateUnavailable().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
246 resolver := &countingResolverscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/countingResolver#{
247 errscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/countingResolver#err.: &sshAuthenticateUnavailableErrorscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthenticateUnavailableError#{
248 errscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthenticateUnavailableError#err.: errorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/.Newscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/New().("bash: git-lfs-authenticate: command not found"),
249 },
250 }
251 c := newTestClientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/newTestClient().(t, resolver)
252
253 res, err := c.sshResolveWithRetriesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#sshResolveWithRetries().(testSSHEndpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/testSSHEndpoint().(), "GET")
254 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, err)
255 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NotNilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NotNil().(t, res)
256 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "", res.Hrefscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#Href.)
257
258 // The unavailable command should not be retried.
259 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 1, resolver.callsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/countingResolver#calls.)
260 }
261
262 func TestSSHResolveFailsForOtherErrorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/TestSSHResolveFailsForOtherErrors().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
263 resolver := &countingResolverscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/countingResolver#{errscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/countingResolver#err.: errorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/.Newscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/New().("permission denied")}
264 c := newTestClientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/newTestClient().(t, resolver)
265
266 _, err := c.sshResolveWithRetriesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Client#sshResolveWithRetries().(testSSHEndpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/testSSHEndpoint().(), "GET")
267 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NotNilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NotNil().(t, err)
268
269 // Non-fallback errors are retried sshTries+1 times.
270 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 6, resolver.callsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/countingResolver#calls.)
271 }
272
273 // exitErrorWithCode runs a trivial command that exits with the given status so
274 // that tests can obtain a real *exec.ExitError.
275 func exitErrorWithCodescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/exitErrorWithCode().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#, code int) error {
276 t.Helperscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Helper().()
277 err := execscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/.Commandscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Command().("sh", "-c", fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Sprintf().("exit %d", code)).Runscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Cmd#Run().()
278 var exitErr *execscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/.ExitErrorscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/ExitError#
279 requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Truescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/True().(t, goerrorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Asscip-go gomod github.com/golang/go/src go1.25.0 errors/As().(err, &exitErr))
280 requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Equal().(t, code, exitErr.ExitCodescip-go gomod github.com/golang/go/src go1.25.0 os/ProcessState#ExitCode().())
281 return err
282 }
283
284 func TestIsSSHAuthenticateUnavailablescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/TestIsSSHAuthenticateUnavailable().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
285 for _, tc := range []struct {
286 name string
287 exitCode int
288 stderr string
289 want bool
290 }{
291 {
292 name: "command not found exit code",
293 exitCode: 127,
294 stderr: "",
295 want: true,
296 },
297 {
298 name: "gerrit generic exit code with message",
299 exitCode: 1,
300 stderr: "fatal: Gerrit Code Review: git-lfs-authenticate: not found",
301 want: true,
302 },
303 {
304 name: "bash command not found message",
305 exitCode: 1,
306 stderr: "bash: git-lfs-authenticate: command not found",
307 want: true,
308 },
309 {
310 name: "zsh command not found message",
311 exitCode: 1,
312 stderr: "zsh: command not found: git-lfs-authenticate",
313 want: true,
314 },
315 {
316 name: "no such file message",
317 exitCode: 1,
318 stderr: "git-lfs-authenticate: No such file or directory",
319 want: true,
320 },
321 {
322 name: "unrelated not found error is not a fallback",
323 exitCode: 1,
324 stderr: "Repository not found",
325 want: false,
326 },
327 {
328 name: "generic error without message is fatal",
329 exitCode: 1,
330 stderr: "",
331 want: false,
332 },
333 } {
334 t.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/T#Run().(tc.name, func(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
335 err := exitErrorWithCodescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/exitErrorWithCode().(t, tc.exitCode)
336 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, tc.want, isSSHAuthenticateUnavailablescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/isSSHAuthenticateUnavailable().(err, tc.stderr))
337 })
338 }
339 }
340
341 func TestIsSSHAuthenticateUnavailableNonExitErrorscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/TestIsSSHAuthenticateUnavailableNonExitError().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
342 // A failure to start the command (not an *exec.ExitError) is a genuine
343 // error, never an "unavailable" signal, even with a matching message.
344 err := errorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/.Newscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/New().("exec: \"ssh\": executable file not found in $PATH")
345 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Falsescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/False().(t, isSSHAuthenticateUnavailablescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/isSSHAuthenticateUnavailable().(err,
346 "git-lfs-authenticate: not found"))
347 }
348
349 func assertCacheLenscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/assertCacheLen().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#, cache *sshCachescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshCache#, expected int) {
350 t.Helperscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Helper().()
351 n := 0
352 cache.endpointsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshCache#endpoints..Rangescip-go gomod github.com/golang/go/src go1.25.0 sync/Map#Range().(func(_, _ any) bool { n++; return true })
353 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, expected, n)
354 }
355
356 func TestSSHCacheConcurrentResolvescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/TestSSHCacheConcurrentResolve().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
357 ssh := newFakeResolverscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/newFakeResolver().()
358 cache := withSSHCachescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/withSSHCache().(ssh)
359
360 ssh.responsesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/fakeResolver#responses.["userandhost"] = sshAuthResponsescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#{Hrefscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#Href.: "real"}
361
362 e := Endpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint#{
363 SSHMetadatascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint#SSHMetadata.: sshpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/.SSHMetadatascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/SSHMetadata#{
364 UserAndHostscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/SSHMetadata#UserAndHost.: "userandhost",
365 Portscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/SSHMetadata#Port.: "1",
366 Pathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/SSHMetadata#Path.: "path",
367 },
368 }
369
370 // Two goroutines resolving the same endpoint concurrently is enough
371 // for `go test -race` to detect an unprotected map access.
372 start := make(chan struct{})
373 var wg syncscip-go gomod github.com/golang/go/src go1.25.0 sync/.WaitGroupscip-go gomod github.com/golang/go/src go1.25.0 sync/WaitGroup#
374 for i := 0; i < 2; i++ {
375 wg.Addscip-go gomod github.com/golang/go/src go1.25.0 sync/WaitGroup#Add().(1)
376 go func() {
377 defer wg.Donescip-go gomod github.com/golang/go/src go1.25.0 sync/WaitGroup#Done().()
378 <-start
379 res, err := cache.Resolvescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/SSHResolver#Resolve.(e, "post")
380 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, err)
381 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "real", res.Hrefscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#Href.)
382 }()
383 }
384 close(start)
385 wg.Waitscip-go gomod github.com/golang/go/src go1.25.0 sync/WaitGroup#Wait().()
386 }
387
388 func newFakeResolverscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/newFakeResolver().() *fakeResolverscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/fakeResolver# {
389 return &fakeResolverscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/fakeResolver#{responsesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/fakeResolver#responses.: make(map[string]sshAuthResponsescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#)}
390 }
391
392 type fakeResolverscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/fakeResolver# struct {
393 responsesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/fakeResolver#responses. map[string]sshAuthResponsescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#
394 }
395
396 func (r *fakeResolverscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/fakeResolver#) Resolvescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/fakeResolver#Resolve().(e Endpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint#, method string) (sshAuthResponsescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#, error) {
397 res := r.responsesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/fakeResolver#responses.[e.SSHMetadatascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint#SSHMetadata..UserAndHostscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/ssh`/SSHMetadata#UserAndHost.]
398 var err error
399 if len(res.Messagescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#Message.) > 0 {
400 err = errorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/.Newscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/New().(res.Messagescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#Message.)
401 }
402
403 res.createdAtscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/sshAuthResponse#createdAt. = timescip-go gomod github.com/golang/go/src go1.25.0 time/.Nowscip-go gomod github.com/golang/go/src go1.25.0 time/Now().()
404
405 return res, err
406 }