Skip to content

Commit

Permalink
chore: Rename route GET /log to /logs (#418)
Browse files Browse the repository at this point in the history
* fix: first

* fix: cache capacity to 100 numscripts

* fix: flag name

* chore: first

Signed-off-by: Maxence Maireaux <maxence@maireaux.fr>
Co-authored-by: Maxence Maireaux <maxence@maireaux.fr>
  • Loading branch information
Antoine Gelloz and flemzord authored Jan 26, 2023
1 parent cdd925b commit 8edd8c5
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pkg/api/controllers/context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func TestContext(t *testing.T) {
_, err := uuid.Parse(rsp.Header().Get(string(pkg.KeyContextID)))
require.NoError(t, err)
})
t.Run("GET/log", func(t *testing.T) {
t.Run("GET/logs", func(t *testing.T) {
rsp := internal.GetLedgerLogs(api, url.Values{})
_, err := uuid.Parse(rsp.Header().Get(string(pkg.KeyContextID)))
require.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/controllers/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -975,7 +975,7 @@ paths:
schema:
$ref: '#/components/schemas/ErrorResponse'

/{ledger}/log:
/{ledger}/logs:
get:
tags:
- Logs
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/internal/testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ func GetLedgerStats(handler http.Handler) *httptest.ResponseRecorder {
}

func GetLedgerLogs(handler http.Handler, query url.Values) *httptest.ResponseRecorder {
req, rec := NewRequest(http.MethodGet, fmt.Sprintf("/%s/log", testingLedger), nil)
req, rec := NewRequest(http.MethodGet, fmt.Sprintf("/%s/logs", testingLedger), nil)
req.URL.RawQuery = query.Encode()
handler.ServeHTTP(rec, req)
return rec
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/routes/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ func (r *Routes) Engine() *gin.Engine {
// LedgerController
dedicatedLedgerRouter.GET("/_info", r.wrapWithScopes(r.ledgerController.GetInfo, ScopesInfoRead))
dedicatedLedgerRouter.GET("/stats", r.wrapWithScopes(r.ledgerController.GetStats, ScopesStatsRead))
dedicatedLedgerRouter.GET("/log", r.wrapWithScopes(r.ledgerController.GetLogs, ScopesLogsRead))
dedicatedLedgerRouter.GET("/logs", r.wrapWithScopes(r.ledgerController.GetLogs, ScopesLogsRead))

// AccountController
dedicatedLedgerRouter.GET("/accounts", r.wrapWithScopes(r.accountController.GetAccounts, ScopeAccountsRead, ScopeAccountsWrite))
Expand Down
1 change: 1 addition & 0 deletions pkg/ledger/ledger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ func runOnLedger(f func(l *ledger.Ledger), ledgerOptions ...ledger.LedgerOption)
return err
}
cache, err := ristretto.NewCache(&ristretto.Config{

NumCounters: 1e7, // number of keys to track frequency of (10M).
MaxCost: 100, // maximum cost of cache.
BufferItems: 64, // number of keys per Get buffer.
Expand Down

0 comments on commit 8edd8c5

Please sign in to comment.