Skip to content
This repository has been archived by the owner on Jul 11, 2023. It is now read-only.

Commit

Permalink
e2e: Move helm related functions into helm.go (#3669)
Browse files Browse the repository at this point in the history
Signed-off-by: Delyan Raychev <[email protected]>
  • Loading branch information
draychev authored Jun 28, 2021
1 parent 1864ce2 commit 3f4c9f5
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 29 deletions.
29 changes: 0 additions & 29 deletions tests/framework/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -458,35 +458,6 @@ func (td *OsmTestData) GetOSMInstallOpts() InstallOSMOpts {
}
}

// HelmInstallOSM installs an osm control plane using the osm chart which lives in charts/osm
func (td *OsmTestData) HelmInstallOSM(release, namespace string) error {
if td.InstType == KindCluster {
if err := td.LoadOSMImagesIntoKind(); err != nil {
return err
}
}

values := fmt.Sprintf("OpenServiceMesh.image.registry=%s,OpenServiceMesh.image.tag=%s,OpenServiceMesh.meshName=%s", td.CtrRegistryServer, td.OsmImageTag, release)
args := []string{"install", release, "../../charts/osm", "--set", values, "--namespace", namespace, "--create-namespace", "--wait"}
stdout, stderr, err := td.RunLocal("helm", args)
if err != nil {
td.T.Logf("stdout:\n%s", stdout)
return errors.Errorf("failed to run helm install with osm chart: %s", stderr)
}

return nil
}

// DeleteHelmRelease uninstalls a particular helm release
func (td *OsmTestData) DeleteHelmRelease(name, namespace string) error {
args := []string{"uninstall", name, "--namespace", namespace}
_, _, err := td.RunLocal("helm", args)
if err != nil {
td.T.Fatal(err)
}
return nil
}

// LoadImagesToKind loads the list of images to the node for Kind clusters
func (td *OsmTestData) LoadImagesToKind(imageNames []string) error {
if td.InstType != KindCluster {
Expand Down
36 changes: 36 additions & 0 deletions tests/framework/helm.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package framework

import (
"fmt"

"github.com/pkg/errors"
)

// HelmInstallOSM installs an osm control plane using the osm chart which lives in charts/osm
func (td *OsmTestData) HelmInstallOSM(release, namespace string) error {
if td.InstType == KindCluster {
if err := td.LoadOSMImagesIntoKind(); err != nil {
return err
}
}

values := fmt.Sprintf("OpenServiceMesh.image.registry=%s,OpenServiceMesh.image.tag=%s,OpenServiceMesh.meshName=%s", td.CtrRegistryServer, td.OsmImageTag, release)
args := []string{"install", release, "../../charts/osm", "--set", values, "--namespace", namespace, "--create-namespace", "--wait"}
stdout, stderr, err := td.RunLocal("helm", args)
if err != nil {
td.T.Logf("stdout:\n%s", stdout)
return errors.Errorf("failed to run helm install with osm chart: %s", stderr)
}

return nil
}

// DeleteHelmRelease uninstalls a particular helm release
func (td *OsmTestData) DeleteHelmRelease(name, namespace string) error {
args := []string{"uninstall", name, "--namespace", namespace}
_, _, err := td.RunLocal("helm", args)
if err != nil {
td.T.Fatal(err)
}
return nil
}

0 comments on commit 3f4c9f5

Please sign in to comment.