More fixes

This commit is contained in:
Juan Calderon-Perez
2023-08-19 23:05:05 -04:00
parent 9291b82212
commit a638b6d4f2
4 changed files with 3 additions and 10 deletions

View File

@@ -4,13 +4,11 @@ go 1.19
require ( require (
github.com/bradfitz/gomemcache v0.0.0-20221031212613-62deef7fc822 github.com/bradfitz/gomemcache v0.0.0-20221031212613-62deef7fc822
github.com/gofiber/utils/v2 v2.0.0-beta.3
github.com/stretchr/testify v1.8.4 github.com/stretchr/testify v1.8.4
) )
require ( require (
github.com/davecgh/go-spew v1.1.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect
) )

View File

@@ -2,10 +2,6 @@ github.com/bradfitz/gomemcache v0.0.0-20221031212613-62deef7fc822 h1:hjXJeBcAMS1
github.com/bradfitz/gomemcache v0.0.0-20221031212613-62deef7fc822/go.mod h1:H0wQNHz2YrLsuXOZozoeDmnHXkNCRmMW0gwFWDfEZDA= github.com/bradfitz/gomemcache v0.0.0-20221031212613-62deef7fc822/go.mod h1:H0wQNHz2YrLsuXOZozoeDmnHXkNCRmMW0gwFWDfEZDA=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/gofiber/utils/v2 v2.0.0-beta.3 h1:pfOhUDDVjBJpkWv6C5jaDyYLvpui7zQ97zpyFFsUOKw=
github.com/gofiber/utils/v2 v2.0.0-beta.3/go.mod h1:jsl17+MsKfwJjM3ONCE9Rzji/j8XNbwjhUVTjzgfDCo=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=

View File

@@ -6,7 +6,6 @@ import (
"time" "time"
mc "github.com/bradfitz/gomemcache/memcache" mc "github.com/bradfitz/gomemcache/memcache"
"github.com/gofiber/utils/v2"
) )
// Storage interface that is implemented by storage providers // Storage interface that is implemented by storage providers
@@ -21,7 +20,7 @@ func New(config ...Config) *Storage {
cfg := configDefault(config...) cfg := configDefault(config...)
// Split comma separated servers into slice // Split comma separated servers into slice
serverList := strings.Split(utils.Trim(cfg.Servers, ' '), ",") serverList := strings.Split(strings.Trim(cfg.Servers, ' '), ",")
// Create db // Create db
db := mc.New(serverList...) db := mc.New(serverList...)

View File

@@ -5,12 +5,12 @@ import (
"testing" "testing"
"time" "time"
"github.com/gofiber/utils/v2" "github.com/stretchr/testify/require"
) )
func checkTimeStamp(t testing.TB, expectedCurrent, actualCurrent uint32) { func checkTimeStamp(t testing.TB, expectedCurrent, actualCurrent uint32) {
// test with some buffer in front and back of the expectedCurrent time -> because of the timing on the work machine // test with some buffer in front and back of the expectedCurrent time -> because of the timing on the work machine
utils.AssertEqual(t, true, actualCurrent >= expectedCurrent-1 || actualCurrent <= expectedCurrent+1) require.True(t, actualCurrent >= expectedCurrent-1 || actualCurrent <= expectedCurrent+1)
} }
func Test_TimeStampUpdater(t *testing.T) { func Test_TimeStampUpdater(t *testing.T) {