fix unittest issue for context.go
Signed-off-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
		
							parent
							
								
									e2cb7fe176
								
							
						
					
					
						commit
						eeb2eee099
					
				| 
						 | 
					@ -2,6 +2,7 @@ package helmexec
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
	"os"
 | 
						"os"
 | 
				
			||||||
 | 
						"path/filepath"
 | 
				
			||||||
	"testing"
 | 
						"testing"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"github.com/Masterminds/semver/v3"
 | 
						"github.com/Masterminds/semver/v3"
 | 
				
			||||||
| 
						 | 
					@ -55,6 +56,11 @@ func TestGetTillerlessArgs(t *testing.T) {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func pwd() string {
 | 
				
			||||||
 | 
						pwd, _ := os.Getwd()
 | 
				
			||||||
 | 
						return pwd
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// TestGetTillerlessEnv tests the getTillerlessEnv function
 | 
					// TestGetTillerlessEnv tests the getTillerlessEnv function
 | 
				
			||||||
func TestGetTillerlessEnv(t *testing.T) {
 | 
					func TestGetTillerlessEnv(t *testing.T) {
 | 
				
			||||||
	kubeconfigEnv := "KUBECONFIG"
 | 
						kubeconfigEnv := "KUBECONFIG"
 | 
				
			||||||
| 
						 | 
					@ -72,7 +78,7 @@ func TestGetTillerlessEnv(t *testing.T) {
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			tillerless: true,
 | 
								tillerless: true,
 | 
				
			||||||
			kubeconfig: "abc",
 | 
								kubeconfig: "abc",
 | 
				
			||||||
			expected:   map[string]string{"HELM_TILLER_SILENT": "true", kubeconfigEnv: "/workdir/helmfile/pkg/helmexec/abc"},
 | 
								expected:   map[string]string{"HELM_TILLER_SILENT": "true", kubeconfigEnv: filepath.Join(pwd(), "abc")},
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			tillerless: true,
 | 
								tillerless: true,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue