Skip to content

Commit 0a48f8b

Browse files
committed
AppWrapper e2e: Remove creationTimestamp from marshalled template
1 parent 97a2239 commit 0a48f8b

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

test/e2e/mnist_pytorch_appwrapper_test.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ limitations under the License.
1717
package e2e
1818

1919
import (
20+
"encoding/json"
21+
"strings"
2022
"testing"
2123

2224
. "github.com/onsi/gomega"
@@ -145,6 +147,10 @@ func runMnistPyTorchAppWrapper(t *testing.T, accelerator string, numberOfGpus in
145147
},
146148
}
147149

150+
raw, _ := json.Marshal(job)
151+
// Workaround to remove creationTimestamp which is brought by json marshaller, this field breaks Kueue reconciliation
152+
patchedRaw := strings.ReplaceAll(string(raw), `"metadata":{"creationTimestamp":null},`, "")
153+
148154
// Create an AppWrapper resource
149155
aw := &mcadv1beta2.AppWrapper{
150156
TypeMeta: metav1.TypeMeta{
@@ -159,7 +165,7 @@ func runMnistPyTorchAppWrapper(t *testing.T, accelerator string, numberOfGpus in
159165
Spec: mcadv1beta2.AppWrapperSpec{
160166
Components: []mcadv1beta2.AppWrapperComponent{
161167
{
162-
Template: Raw(test, job),
168+
Template: runtime.RawExtension{Raw: []byte(patchedRaw)},
163169
},
164170
},
165171
},

test/e2e/mnist_rayjob_raycluster_test.go

+8-1
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@ package e2e
1818

1919
import (
2020
"crypto/tls"
21+
"encoding/json"
2122
"fmt"
2223
"net/http"
2324
"net/url"
25+
"strings"
2426
"testing"
2527

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

136138
// Create RayCluster, wrap in AppWrapper and assign to localqueue
137139
rayCluster := constructRayCluster(test, namespace, mnist, numberOfGpus)
140+
141+
raw, _ := json.Marshal(rayCluster)
142+
// Workaround to remove creationTimestamp which is brought by json marshaller, this field breaks Kueue reconciliation
143+
patchedRaw := strings.ReplaceAll(string(raw), `"metadata":{"creationTimestamp":null},`, "")
144+
138145
aw := &mcadv1beta2.AppWrapper{
139146
TypeMeta: metav1.TypeMeta{
140147
APIVersion: mcadv1beta2.GroupVersion.String(),
@@ -148,7 +155,7 @@ func runMnistRayJobRayClusterAppWrapper(t *testing.T, accelerator string, number
148155
Spec: mcadv1beta2.AppWrapperSpec{
149156
Components: []mcadv1beta2.AppWrapperComponent{
150157
{
151-
Template: Raw(test, rayCluster),
158+
Template: runtime.RawExtension{Raw: []byte(patchedRaw)},
152159
},
153160
},
154161
},

0 commit comments

Comments
 (0)