You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by la...@apache.org on 2026/10/16 13:18:41 UTC
(airavata-custos) branch amie-alloc-fixes created (now 958bf4bc3)
This is an automated email from the ASF dual-hosted git repository.
lahirujayathilake pushed a change to branch amie-alloc-fixes
in repository https://gitbox.apache.org/repos/asf/airavata-custos.git
at 958bf4bc3 Get the allocation start and end dates for compute allocation memberships
This branch includes the following new commits:
new 958bf4bc3 Get the allocation start and end dates for compute allocation memberships
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(airavata-custos) 01/01: Get the allocation start and end dates for compute allocation memberships
Posted by la...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
lahirujayathilake pushed a commit to branch amie-alloc-fixes
in repository https://gitbox.apache.org/repos/asf/airavata-custos.git
commit 958bf4bc372cb078894e83bb30d050d38eb59f6c
Author: lahiruj <la...@gmail.com>
AuthorDate: Fri Oct 16 09:18:29 2026 -0400
Get the allocation start and end dates for compute allocation memberships
---
.../handler/request_account_create.go | 2 ++
.../request_account_create_integration_test.go | 30 ++++++++++++++--------
2 files changed, 22 insertions(+), 10 deletions(-)
diff --git a/connectors/ACCESS/AMIE-Processor/handler/request_account_create.go b/connectors/ACCESS/AMIE-Processor/handler/request_account_create.go
index 56f1d2672..ce5be406f 100644
--- a/connectors/ACCESS/AMIE-Processor/handler/request_account_create.go
+++ b/connectors/ACCESS/AMIE-Processor/handler/request_account_create.go
@@ -209,6 +209,8 @@ func (h *RequestAccountCreateHandler) ensureMembership(ctx context.Context, allo
return h.svc.CreateComputeAllocationMembership(ctx, &models.ComputeAllocationMembership{
ComputeAllocationID: allocation.ID,
UserID: userID,
+ StartTime: allocation.StartTime,
+ EndTime: allocation.EndTime,
})
}
diff --git a/connectors/ACCESS/AMIE-Processor/handler/request_account_create_integration_test.go b/connectors/ACCESS/AMIE-Processor/handler/request_account_create_integration_test.go
index e060ed448..9e201b200 100644
--- a/connectors/ACCESS/AMIE-Processor/handler/request_account_create_integration_test.go
+++ b/connectors/ACCESS/AMIE-Processor/handler/request_account_create_integration_test.go
@@ -24,6 +24,7 @@ import (
"database/sql"
"errors"
"testing"
+ "time"
"github.com/google/uuid"
"github.com/jmoiron/sqlx"
@@ -190,25 +191,34 @@ func TestRequestAccountCreate_HappyPath(t *testing.T) {
}
// Membership row links the account user to the project's existing
- // allocation.
+ // allocation and carries the allocation's start and end times.
var mem struct {
- UserID string `db:"user_id"`
- ComputeAllocationID string `db:"compute_allocation_id"`
+ UserID string `db:"user_id"`
+ ComputeAllocationID string `db:"compute_allocation_id"`
+ StartTime time.Time `db:"start_time"`
+ EndTime time.Time `db:"end_time"`
}
if err := database.Get(&mem,
- "SELECT user_id, compute_allocation_id FROM compute_allocation_memberships WHERE user_id = $1",
+ "SELECT user_id, compute_allocation_id, start_time, end_time FROM compute_allocation_memberships WHERE user_id = $1",
user.ID,
); err != nil {
t.Fatalf("read membership: %v", err)
}
- var allocID string
- if err := database.Get(&allocID,
- "SELECT id FROM compute_allocations WHERE project_id = $1 LIMIT 1", projectID,
+ var alloc struct {
+ ID string `db:"id"`
+ StartTime time.Time `db:"start_time"`
+ EndTime time.Time `db:"end_time"`
+ }
+ if err := database.Get(&alloc,
+ "SELECT id, start_time, end_time FROM compute_allocations WHERE project_id = $1 LIMIT 1", projectID,
); err != nil {
- t.Fatalf("read allocation id: %v", err)
+ t.Fatalf("read allocation: %v", err)
+ }
+ if mem.ComputeAllocationID != alloc.ID {
+ t.Errorf("membership.compute_allocation_id: got %q, want %q", mem.ComputeAllocationID, alloc.ID)
}
- if mem.ComputeAllocationID != allocID {
- t.Errorf("membership.compute_allocation_id: got %q, want %q", mem.ComputeAllocationID, allocID)
+ if mem.StartTime.IsZero() || !mem.StartTime.Equal(alloc.StartTime) || !mem.EndTime.Equal(alloc.EndTime) {
+ t.Errorf("membership times: got %s to %s, want the allocation's %s to %s", mem.StartTime, mem.EndTime, alloc.StartTime, alloc.EndTime)
}
// Audit trail for this packet: CREATE_PERSON, CREATE_ACCOUNT,