refactor: migrate eventsourced to codeberg and go-messaging-amqp (#949)
Unbound Release / Check Preconditions (push) Successful in 34s
Unbound Release / Create Release (push) Skipped
schemas / vulnerabilities (push) Successful in 1m9s
schemas / check-release (push) Successful in 57s
Unbound Release / Generate Changelog and Handle PR (push) Successful in 39s
Unbound Release / Create Tag (push) Successful in 33s
Release / release (push) Successful in 1m25s
schemas / check (push) Successful in 1m34s
pre-commit / pre-commit (push) Successful in 3m17s
schemas / build (push) Successful in 6m34s
schemas / deploy-prod (push) Successful in 1m11s
Unbound Release / Check Preconditions (push) Successful in 34s
Unbound Release / Create Release (push) Skipped
schemas / vulnerabilities (push) Successful in 1m9s
schemas / check-release (push) Successful in 57s
Unbound Release / Generate Changelog and Handle PR (push) Successful in 39s
Unbound Release / Create Tag (push) Successful in 33s
Release / release (push) Successful in 1m25s
schemas / check (push) Successful in 1m34s
pre-commit / pre-commit (push) Successful in 3m17s
schemas / build (push) Successful in 6m34s
schemas / deploy-prod (push) Successful in 1m11s
This commit was merged in pull request #949.
This commit is contained in:
1 parent
d38f599974
commit
84b18860b5
18 files changed
+221
-73
No files matched your search
Vendored
+3
-4
@@ -6,8 +6,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/sparetimecoders/goamqp"
|
||||
"gitlab.com/unboundsoftware/eventsourced/eventsourced"
|
||||
"codeberg.org/eventsourced/eventsourced"
|
||||
|
||||
"gitea.unbound.se/unboundsoftware/schemas/domain"
|
||||
"gitea.unbound.se/unboundsoftware/schemas/graph/model"
|
||||
@@ -133,7 +132,7 @@ func (c *Cache) SubGraphId(orgId, ref, service string) string {
|
||||
return c.subGraphs[subGraphKey(orgId, ref, service)]
|
||||
}
|
||||
|
||||
func (c *Cache) Update(msg any, _ goamqp.Headers) (any, error) {
|
||||
func (c *Cache) Update(msg any) error {
|
||||
c.mu.Lock()
|
||||
defer c.mu.Unlock()
|
||||
|
||||
@@ -250,7 +249,7 @@ func (c *Cache) Update(msg any, _ goamqp.Headers) (any, error) {
|
||||
default:
|
||||
c.logger.With("msg", msg).Warn("unexpected message received")
|
||||
}
|
||||
return nil, nil
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Cache) updateSubGraph(orgId string, ref string, subGraphId string, service string, updated time.Time) {
|
||||
|
||||
Vendored
+10
-10
@@ -7,10 +7,10 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"codeberg.org/eventsourced/eventsourced"
|
||||
"github.com/google/uuid"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"gitlab.com/unboundsoftware/eventsourced/eventsourced"
|
||||
|
||||
"gitea.unbound.se/unboundsoftware/schemas/domain"
|
||||
"gitea.unbound.se/unboundsoftware/schemas/hash"
|
||||
@@ -208,7 +208,7 @@ func TestCache_Update_OrganizationAdded(t *testing.T) {
|
||||
}
|
||||
event.ID = *eventsourced.IdFromString(orgID)
|
||||
|
||||
_, err := c.Update(event, nil)
|
||||
err := c.Update(event)
|
||||
require.NoError(t, err)
|
||||
|
||||
// Verify organization was added
|
||||
@@ -247,7 +247,7 @@ func TestCache_Update_APIKeyAdded(t *testing.T) {
|
||||
}
|
||||
event.ID = *eventsourced.IdFromString(uuid.New().String())
|
||||
|
||||
_, err := c.Update(event, nil)
|
||||
err := c.Update(event)
|
||||
require.NoError(t, err)
|
||||
|
||||
// Verify API key was added to cache
|
||||
@@ -281,7 +281,7 @@ func TestCache_Update_SubGraphUpdated(t *testing.T) {
|
||||
event.ID = *eventsourced.IdFromString(subGraphID)
|
||||
event.SetWhen(time.Now())
|
||||
|
||||
_, err := c.Update(event, nil)
|
||||
err := c.Update(event)
|
||||
require.NoError(t, err)
|
||||
|
||||
// Verify subgraph was added to services
|
||||
@@ -366,7 +366,7 @@ func TestCache_ConcurrentWrites(t *testing.T) {
|
||||
Initiator: "user-" + string(rune(index)),
|
||||
}
|
||||
event.ID = *eventsourced.IdFromString(orgID)
|
||||
_, err := c.Update(event, nil)
|
||||
err := c.Update(event)
|
||||
assert.NoError(t, err)
|
||||
}(i)
|
||||
}
|
||||
@@ -423,7 +423,7 @@ func TestCache_ConcurrentReadsAndWrites(t *testing.T) {
|
||||
Initiator: "user-new-" + string(rune(index)),
|
||||
}
|
||||
event.ID = *eventsourced.IdFromString(newOrgID)
|
||||
_, err := c.Update(event, nil)
|
||||
err := c.Update(event)
|
||||
assert.NoError(t, err)
|
||||
}(i)
|
||||
}
|
||||
@@ -471,7 +471,7 @@ func TestCache_Update_APIKeyRemoved(t *testing.T) {
|
||||
}
|
||||
event.ID = *eventsourced.IdFromString(orgID)
|
||||
|
||||
_, err := c.Update(event, nil)
|
||||
err := c.Update(event)
|
||||
require.NoError(t, err)
|
||||
|
||||
// Verify API key was removed from cache
|
||||
@@ -523,7 +523,7 @@ func TestCache_Update_APIKeyRemoved_MultipleKeys(t *testing.T) {
|
||||
}
|
||||
event.ID = *eventsourced.IdFromString(orgID)
|
||||
|
||||
_, err := c.Update(event, nil)
|
||||
err := c.Update(event)
|
||||
require.NoError(t, err)
|
||||
|
||||
// Verify only key2 was removed
|
||||
@@ -579,7 +579,7 @@ func TestCache_Update_OrganizationRemoved(t *testing.T) {
|
||||
}
|
||||
event.ID = *eventsourced.IdFromString(orgID)
|
||||
|
||||
_, err := c.Update(event, nil)
|
||||
err := c.Update(event)
|
||||
require.NoError(t, err)
|
||||
|
||||
// Verify organization was removed
|
||||
@@ -633,7 +633,7 @@ func TestCache_Update_OrganizationRemoved_MultipleUsers(t *testing.T) {
|
||||
}
|
||||
event.ID = *eventsourced.IdFromString(orgID)
|
||||
|
||||
_, err := c.Update(event, nil)
|
||||
err := c.Update(event)
|
||||
require.NoError(t, err)
|
||||
|
||||
// Verify user1 still has otherOrgID but not removed orgID
|
||||
|
||||
Reference in new issue
Block a user