Skip to content

Commit

Permalink
fix bug shown in integration test (#131)
Browse files Browse the repository at this point in the history
* fix end string bug in admin_stats

* temporarily disable test that only fails in travis

* fix metric end string for other servers as well (TODO: refactor to move these to protocol module)

* re-enable integration

* minor fix
  • Loading branch information
Yao Yue authored Feb 23, 2017
1 parent 0d32128 commit ddbc28d
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/server/pingserver/admin/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#define METRIC_DESCRIBE_LEN 120 /* 34 (name) + 16 (type) + 68 (description) + CRLF */
#define METRIC_FOOTER CRLF
#define METRIC_END "END\r\n"
#define METRIC_END_LEN sizeof(METRIC_END)
#define METRIC_END_LEN (sizeof(METRIC_END) - 1)

#define VERSION_PRINT_FMT "VERSION %s\r\n"
#define VERSION_PRINT_LEN 30
Expand Down
2 changes: 1 addition & 1 deletion src/server/slimcache/admin/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#define METRIC_DESCRIBE_LEN 120 /* 34 (name) + 16 (type) + 68 (description) + CRLF */
#define METRIC_FOOTER CRLF
#define METRIC_END "END\r\n"
#define METRIC_END_LEN sizeof(METRIC_END)
#define METRIC_END_LEN (sizeof(METRIC_END) - 1)

#define VERSION_PRINT_FMT "VERSION %s\r\n"
#define VERSION_PRINT_LEN 30
Expand Down
2 changes: 1 addition & 1 deletion src/server/twemcache/admin/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#define METRIC_DESCRIBE_LEN 120 /* 34 (name) + 16 (type) + 68 (description) + CRLF */
#define METRIC_FOOTER CRLF
#define METRIC_END "END\r\n"
#define METRIC_END_LEN sizeof(METRIC_END)
#define METRIC_END_LEN (sizeof(METRIC_END) - 1)

#define VERSION_PRINT_FMT "VERSION %s\r\n"
#define VERSION_PRINT_LEN 30
Expand Down
5 changes: 2 additions & 3 deletions test/integration/pelikan_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,9 @@ def getStats(self):
else:
raise
self.admin.setblocking(True)
# this NULL is kinda unexpected for me
if data[-6:] != 'END\r\n\0':
if data[-5:] != 'END\r\n':
raise Exception('Invalid data while fetching stats: {}'.format(data))
return dict(line.split(' ')[1:] for line in data[:-6].strip().split('\r\n'))
return dict(line.split(' ')[1:] for line in data[:-5].strip().split('\r\n'))

def read(self, length):
return self.client.recv(length)
Expand Down

0 comments on commit ddbc28d

Please sign in to comment.