M models/totals_meta.go => models/totals_meta.go +1 -1
@@ 97,7 97,7 @@ func (t *TotalsMeta) Store(ctx context.Context) error {
WITH ins AS (
INSERT INTO totals_meta(daily_total_id, meta_type, meta_value)
VALUES ($1, $2, $3)
- ON CONFLICT (daily_total_id, meta_type, meta_value) DO UPDATE
+ ON CONFLICT (daily_total_id, meta_type, meta_value) DO UPDATE
SET daily_total_id = NULL
WHERE FALSE
RETURNING id
M short/routes_test.go => short/routes_test.go +7 -0
@@ 211,6 211,13 @@ func TestRedirectHandler(t *testing.T) {
request := httptest.NewRequest(http.MethodPost, "/", nil)
request.Header.Set(echo.HeaderContentType, echo.MIMEApplicationForm)
+
+ _, ok := srv.Config.File.Get("geo", "path")
+ if ok {
+ // test config has geodb path set. Let's set an IP so we can test the db integration
+ request = request.WithContext(links.IPContext(request.Context(), "142.250.217.196")) // www.google.com
+ }
+
recorder := httptest.NewRecorder()
ctx := &server.Context{
Server: srv,