forked from linkerd/linkerd2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_helper.go
31 lines (25 loc) · 937 Bytes
/
test_helper.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
package k8s
import (
"net/http"
"net/url"
healthcheckPb "github.com/runconduit/conduit/controller/gen/common/healthcheck"
)
type MockKubeApi struct {
SelfCheckResultsToReturn []*healthcheckPb.CheckResult
UrlForNamespaceReceived string
UrlExtraPathStartingWithSlashReceived string
UrlForUrlToReturn *url.URL
NewClientClientToReturn *http.Client
ErrorToReturn error
}
func (m *MockKubeApi) UrlFor(namespace string, extraPathStartingWithSlash string) (*url.URL, error) {
m.UrlForNamespaceReceived = namespace
m.UrlExtraPathStartingWithSlashReceived = extraPathStartingWithSlash
return m.UrlForUrlToReturn, m.ErrorToReturn
}
func (m *MockKubeApi) NewClient() (*http.Client, error) {
return m.NewClientClientToReturn, m.ErrorToReturn
}
func (m *MockKubeApi) SelfCheck() []*healthcheckPb.CheckResult {
return m.SelfCheckResultsToReturn
}