mirror of
https://github.com/sablierapp/sablier.git
synced 2026-01-04 12:05:05 +01:00
feat: add persistent storage (#30)
* refactor: remove unused default timeout * feat: add persistent storage Allows you to save the state to a file and load it upon restarting the app to restore the previous state. * chore: upgrade to go 1.18 * use tinykv with generics * build: add "-buildvcs=false" flag Git is not available in golang:1.18-alpine image
This commit is contained in:
@@ -4,6 +4,9 @@ import (
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/acouvreur/tinykv"
|
||||
)
|
||||
|
||||
type ScalerMock struct {
|
||||
@@ -50,7 +53,9 @@ func TestOndemand_ServeHTTP(t *testing.T) {
|
||||
request := httptest.NewRequest("GET", "/?name=whoami&timeout=5m", nil)
|
||||
responseRecorder := httptest.NewRecorder()
|
||||
|
||||
onDemandHandler := onDemand(test.scaler)
|
||||
store := tinykv.New[OnDemandRequestState](time.Second * 20)
|
||||
|
||||
onDemandHandler := onDemand(test.scaler, store)
|
||||
onDemandHandler(responseRecorder, request)
|
||||
|
||||
body := responseRecorder.Body.String()
|
||||
|
||||
Reference in New Issue
Block a user