github.com/Beeketing/helm@v2.12.1+incompatible/pkg/chartutil/capabilities_test.go (about) 1 /* 2 Copyright The Helm Authors. 3 Licensed under the Apache License, Version 2.0 (the "License"); 4 you may not use this file except in compliance with the License. 5 You may obtain a copy of the License at 6 7 http://www.apache.org/licenses/LICENSE-2.0 8 9 Unless required by applicable law or agreed to in writing, software 10 distributed under the License is distributed on an "AS IS" BASIS, 11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 See the License for the specific language governing permissions and 13 limitations under the License. 14 */ 15 16 package chartutil 17 18 import ( 19 "testing" 20 ) 21 22 func TestVersionSet(t *testing.T) { 23 vs := NewVersionSet("v1", "extensions/v1beta1") 24 if d := len(vs); d != 2 { 25 t.Errorf("Expected 2 versions, got %d", d) 26 } 27 28 if !vs.Has("extensions/v1beta1") { 29 t.Error("Expected to find extensions/v1beta1") 30 } 31 32 if vs.Has("Spanish/inquisition") { 33 t.Error("No one expects the Spanish/inquisition") 34 } 35 } 36 37 func TestDefaultVersionSet(t *testing.T) { 38 if !DefaultVersionSet.Has("v1") { 39 t.Error("Expected core v1 version set") 40 } 41 if d := len(DefaultVersionSet); d != 1 { 42 t.Errorf("Expected only one version, got %d", d) 43 } 44 } 45 46 func TestCapabilities(t *testing.T) { 47 cap := Capabilities{ 48 APIVersions: DefaultVersionSet, 49 } 50 51 if !cap.APIVersions.Has("v1") { 52 t.Error("APIVersions should have v1") 53 } 54 }