samuel / go-zookeeper

Native ZooKeeper client for Go. This project is no longer maintained. Please use https://github.com/go-zookeeper/zk instead.
BSD 3-Clause "New" or "Revised" License
1.64k stars 672 forks source link

Fix: Exists() should always return false when an error happenning and FLW parsing enhancement #246

Open jasonjoo2010 opened 4 years ago

jasonjoo2010 commented 4 years ago

This PR solved 2 small issues togethor:

  1. Newer zookeeper (tested with 3.6.x) outputs a little different in 4-letter-word response.
  2. Exists() acts different to ExistsW()

Description

FLW

Newer server will response different on latency element:

Latency min/avg/max: 0/0.9167/8

Which seems like some float numbers.

So I adjust the regex expression to pass it.

Exists()

Exists() will return true with an error except ErrNoNode:

error happened result error returned
nil true nil
ErrNoNode false nil
Any other ~true~(incorrect) error

In addition ExistsW() acts correctly.

coveralls commented 4 years ago

Coverage Status

Coverage increased (+0.3%) to 79.896% when pulling 1f98c7010448501070f0f54dd1ec6ffe55d0fab5 on jasonjoo2010:exists into 2cc03de413da42869e2db7ce7965d3e978d917eb on samuel:master.