Skip to content

Commit

Permalink
[memcached] add funcs to return quoted serverList and update test hel…
Browse files Browse the repository at this point in the history
…pers

For tls, in openstack-k8s-operators#192
changed the server lists to contain the svc fqdn, but missed to
update the test helpers.
  • Loading branch information
stuggi committed Mar 12, 2024
1 parent 8b35d05 commit 041b81b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
14 changes: 13 additions & 1 deletion apis/memcached/v1beta1/memcached_funcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,22 @@ func (instance *Memcached) GetMemcachedServerListString() string {
return strings.Join(instance.Status.ServerList, ",")
}

// GetMemcachedServerListQuotedString - return the memcached servers, each quoted, as comma separated list
// to be used in OpenStack config.
func (instance *Memcached) GetMemcachedServerListQuotedString() string {
return "'" + strings.Join(instance.Status.ServerList, "','") + "'"
}

// GetMemcachedServerListWithInetString - return the memcached servers as comma separated list
// to be used in OpenStack config.
func (instance *Memcached) GetMemcachedServerListWithInetString() string {
return strings.Join(instance.Status.ServerListWithInet, ",")
return strings.Join(instance.Status.ServerListWithInet, "','")
}

// GetMemcachedServerListWithInetQuotedString - return the memcached servers, each quoted, as comma separated list
// to be used in OpenStack config.
func (instance *Memcached) GetMemcachedServerListWithInetQuotedString() string {
return "'" + strings.Join(instance.Status.ServerListWithInet, "','") + "'"
}

// GetMemcachedTLSSupport - return the TLS support of the memcached instance
Expand Down
4 changes: 2 additions & 2 deletions apis/test/helpers/memcached.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ func (tc *TestHelper) SimulateMemcachedReady(name types.NamespacedName) {
serverList := []string{}
serverListWithInet := []string{}
for i := 0; i < int(*mc.Spec.Replicas); i++ {
serverList = append(serverList, fmt.Sprintf("%s-%d.%s:11211", mc.Name, i, mc.Name))
serverListWithInet = append(serverListWithInet, fmt.Sprintf("inet:[%s-%d.%s]:11211", mc.Name, i, mc.Name))
serverList = append(serverList, fmt.Sprintf("%s-%d.%s.%s.svc:11211", mc.Name, i, mc.Name, mc.Namespace))
serverListWithInet = append(serverListWithInet, fmt.Sprintf("inet:[%s-%d.%s.%s.svc]:11211", mc.Name, i, mc.Name, mc.Namespace))
}
mc.Status.ServerList = serverList
mc.Status.ServerListWithInet = serverListWithInet
Expand Down

0 comments on commit 041b81b

Please sign in to comment.