Skip to content

Commit

Permalink
Printed MIN_COOKIE_SIZE_BYTES in error message, added one more test c…
Browse files Browse the repository at this point in the history
…ase in usersync/cookie_test.go
  • Loading branch information
Gus Carreon authored and Gus Carreon committed Sep 10, 2019
1 parent 04c85c7 commit 1ffc002
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 369 deletions.
3 changes: 1 addition & 2 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package config

import (
"bytes"
"errors"
"fmt"
"net/url"
"reflect"
Expand Down Expand Up @@ -695,7 +694,7 @@ func isValidCookieSize(maxCookieSize int) error {
// If a non-zero-less-than-500-byte "host_cookie.max_cookie_size_bytes" value was specified in the
// environment configuration of prebid-server, default to 500 bytes
if maxCookieSize != 0 && maxCookieSize < MIN_COOKIE_SIZE_BYTES {
return errors.New("Configured cookie size is less than allowed minimum size")
return fmt.Errorf("Configured cookie size is less than allowed minimum size of %d \n", MIN_COOKIE_SIZE_BYTES)
}
return nil
}
1 change: 1 addition & 0 deletions config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ func TestCookieSizeError(t *testing.T) {
}
testCases := []aTest{
{cookieHost: &HostCookie{MaxCookieSizeBytes: 1 << 15}, expectError: false}, //32 KB, no error
{cookieHost: &HostCookie{MaxCookieSizeBytes: 800}, expectError: false},
{cookieHost: &HostCookie{MaxCookieSizeBytes: 500}, expectError: false},
{cookieHost: &HostCookie{MaxCookieSizeBytes: 0}, expectError: false},
{cookieHost: &HostCookie{MaxCookieSizeBytes: 200}, expectError: true},
Expand Down
Loading

0 comments on commit 1ffc002

Please sign in to comment.