Skip to content

Commit

Permalink
propagate changes from #141
Browse files Browse the repository at this point in the history
Signed-off-by: Silvio Moioli <[email protected]>
  • Loading branch information
moio committed Jun 3, 2024
1 parent 944fbda commit 885c273
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions pkg/stores/proxyalpha/proxy_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,7 @@ func (s *Store) WatchNames(apiOp *types.APIRequest, schema *types.APISchema, w t
} else {
logrus.Debugf("WatchNames received error: %v", item)
}
result <- item
continue
}

Expand Down
12 changes: 10 additions & 2 deletions pkg/stores/proxyalpha/proxy_store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"net/http"
"net/url"
"strings"
"testing"
"time"

Expand Down Expand Up @@ -682,6 +683,7 @@ func receiveUntil(wc chan watch.Event, d time.Duration) error {
timer := time.NewTicker(d)
defer timer.Stop()
secretNames := []string{"testsecret1", "testsecret2"}
errMsgs := []string{"err1", "err2", "err3"}
for {
select {
case event, ok := <-wc:
Expand All @@ -690,7 +692,13 @@ func receiveUntil(wc chan watch.Event, d time.Duration) error {
}

if event.Type == watch.Error {
return errors.New(fmt.Sprintf("watch chan should not have sent events of type [%s]", watch.Error))
status, ok := event.Object.(*metav1.Status)
if !ok {
continue
}
if strings.HasSuffix(status.Message, errMsgs[0]) {
errMsgs = errMsgs[1:]
}
}
secret, ok := event.Object.(*v1.Secret)
if !ok {
Expand All @@ -699,7 +707,7 @@ func receiveUntil(wc chan watch.Event, d time.Duration) error {
if secret.Name == secretNames[0] {
secretNames = secretNames[1:]
}
if len(secretNames) == 0 {
if len(secretNames) == 0 && len(errMsgs) == 0 {
return nil
}
continue
Expand Down

0 comments on commit 885c273

Please sign in to comment.