Skip to content

Commit 4f1f5d4

Browse files
authored
fix: repair jwt e2e setup and worker test sync (#15)
1 parent 5577608 commit 4f1f5d4

4 files changed

Lines changed: 33 additions & 8 deletions

File tree

cmd/ateapi/internal/controlapi/functional_test.go

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ type testContext struct {
236236
k8sClient kubernetes.Interface
237237
substrateClient versioned.Interface
238238
persistence *ateredis.Persistence
239+
workerCache *workercache.Cache
239240
fakeAtelet *FakeAteletServer
240241
cleanup func()
241242
actorTemplateLister listersv1alpha1.ActorTemplateLister
@@ -368,6 +369,7 @@ func setupTest(t *testing.T, ns string) *testContext {
368369
k8sClient: k8sClient,
369370
substrateClient: substrateClient,
370371
persistence: persistence,
372+
workerCache: wc,
371373
fakeAtelet: fakeAtelet,
372374
cleanup: cleanup,
373375
actorTemplateLister: actorTemplateLister,
@@ -582,13 +584,13 @@ func createWorkerPod(t *testing.T, tc *testContext, ns string, name string, node
582584
t.Fatalf("failed to update worker pod status: %v", err)
583585
}
584586

585-
// Wait for worker to be registered via API
587+
// Wait for worker to be visible to the scheduler.
586588
err = wait.PollUntilContextTimeout(context.Background(), 100*time.Millisecond, 5*time.Second, true, func(ctx context.Context) (bool, error) {
587-
resp, err := tc.client.ListWorkers(ctx, &ateapipb.ListWorkersRequest{})
589+
workers, err := tc.workerCache.Workers()
588590
if err != nil {
589-
return false, nil // Retry on API error
591+
return false, nil
590592
}
591-
for _, w := range resp.GetWorkers() {
593+
for _, w := range workers {
592594
if w.GetWorkerNamespace() == ns && w.GetWorkerPod() == name {
593595
return true, nil
594596
}
@@ -607,13 +609,13 @@ func deleteWorkerPod(t *testing.T, tc *testContext, ns string, name string) {
607609
t.Fatalf("failed to delete worker pod %s: %v", name, err)
608610
}
609611

610-
// Wait for worker to be removed from API
612+
// Wait for worker to be removed from the scheduler.
611613
err = wait.PollUntilContextTimeout(context.Background(), 100*time.Millisecond, 5*time.Second, true, func(ctx context.Context) (bool, error) {
612-
resp, err := tc.client.ListWorkers(ctx, &ateapipb.ListWorkersRequest{})
614+
workers, err := tc.workerCache.Workers()
613615
if err != nil {
614-
return false, nil // Retry on API error
616+
return false, nil
615617
}
616-
for _, w := range resp.GetWorkers() {
618+
for _, w := range workers {
617619
if w.GetWorkerNamespace() == ns && w.GetWorkerPod() == name {
618620
return false, nil // Still there
619621
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Copyright 2026 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
apiVersion: v1
16+
kind: ServiceAccount
17+
metadata:
18+
name: ate-client
19+
namespace: ate-system
20+
labels:
21+
apps: ate-client

manifests/ate-install/jwt/kustomization.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ apiVersion: kustomize.config.k8s.io/v1beta1
1616
kind: Kustomization
1717

1818
resources:
19+
- ../ate-client.yaml
1920
- ../ate-api-server.yaml
2021
- ../ate-controller.yaml
2122
- ../atelet.yaml

manifests/ate-install/kind-jwt/kustomization.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ apiVersion: kustomize.config.k8s.io/v1beta1
1616
kind: Kustomization
1717

1818
resources:
19+
- ../ate-client.yaml
1920
- ../kind
2021

2122
patches:

0 commit comments

Comments
 (0)