...

Source file src/helm.sh/helm/v3/pkg/plugin/installer/base_test.go

Documentation: helm.sh/helm/v3/pkg/plugin/installer

     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  http://www.apache.org/licenses/LICENSE-2.0
     7  Unless required by applicable law or agreed to in writing, software
     8  distributed under the License is distributed on an "AS IS" BASIS,
     9  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    10  See the License for the specific language governing permissions and
    11  limitations under the License.
    12  */
    13  
    14  package installer // import "helm.sh/helm/v3/pkg/plugin/installer"
    15  
    16  import (
    17  	"os"
    18  	"testing"
    19  )
    20  
    21  func TestPath(t *testing.T) {
    22  	tests := []struct {
    23  		source         string
    24  		helmPluginsDir string
    25  		expectPath     string
    26  	}{
    27  		{
    28  			source:         "",
    29  			helmPluginsDir: "/helm/data/plugins",
    30  			expectPath:     "",
    31  		}, {
    32  			source:         "https://github.com/jkroepke/helm-secrets",
    33  			helmPluginsDir: "/helm/data/plugins",
    34  			expectPath:     "/helm/data/plugins/helm-secrets",
    35  		},
    36  	}
    37  
    38  	for _, tt := range tests {
    39  
    40  		os.Setenv("HELM_PLUGINS", tt.helmPluginsDir)
    41  		baseIns := newBase(tt.source)
    42  		baseInsPath := baseIns.Path()
    43  		if baseInsPath != tt.expectPath {
    44  			t.Errorf("expected name %s, got %s", tt.expectPath, baseInsPath)
    45  		}
    46  		os.Unsetenv("HELM_PLUGINS")
    47  	}
    48  }
    49  

View as plain text