Skip to content

Commit

Permalink
cache: fix quickstart script, improve checking (#5138)
Browse files Browse the repository at this point in the history
Check that SelfURL also doesn't end with a slash since the galaxycache's
code checks whether the strings are equivalent when picking peers, and
peers cannot have slashes at the end so we need the same, exact format
of the URLs.

Fix quickstart script so that it wouldn't have slashes at the end.

Idea for the future: let's add smoke tests for `scripts/quickstart.sh`
to ensure smooth developer experience?

Signed-off-by: Giedrius Statkevičius <[email protected]>
  • Loading branch information
GiedriusS authored Feb 8, 2022
1 parent de2bfd6 commit 02549ea
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions pkg/cache/groupcache.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ func parseGroupcacheConfig(conf []byte) (GroupcacheConfig, error) {
return GroupcacheConfig{}, fmt.Errorf("peer %d must not have a trailing slash (%s)", i, peer)
}
}
if strings.HasSuffix(config.SelfURL, "/") {
return GroupcacheConfig{}, fmt.Errorf("self URL %s must not have a trailing slash", config.SelfURL)
}

return config, nil
}
Expand Down
4 changes: 2 additions & 2 deletions scripts/quickstart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,9 @@ if [ -n "${GCS_BUCKET}" -o -n "${S3_ENDPOINT}" ]; then
cat >groupcache.yml <<-EOF
type: GROUPCACHE
config:
self_url: http://localhost:10906/
self_url: http://localhost:10906
peers:
- http://localhost:10906/
- http://localhost:10906
groupcache_group: groupcache_test_group
blocks_iter_ttl: 0s
metafile_exists_ttl: 0s
Expand Down

0 comments on commit 02549ea

Please sign in to comment.