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 97a2239 commit 0a48f8b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
8 changes: 7 additions & 1 deletion test/e2e/mnist_pytorch_appwrapper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ limitations under the License.
package e2e

import (
"encoding/json"
"strings"
"testing"

. "github.com/onsi/gomega"
Expand Down Expand Up @@ -145,6 +147,10 @@ func runMnistPyTorchAppWrapper(t *testing.T, accelerator string, numberOfGpus in
},
}

raw, _ := json.Marshal(job)
// Workaround to remove creationTimestamp which is brought by json marshaller, this field breaks Kueue reconciliation
patchedRaw := strings.ReplaceAll(string(raw), `"metadata":{"creationTimestamp":null},`, "")

// Create an AppWrapper resource
aw := &mcadv1beta2.AppWrapper{
TypeMeta: metav1.TypeMeta{
Expand All @@ -159,7 +165,7 @@ func runMnistPyTorchAppWrapper(t *testing.T, accelerator string, numberOfGpus in
Spec: mcadv1beta2.AppWrapperSpec{
Components: []mcadv1beta2.AppWrapperComponent{
{
Template: Raw(test, job),
Template: runtime.RawExtension{Raw: []byte(patchedRaw)},
},
},
},
Expand Down
9 changes: 8 additions & 1 deletion test/e2e/mnist_rayjob_raycluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ package e2e

import (
"crypto/tls"
"encoding/json"
"fmt"
"net/http"
"net/url"
"strings"
"testing"

. "github.com/onsi/gomega"
Expand Down Expand Up @@ -135,6 +137,11 @@ func runMnistRayJobRayClusterAppWrapper(t *testing.T, accelerator string, number

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

raw, _ := json.Marshal(rayCluster)
// Workaround to remove creationTimestamp which is brought by json marshaller, this field breaks Kueue reconciliation
patchedRaw := strings.ReplaceAll(string(raw), `"metadata":{"creationTimestamp":null},`, "")

aw := &mcadv1beta2.AppWrapper{
TypeMeta: metav1.TypeMeta{
APIVersion: mcadv1beta2.GroupVersion.String(),
Expand All @@ -148,7 +155,7 @@ func runMnistRayJobRayClusterAppWrapper(t *testing.T, accelerator string, number
Spec: mcadv1beta2.AppWrapperSpec{
Components: []mcadv1beta2.AppWrapperComponent{
{
Template: Raw(test, rayCluster),
Template: runtime.RawExtension{Raw: []byte(patchedRaw)},
},
},
},
Expand Down

0 comments on commit 0a48f8b

Please sign in to comment.