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 committed Nov 19, 2024
1 parent 1fda820 commit 498c2bf
Show file tree
Hide file tree
Showing 3 changed files with 18 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
10 changes: 10 additions & 0 deletions test/e2e/support.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ 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 +34,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 498c2bf

Please sign in to comment.