Skip to content

Commit

Permalink
Add/fix remoteChart tests (#5921)
Browse files Browse the repository at this point in the history
  • Loading branch information
briandealwis authored Jun 1, 2021
1 parent 435cd71 commit e8803ad
Showing 1 changed file with 33 additions and 8 deletions.
41 changes: 33 additions & 8 deletions pkg/skaffold/deploy/helm/helm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,18 @@ var testDeploySkipBuildDependencies = latestV1.HelmDeploy{

var testDeployRemoteChart = latestV1.HelmDeploy{
Releases: []latestV1.HelmRelease{{
Name: "skaffold-helm-remote",
ChartPath: "stable/chartmuseum",
SkipBuildDependencies: false,
Name: "skaffold-helm-remote",
RemoteChart: "stable/chartmuseum",
Repo: "https://charts.helm.sh/stable",
}},
}

var testDeployRemoteChartVersion = latestV1.HelmDeploy{
Releases: []latestV1.HelmRelease{{
Name: "skaffold-helm-remote",
RemoteChart: "stable/chartmuseum",
Version: "1.0.0",
Repo: "https://charts.helm.sh/stable",
}},
}

Expand Down Expand Up @@ -491,7 +500,6 @@ func TestHelmDeploy(t *testing.T) {
expectedWarnings []string
expectedNamespaces []string
}{

{
description: "helm3.0beta deploy success",
commands: testutil.
Expand Down Expand Up @@ -693,13 +701,30 @@ func TestHelmDeploy(t *testing.T) {
helm: testDeployUpgradeOnChange,
},
{
description: "deploy error remote chart without skipBuildDependencies",
description: "deploy remote chart",
commands: testutil.
CmdRunWithOutput("helm version --client", version31).
AndRunErr("helm --kube-context kubecontext get all skaffold-helm-remote --kubeconfig kubeconfig", fmt.Errorf("Error: release: not found")).
AndRun("helm --kube-context kubecontext install skaffold-helm-remote stable/chartmuseum --repo https://charts.helm.sh/stable --kubeconfig kubeconfig").
AndRun("helm --kube-context kubecontext get all skaffold-helm-remote --template {{.Release.Manifest}} --kubeconfig kubeconfig"),
helm: testDeployRemoteChart,
},
{
description: "deploy remote chart with version",
commands: testutil.
CmdRunWithOutput("helm version --client", version31).
AndRun("helm --kube-context kubecontext get all skaffold-helm-remote --kubeconfig kubeconfig").
AndRunErr("helm --kube-context kubecontext dep build stable/chartmuseum --kubeconfig kubeconfig", fmt.Errorf("building helm dependencies")),
AndRunErr("helm --kube-context kubecontext get all skaffold-helm-remote --kubeconfig kubeconfig", fmt.Errorf("Error: release: not found")).
AndRun("helm --kube-context kubecontext install skaffold-helm-remote --version 1.0.0 stable/chartmuseum --repo https://charts.helm.sh/stable --kubeconfig kubeconfig").
AndRun("helm --kube-context kubecontext get all skaffold-helm-remote --template {{.Release.Manifest}} --kubeconfig kubeconfig"),
helm: testDeployRemoteChartVersion,
},
{
description: "deploy error with remote chart",
commands: testutil.
CmdRunWithOutput("helm version --client", version31).
AndRunErr("helm --kube-context kubecontext get all skaffold-helm-remote --kubeconfig kubeconfig", fmt.Errorf("Error: release: not found")).
AndRunErr("helm --kube-context kubecontext install skaffold-helm-remote stable/chartmuseum --repo https://charts.helm.sh/stable --kubeconfig kubeconfig", fmt.Errorf("building helm dependencies")),
helm: testDeployRemoteChart,
builds: testBuilds,
shouldErr: true,
},
{
Expand Down

0 comments on commit e8803ad

Please sign in to comment.