Skip to content

Commit

Permalink
Fix missing return obj when create-if-not-exist
Browse files Browse the repository at this point in the history
Signed-off-by: imjoey <[email protected]>
  • Loading branch information
imjoey committed Jan 18, 2021
1 parent 5334111 commit a623b98
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions api/internal/core/store/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,7 @@ func (s *GenericStore) Update(ctx context.Context, obj interface{}, createIfNotE
storedObj, ok := s.cache.Load(key)
if !ok {
if createIfNotExist {
_, err := s.Create(ctx, obj)
return nil, err
return s.Create(ctx, obj)
}
log.Warnf("key: %s is not found", key)
return nil, fmt.Errorf("key: %s is not found", key)
Expand Down
4 changes: 2 additions & 2 deletions api/test/e2e/ssl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func TestSSL_Basic(t *testing.T) {
}`,
Headers: map[string]string{"Authorization": token},
ExpectStatus: http.StatusOK,
ExpectBody: "\"status\": 0",
ExpectBody: "\"status\":0",
},
}

Expand All @@ -156,7 +156,7 @@ func TestSSL_Basic(t *testing.T) {
Body: `1`,
Headers: map[string]string{"Authorization": token},
ExpectStatus: http.StatusOK,
ExpectBody: "\"status\": 1",
ExpectBody: "\"status\":1",
},
{
Desc: "hit the route using HTTPS, make sure enable successful",
Expand Down

0 comments on commit a623b98

Please sign in to comment.