github.com/sri09kanth/helm@v3.0.0-beta.3+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 := VersionSet{"v1", "apps/v1"}
    24  	if d := len(vs); d != 2 {
    25  		t.Errorf("Expected 2 versions, got %d", d)
    26  	}
    27  
    28  	if !vs.Has("apps/v1") {
    29  		t.Error("Expected to find apps/v1")
    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  }
    42  
    43  func TestDefaultCapabilities(t *testing.T) {
    44  	kv := DefaultCapabilities.KubeVersion
    45  	if kv.String() != "v1.14.0" {
    46  		t.Errorf("Expected default KubeVersion.String() to be v1.14.0, got %q", kv.String())
    47  	}
    48  	if kv.Version != "v1.14.0" {
    49  		t.Errorf("Expected default KubeVersion.Version to be v1.14.0, got %q", kv.Version)
    50  	}
    51  	if kv.GitVersion() != "v1.14.0" {
    52  		t.Errorf("Expected default KubeVersion.GitVersion() to be v1.14.0, got %q", kv.Version)
    53  	}
    54  	if kv.Major != "1" {
    55  		t.Errorf("Expected default KubeVersion.Major to be 1, got %q", kv.Major)
    56  	}
    57  	if kv.Minor != "14" {
    58  		t.Errorf("Expected default KubeVersion.Minor to be 14, got %q", kv.Minor)
    59  	}
    60  }