TestParamVerifyingSchema tests that client-side schema validation should be bypassed (and therefore validation succeeds) in all cases except when the field validation is "Strict" and server-side validation is unsupported.
(t *testing.T)
| 159 | // except when the field validation is "Strict" and server-side validation is |
| 160 | // unsupported. |
| 161 | func TestParamVerifyingSchema(t *testing.T) { |
| 162 | bytes := []byte(` |
| 163 | { |
| 164 | "kind": "Pod", |
| 165 | "apiVersion": "v1", |
| 166 | "metadata": { |
| 167 | "name": "name", |
| 168 | "labels": { |
| 169 | "name": "redis-master" |
| 170 | } |
| 171 | }, |
| 172 | "spec": { |
| 173 | "containers": [ |
| 174 | { |
| 175 | "name": "master", |
| 176 | "image": "gcr.io/fake_project/fake_image:fake_tag", |
| 177 | "args": "this is a bad command" |
| 178 | } |
| 179 | ] |
| 180 | } |
| 181 | } |
| 182 | `) |
| 183 | supportedVerifier := &mockVerifier{true} |
| 184 | unsupportedVerifier := &mockVerifier{false} |
| 185 | tests := []struct { |
| 186 | name string |
| 187 | supported bool |
| 188 | schema Schema |
| 189 | verifier resource.Verifier |
| 190 | directive string |
| 191 | shouldPass bool |
| 192 | }{ |
| 193 | { |
| 194 | name: "supported, strict", |
| 195 | schema: NullSchema{}, |
| 196 | verifier: supportedVerifier, |
| 197 | directive: "Strict", |
| 198 | shouldPass: true, |
| 199 | }, |
| 200 | { |
| 201 | name: "supported, warn", |
| 202 | schema: NullSchema{}, |
| 203 | verifier: supportedVerifier, |
| 204 | directive: "Warn", |
| 205 | shouldPass: true, |
| 206 | }, |
| 207 | { |
| 208 | name: "unsupported, strict", |
| 209 | schema: NullSchema{}, |
| 210 | verifier: unsupportedVerifier, |
| 211 | directive: "Strict", |
| 212 | shouldPass: true, |
| 213 | }, |
| 214 | { |
| 215 | name: "unsupported, warn", |
| 216 | schema: NullSchema{}, |
| 217 | verifier: unsupportedVerifier, |
| 218 | directive: "Warn", |
nothing calls this directly
no test coverage detected
searching dependent graphs…