forked from envoyproxy/gateway
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: enable upgrade test (envoyproxy#3764)
adapt upgrade test to v1.1 Signed-off-by: Guy Daich <guy.daich@sap.com> Co-authored-by: zirain <zirain2009@gmail.com>
- Loading branch information
Showing
9 changed files
with
501 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
// Copyright Envoy Gateway Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// The full text of the Apache license is available in the LICENSE file at | ||
// the root of the repo. | ||
|
||
package helm | ||
|
||
import ( | ||
"testing" | ||
"time" | ||
|
||
"helm.sh/helm/v3/pkg/action" | ||
"helm.sh/helm/v3/pkg/cli" | ||
"helm.sh/helm/v3/pkg/cli/values" | ||
) | ||
|
||
func TestPackageTool_Setup(t *testing.T) { | ||
type fields struct { | ||
chartName string | ||
envSettings *cli.EnvSettings | ||
actionConfig *action.Configuration | ||
actionInstall *action.Install | ||
actionUninstall *action.Uninstall | ||
valuesOpts *values.Options | ||
logger Printer | ||
} | ||
tests := []struct { | ||
name string | ||
fields fields | ||
wantErr bool | ||
}{ | ||
{ | ||
name: "shouldSetup", | ||
fields: fields{ | ||
chartName: "mychart", | ||
}, | ||
wantErr: false, | ||
}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
pt := &PackageTool{ | ||
chartName: tt.fields.chartName, | ||
envSettings: tt.fields.envSettings, | ||
actionConfig: tt.fields.actionConfig, | ||
actionInstall: tt.fields.actionInstall, | ||
actionUninstall: tt.fields.actionUninstall, | ||
valuesOpts: tt.fields.valuesOpts, | ||
logger: tt.fields.logger, | ||
} | ||
if err := pt.Setup(); (err != nil) != tt.wantErr { | ||
t.Errorf("Setup() error = %v, wantErr %v", err, tt.wantErr) | ||
} | ||
}) | ||
} | ||
} | ||
|
||
func TestPackageTool_setInstallOptions(t *testing.T) { | ||
type fields struct { | ||
chartName string | ||
envSettings *cli.EnvSettings | ||
actionConfig *action.Configuration | ||
actionInstall *action.Install | ||
actionUninstall *action.Uninstall | ||
valuesOpts *values.Options | ||
logger Printer | ||
} | ||
type args struct { | ||
opts *PackageOptions | ||
} | ||
tests := []struct { | ||
name string | ||
fields fields | ||
args args | ||
}{ | ||
{ | ||
name: "shouldSetInstallOptions", | ||
fields: fields{ | ||
chartName: "mychart", | ||
}, | ||
args: args{ | ||
opts: &PackageOptions{ | ||
Version: "1.0.2", | ||
Timeout: 1 * time.Second, | ||
}, | ||
}, | ||
}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
pt := &PackageTool{ | ||
chartName: tt.fields.chartName, | ||
envSettings: tt.fields.envSettings, | ||
actionConfig: tt.fields.actionConfig, | ||
actionInstall: tt.fields.actionInstall, | ||
actionUninstall: tt.fields.actionUninstall, | ||
valuesOpts: tt.fields.valuesOpts, | ||
logger: tt.fields.logger, | ||
} | ||
if err := pt.Setup(); err != nil { | ||
t.Errorf("Setup() error = %v", err) | ||
} | ||
pt.setInstallOptions(tt.args.opts) | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.