This is an automated email from the ASF dual-hosted git repository.

lahirujayathilake pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airavata-custos.git


The following commit(s) were added to refs/heads/master by this push:
     new b154d7239 Reconcile only this cluster's associations (#725)
b154d7239 is described below

commit b154d723982f3f5d224d76e3685428042b492e56
Author: Yasith Jayawardana <[email protected]>
AuthorDate: Sun Nov 8 14:12:49 2026 -0500

    Reconcile only this cluster's associations (#725)
---
 .../internal/subscribers/members_test.go           | 29 ++++++++++++++++++++++
 .../internal/subscribers/reconciler.go             |  3 ++-
 2 files changed, 31 insertions(+), 1 deletion(-)

diff --git 
a/connectors/SLURM/Association-Mapper/internal/subscribers/members_test.go 
b/connectors/SLURM/Association-Mapper/internal/subscribers/members_test.go
index acbaf3364..c293b766c 100644
--- a/connectors/SLURM/Association-Mapper/internal/subscribers/members_test.go
+++ b/connectors/SLURM/Association-Mapper/internal/subscribers/members_test.go
@@ -422,6 +422,35 @@ func 
TestReconcilerSkipsMembershipsOnUnprovisionedClusters(t *testing.T) {
        }
 }
 
+// Another cluster's memberships are not written here.
+func TestReconcilerLeavesOtherClustersAssociations(t *testing.T) {
+       elsewhere := models.ComputeAllocationMembership{
+               ID: "mem-2", ComputeAllocationID: "alloc-2", UserID: "user-1", 
MembershipStatus: models.ACTIVE,
+       }
+       core := coreMock(mockOpts{
+               provisionedAt: ago(time.Minute),
+               memberships:   []models.ComputeAllocationMembership{elsewhere},
+       })
+       getAllocation, getCluster := core.GetComputeAllocationFunc, 
core.GetComputeClusterFunc
+       core.GetComputeAllocationFunc = func(ctx context.Context, id string) 
(*models.ComputeAllocation, error) {
+               alloc, err := getAllocation(ctx, id)
+               alloc.ComputeClusterID = "cluster-2"
+               return alloc, err
+       }
+       core.GetComputeClusterFunc = func(ctx context.Context, id string) 
(*models.ComputeCluster, error) {
+               if id == "cluster-2" {
+                       return &models.ComputeCluster{ID: id, Name: 
"othercluster"}, nil
+               }
+               return getCluster(ctx, id)
+       }
+       slurm := &fakeSlurmClient{}
+       NewAssociationSubscriber(slurm, nil, core, 0, 
0).reconcile(context.Background())
+
+       if got := slurm.all(); len(got) != 0 {
+               t.Fatalf("expected no write for another cluster, got %+v", got)
+       }
+}
+
 func TestReconcilerSkipsUnprovisionedAndTooFreshAccounts(t *testing.T) {
        cases := map[string]*time.Time{
                "never provisioned": nil,
diff --git 
a/connectors/SLURM/Association-Mapper/internal/subscribers/reconciler.go 
b/connectors/SLURM/Association-Mapper/internal/subscribers/reconciler.go
index 99baaf55b..145e19c40 100644
--- a/connectors/SLURM/Association-Mapper/internal/subscribers/reconciler.go
+++ b/connectors/SLURM/Association-Mapper/internal/subscribers/reconciler.go
@@ -137,7 +137,8 @@ func (a *AssociationSubscriber) reconcileCluster(ctx 
context.Context, cluster mo
                                        "membership_id", membership.ID, 
"error", err)
                                return
                        }
-                       if record == nil {
+                       // Memberships span clusters; each cluster's pass 
writes and prunes its own.
+                       if record == nil || record.Cluster != cluster.Name {
                                continue
                        }
                        desired[keyOf(*record)] = struct{}{}

Reply via email to