-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
252 additions
and
16 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
// SPDX-FileCopyrightText: 2022 SAP SE or an SAP affiliate company and Gardener contributors. | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
//go:build e2e | ||
|
||
package e2e | ||
|
||
import ( | ||
"os" | ||
"path/filepath" | ||
"testing" | ||
|
||
"github.com/open-component-model/ocm-e2e-framework/shared" | ||
"github.com/stretchr/testify/require" | ||
"sigs.k8s.io/e2e-framework/pkg/features" | ||
|
||
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta2" | ||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" | ||
"github.com/open-component-model/ocm-controller/api/v1alpha1" | ||
"github.com/open-component-model/ocm-e2e-framework/shared/steps/setup" | ||
) | ||
|
||
func TestHelmChartResource(t *testing.T) { | ||
t.Log("running e2e helm chart test") | ||
|
||
charts, err := os.ReadFile(filepath.Join("testdata", testHelmChartBasedResource, "podinfo-6.3.5.tgz")) | ||
require.NoError(t, err) | ||
|
||
setupComponent := features.New("Add components to component-version"). | ||
Setup(setup.AddComponentVersions(setup.Component{ | ||
Component: shared.Component{ | ||
Name: "github.com/open-component-model/helm-test", | ||
Version: "1.0.0", | ||
}, | ||
ComponentVersionModifications: []shared.ComponentModification{ | ||
shared.BlobResource(shared.Resource{ | ||
Name: "charts", | ||
Data: string(charts), | ||
Type: "helmChart", | ||
Version: "6.3.5", | ||
}), | ||
}, | ||
})) | ||
|
||
management := features.New("Configure Management Repository"). | ||
Setup(setup.AddScheme(v1alpha1.AddToScheme)). | ||
Setup(setup.AddScheme(sourcev1.AddToScheme)). | ||
Setup(setup.AddScheme(kustomizev1.AddToScheme)). | ||
Setup(setup.AddGitRepository(testRepoName)). | ||
Setup(setup.AddFluxSyncForRepo(testRepoName, destinationPrefix, ocmNamespace)) | ||
|
||
componentVersion := features.New("Create Manifests"). | ||
Setup(setup.AddFilesToGitRepository(getHelmManifests(testHelmChartBasedResource, testRepoName)...)). | ||
Assess("check that component version is ready and valid", checkIsComponentVersionReady("ocm-with-helm", ocmNamespace)) | ||
|
||
validationDeploymentBackend := checkDeploymentReadiness("fluxdeployer-podinfo-pipeline-backend", "ghcr.io/stefanprodan/podinfo") | ||
|
||
testEnv.Test(t, | ||
setupComponent.Feature(), | ||
management.Feature(), | ||
componentVersion.Feature(), | ||
validationDeploymentBackend.Feature(), | ||
) | ||
} | ||
|
||
func getHelmManifests(testName string, gitRepositoryName string) []setup.File { | ||
cvManifest := setup.File{ | ||
RepoName: gitRepositoryName, | ||
SourceFilepath: filepath.Join(testName, cvFile), | ||
DestFilepath: destinationPrefix + testName + cvFile, | ||
} | ||
resourceManifest := setup.File{ | ||
RepoName: gitRepositoryName, | ||
SourceFilepath: filepath.Join(testName, resourceFile), | ||
DestFilepath: destinationPrefix + testName + resourceFile, | ||
} | ||
deployerManifestBackend := setup.File{ | ||
RepoName: gitRepositoryName, | ||
SourceFilepath: filepath.Join(testName, deployerFile), | ||
DestFilepath: destinationPrefix + deployerFile, | ||
} | ||
|
||
return []setup.File{ | ||
cvManifest, | ||
resourceManifest, | ||
deployerManifestBackend, | ||
} | ||
} |
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,14 @@ | ||
apiVersion: delivery.ocm.software/v1alpha1 | ||
kind: ComponentVersion | ||
metadata: | ||
name: ocm-with-helm | ||
namespace: ocm-system | ||
spec: | ||
interval: 10m0s | ||
component: github.com/skarlso/podinfo-helm | ||
version: | ||
semver: 1.0.0 | ||
repository: | ||
url: ghcr.io/skarlso | ||
secretRef: | ||
name: creds |
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,17 @@ | ||
apiVersion: delivery.ocm.software/v1alpha1 | ||
kind: FluxDeployer | ||
metadata: | ||
name: fluxdeployer-podinfo-pipeline-backend | ||
namespace: ocm-system | ||
spec: | ||
interval: 1m0s | ||
sourceRef: | ||
kind: Resource | ||
name: ocm-with-helm-deployment | ||
helmReleaseTemplate: | ||
chart: | ||
spec: | ||
chart: podinfo | ||
version: 6.3.5 | ||
interval: 5m | ||
|
Binary file not shown.
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,16 @@ | ||
apiVersion: delivery.ocm.software/v1alpha1 | ||
kind: Resource | ||
metadata: | ||
name: ocm-with-helm-deployment | ||
namespace: ocm-system | ||
spec: | ||
interval: 10m | ||
sourceRef: | ||
kind: ComponentVersion | ||
name: ocm-with-helm | ||
namespace: ocm-system | ||
resourceRef: | ||
name: charts | ||
version: 6.3.5 | ||
extraIdentity: | ||
helmChart: podinfo |
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
Binary file not shown.