MCPcopy
hub / github.com/kubernetes/client-go / TestRequestWithErrorWontChange

Function TestRequestWithErrorWontChange

rest/request_test.go:96–118  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

94}
95
96func TestRequestWithErrorWontChange(t *testing.T) {
97 gvCopy := v1.SchemeGroupVersion
98 original := Request{
99 err: errors.New("test"),
100 content: ContentConfig{GroupVersion: &gvCopy},
101 }
102 r := original
103 changed := r.Param("foo", "bar").
104 AbsPath("/abs").
105 Prefix("test").
106 Suffix("testing").
107 Namespace("new").
108 Resource("foos").
109 Name("bars").
110 Body("foo").
111 Timeout(time.Millisecond)
112 if changed != &r {
113 t.Errorf("returned request should point to the same object")
114 }
115 if !reflect.DeepEqual(changed, &original) {
116 t.Errorf("expected %#v, got %#v", &original, changed)
117 }
118}
119
120func TestRequestPreservesBaseTrailingSlash(t *testing.T) {
121 r := &Request{baseURL: &url.URL{}, pathPrefix: "/path/"}

Callers

nothing calls this directly

Calls 10

TimeoutMethod · 0.80
BodyMethod · 0.80
SuffixMethod · 0.80
PrefixMethod · 0.80
AbsPathMethod · 0.80
ParamMethod · 0.80
ResourceMethod · 0.65
NamespaceMethod · 0.65
ErrorfMethod · 0.65
NameMethod · 0.45

Tested by

no test coverage detected