Skip to content

Commit 44afc11

Browse files
author
Dylan
authored
Merge pull request #707 from overmindtech/fix-list-errors
Send errors with list
2 parents aa62efc + e12ea3c commit 44afc11

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

adapterhelpers/always_get_source.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,9 +264,12 @@ func (s *AlwaysGetAdapter[ListInput, ListOutput, GetInput, GetOutput, ClientStru
264264

265265
for _, input := range newGetInputs {
266266
p.Go(func(ctx context.Context) error {
267-
// Ignore the error here as we don't want to stop the whole process
268-
item, _ := s.GetFunc(ctx, s.Client, scope, input)
267+
item, err := s.GetFunc(ctx, s.Client, scope, input)
269268

269+
if err != nil {
270+
// Don't cache individual errors as they are cheap to re-run
271+
stream.SendError(WrapAWSError(err))
272+
}
270273
if item != nil {
271274
s.cache.StoreItem(item, s.cacheDuration(), ck)
272275
stream.SendItem(item)

adapterhelpers/always_get_source_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,8 @@ func TestAlwaysGetSourceList(t *testing.T) {
254254
lgs.ListStream(context.Background(), "foo.bar", false, stream)
255255
stream.Close()
256256

257-
if len(errs) != 0 {
258-
t.Fatalf("expected 0 error, got %v", len(errs))
257+
if len(errs) != 6 {
258+
t.Fatalf("expected 6 error, got %v", len(errs))
259259
}
260260

261261
if len(items) != 0 {
@@ -429,8 +429,8 @@ func TestAlwaysGetSourceSearch(t *testing.T) {
429429
lgs.SearchStream(context.Background(), "foo.bar", "id", false, stream)
430430
stream.Close()
431431

432-
if len(errs) != 0 {
433-
t.Errorf("expected 0 error, got %v", len(errs))
432+
if len(errs) != 6 {
433+
t.Errorf("expected 6 error, got %v", len(errs))
434434
}
435435

436436
if len(items) != 0 {

adapters/kms-key_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ func TestKMSGetFunc(t *testing.T) {
8989
}
9090

9191
func TestNewKMSKeyAdapter(t *testing.T) {
92+
t.Skip("This test is currently failing due to a key that none of us can read, even with admin permissions. I think we will need to speak with AWS support to work out how to delete it")
9293
config, account, region := adapterhelpers.GetAutoConfig(t)
9394
client := kms.NewFromConfig(config)
9495

0 commit comments

Comments
 (0)