Add unit test for TestMasterFromZK and TestMesosMasterFromZK

This commit is contained in:
Lawrence Wong 2022-08-22 14:54:03 -07:00
parent 63cdb96c7a
commit 6ce516663a
3 changed files with 50 additions and 0 deletions

10
zk.go
View file

@ -287,6 +287,11 @@ func MesosFromZKOpts(options ...ZKOpt) (string, error) {
return mesosURL, nil
}
// Retrieves current Aurora master nodes from ZK.
func MasterNodesFromZK(cluster Cluster) (map[string][]string, error) {
return MasterNodesFromZKOpts(ZKEndpoints(strings.Split(cluster.ZK, ",")...), ZKPath(cluster.SchedZKPath))
}
// Retrieves current Mesos master nodes/leader from ZK with a custom configuration.
func MasterNodesFromZKOpts(options ...ZKOpt) (map[string][]string, error) {
result := make(map[string][]string)
@ -382,6 +387,11 @@ func MasterNodesFromZKOpts(options ...ZKOpt) (map[string][]string, error) {
return result, nil
}
// Retrieves current Mesos Aurora master nodes from ZK.
func MesosMasterNodesFromZK(cluster Cluster) (map[string][]string, error) {
return MesosMasterNodesFromZKOpts(ZKEndpoints(strings.Split(cluster.ZK, ",")...), ZKPath(cluster.SchedZKPath))
}
// Retrieves current mesos master nodes/leader from ZK with a custom configuration.
func MesosMasterNodesFromZKOpts(options ...ZKOpt) (map[string][]string, error) {
result := make(map[string][]string)