(t *testing.T)
| 193 | } |
| 194 | |
| 195 | func TestValidateCredentialSpecs(t *testing.T) { |
| 196 | tests := []struct { |
| 197 | version string |
| 198 | expectedErr string |
| 199 | }{ |
| 200 | {version: "3.0", expectedErr: "credential_spec"}, |
| 201 | {version: "3.1", expectedErr: "credential_spec"}, |
| 202 | {version: "3.2", expectedErr: "credential_spec"}, |
| 203 | {version: "3.3", expectedErr: "config"}, |
| 204 | {version: "3.4", expectedErr: "config"}, |
| 205 | {version: "3.5", expectedErr: "config"}, |
| 206 | {version: "3.6", expectedErr: "config"}, |
| 207 | {version: "3.7", expectedErr: "config"}, |
| 208 | {version: "3.8"}, |
| 209 | {version: "3.9"}, |
| 210 | {version: "3.10"}, |
| 211 | {version: "3.11"}, |
| 212 | {version: "3.12"}, |
| 213 | {version: "3.13"}, |
| 214 | {version: "3"}, |
| 215 | {version: ""}, |
| 216 | } |
| 217 | |
| 218 | for _, tc := range tests { |
| 219 | t.Run(tc.version, func(t *testing.T) { |
| 220 | config := dict{ |
| 221 | "version": "99.99", |
| 222 | "services": dict{ |
| 223 | "foo": dict{ |
| 224 | "image": "busybox", |
| 225 | "credential_spec": dict{ |
| 226 | "config": "foobar", |
| 227 | }, |
| 228 | }, |
| 229 | }, |
| 230 | } |
| 231 | err := Validate(config, tc.version) |
| 232 | if tc.expectedErr != "" { |
| 233 | assert.ErrorContains(t, err, fmt.Sprintf("Additional property %s is not allowed", tc.expectedErr)) |
| 234 | } else { |
| 235 | assert.NilError(t, err) |
| 236 | } |
| 237 | }) |
| 238 | } |
| 239 | } |
| 240 | |
| 241 | func TestValidateSecretConfigNames(t *testing.T) { |
| 242 | config := dict{ |
nothing calls this directly
no test coverage detected
searching dependent graphs…