Skip to content

Commit

Permalink
AppWrapper e2e: Remove creationTimestamp from marshalled template
Browse files Browse the repository at this point in the history
  • Loading branch information
sutaakar authored and openshift-merge-bot[bot] committed Nov 20, 2024
1 parent 1fda820 commit cb032ef
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
5 changes: 4 additions & 1 deletion test/e2e/mnist_pytorch_appwrapper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ func runMnistPyTorchAppWrapper(t *testing.T, accelerator string, numberOfGpus in
},
}

raw := Raw(test, job)
raw = RemoveCreationTimestamp(test, raw)

// Create an AppWrapper resource
aw := &mcadv1beta2.AppWrapper{
TypeMeta: metav1.TypeMeta{
Expand All @@ -159,7 +162,7 @@ func runMnistPyTorchAppWrapper(t *testing.T, accelerator string, numberOfGpus in
Spec: mcadv1beta2.AppWrapperSpec{
Components: []mcadv1beta2.AppWrapperComponent{
{
Template: Raw(test, job),
Template: raw,
},
},
},
Expand Down
5 changes: 4 additions & 1 deletion test/e2e/mnist_rayjob_raycluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ func runMnistRayJobRayClusterAppWrapper(t *testing.T, accelerator string, number

// Create RayCluster, wrap in AppWrapper and assign to localqueue
rayCluster := constructRayCluster(test, namespace, mnist, numberOfGpus)
raw := Raw(test, rayCluster)
raw = RemoveCreationTimestamp(test, raw)

aw := &mcadv1beta2.AppWrapper{
TypeMeta: metav1.TypeMeta{
APIVersion: mcadv1beta2.GroupVersion.String(),
Expand All @@ -148,7 +151,7 @@ func runMnistRayJobRayClusterAppWrapper(t *testing.T, accelerator string, number
Spec: mcadv1beta2.AppWrapperSpec{
Components: []mcadv1beta2.AppWrapperComponent{
{
Template: Raw(test, rayCluster),
Template: raw,
},
},
},
Expand Down
11 changes: 11 additions & 0 deletions test/e2e/support.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@ package e2e

import (
"embed"
"strings"

"github.com/onsi/gomega"
"github.com/project-codeflare/codeflare-common/support"

"k8s.io/apimachinery/pkg/runtime"
)

//go:embed *.py *.txt *.sh
Expand All @@ -32,3 +35,11 @@ func ReadFile(t support.Test, fileName string) []byte {
t.Expect(err).NotTo(gomega.HaveOccurred())
return file
}

func RemoveCreationTimestamp(t support.Test, rawExtension runtime.RawExtension) runtime.RawExtension {
t.T().Helper()
patchedRaw := strings.ReplaceAll(string(rawExtension.Raw), `"metadata":{"creationTimestamp":null},`, "")
return runtime.RawExtension{
Raw: []byte(patchedRaw),
}
}

0 comments on commit cb032ef

Please sign in to comment.