MCPcopy
hub / github.com/helm/helm / TestParseKubeVersionWithVendorSuffixes

Function TestParseKubeVersionWithVendorSuffixes

pkg/chart/common/capabilities_test.go:84–121  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

82}
83
84func TestParseKubeVersionWithVendorSuffixes(t *testing.T) {
85 tests := []struct {
86 name string
87 input string
88 wantVer string
89 wantString string
90 wantMajor string
91 wantMinor string
92 }{
93 {"GKE vendor suffix", "v1.33.4-gke.1245000", "v1.33.4-gke.1245000", "v1.33.4", "1", "33"},
94 {"GKE without v", "1.30.2-gke.1587003", "v1.30.2-gke.1587003", "v1.30.2", "1", "30"},
95 {"EKS trailing +", "v1.28+", "v1.28+", "v1.28", "1", "28"},
96 {"EKS + without v", "1.28+", "v1.28+", "v1.28", "1", "28"},
97 {"Standard version", "v1.31.0", "v1.31.0", "v1.31.0", "1", "31"},
98 {"Standard without v", "1.29.0", "v1.29.0", "v1.29.0", "1", "29"},
99 }
100
101 for _, tt := range tests {
102 t.Run(tt.name, func(t *testing.T) {
103 kv, err := ParseKubeVersion(tt.input)
104 if err != nil {
105 t.Fatalf("ParseKubeVersion() error = %v", err)
106 }
107 if kv.Version != tt.wantVer {
108 t.Errorf("Version = %q, want %q", kv.Version, tt.wantVer)
109 }
110 if kv.String() != tt.wantString {
111 t.Errorf("String() = %q, want %q", kv.String(), tt.wantString)
112 }
113 if kv.Major != tt.wantMajor {
114 t.Errorf("Major = %q, want %q", kv.Major, tt.wantMajor)
115 }
116 if kv.Minor != tt.wantMinor {
117 t.Errorf("Minor = %q, want %q", kv.Minor, tt.wantMinor)
118 }
119 })
120 }
121}

Callers

nothing calls this directly

Calls 4

ParseKubeVersionFunction · 0.85
FatalfMethod · 0.80
RunMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…