MCPcopy Index your code
hub / github.com/FairwindsOps/pluto / TestVersion_IsDeprecatedIn

Function TestVersion_IsDeprecatedIn

pkg/api/versions_test.go:314–370  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

312}
313
314func TestVersion_IsDeprecatedIn(t *testing.T) {
315 tests := []struct {
316 name string
317 targetVersions map[string]string
318 component string
319 want bool
320 deprecatedIn string
321 }{
322 {
323 name: "not deprecated yet 1.15.0",
324 targetVersions: map[string]string{"foo": "v1.15.0"},
325 component: "foo",
326 deprecatedIn: "v1.16.0",
327 want: false,
328 },
329 {
330 name: "equal values",
331 targetVersions: map[string]string{"foo": "v1.16.0"},
332 component: "foo",
333 deprecatedIn: "v1.16.0",
334 want: true,
335 },
336 {
337 name: "greater than",
338 targetVersions: map[string]string{"foo": "v1.17.0"},
339 component: "foo",
340 deprecatedIn: "v1.16.0",
341 want: true,
342 },
343 {
344 name: "Bad semVer",
345 targetVersions: map[string]string{"foo": "foo"},
346 component: "foo",
347 deprecatedIn: "v1.16.0",
348 want: false,
349 },
350 {
351 name: "blank deprecatedIn - not deprecated",
352 targetVersions: map[string]string{"foo": "v1.16.0"},
353 component: "foo",
354 deprecatedIn: "",
355 want: false,
356 },
357 {
358 name: "targetversion not included",
359 targetVersions: map[string]string{"one": "v1.16.0"},
360 component: "two",
361 deprecatedIn: "v1.16.0",
362 want: false,
363 },
364 }
365 for _, tt := range tests {
366 deprecatedVersion := &Version{DeprecatedIn: tt.deprecatedIn, Component: tt.component}
367 got := deprecatedVersion.isDeprecatedIn(tt.targetVersions)
368 assert.Equal(t, tt.want, got, "test failed: "+tt.name)
369 }
370}
371

Callers

nothing calls this directly

Calls 1

isDeprecatedInMethod · 0.95

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…