You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2014/04/20 21:20:33 UTC
[16/50] [abbrv] git commit: TS-2637: fix traffic_line -r and -m
TS-2637: fix traffic_line -r and -m
Fix traffic_line -r by passing the correct record name.
Fix traffic_line -m by initializing the record element before
fetching it. In this case the response string value can be missing
if it is NULL.
Add an integration test (this currently fails because
proxy.config.cache.ram_cache.use_seen_filter is not defined
correctly).
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/fc974bf7
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/fc974bf7
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/fc974bf7
Branch: refs/heads/lua_config
Commit: fc974bf7cc11f0e6d419da095cccf0d35bae098b
Parents: e2c6954
Author: James Peach <jp...@apache.org>
Authored: Mon Mar 17 16:38:57 2014 -0700
Committer: James Peach <jp...@apache.org>
Committed: Mon Mar 17 16:42:42 2014 -0700
----------------------------------------------------------------------
ci/tsqa/test-trafficline-metrics | 56 +++++++++++++++++++++++++++++++++++
mgmt/api/CoreAPIRemote.cc | 4 +--
mgmt/api/TSControlMain.cc | 8 +++--
3 files changed, 64 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/fc974bf7/ci/tsqa/test-trafficline-metrics
----------------------------------------------------------------------
diff --git a/ci/tsqa/test-trafficline-metrics b/ci/tsqa/test-trafficline-metrics
new file mode 100755
index 0000000..1f28cbd
--- /dev/null
+++ b/ci/tsqa/test-trafficline-metrics
@@ -0,0 +1,56 @@
+#! /usr/bin/env bash
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+TSQA_TSXS=${TSQA_TSXS:-/opt/ats/bin/tsxs}
+TSQA_TESTNAME=$(basename $0)
+source $(dirname $0)/functions
+
+# Use traffic_line -m to list all the configuration variables. Verify their values with
+# traffic_line -r. This tests the TSRecordGet() and TSRecordGetMatchMult() remote APIs.
+check() {
+ local key
+ local val1
+ local val2
+
+ local bindir=$(bindir)
+
+ tsexec traffic_line -m proxy.config | while read key val1 ; do
+ val2=$(TS_ROOT=$TSQA_ROOT $bindir/traffic_line -r $key)
+ if [ "$?" != "0" ]; then
+ fail failed to fetch value for $key
+ elif [ "$val1" != "$val1" ] ; then
+ fail value mismatch for $key, expected:\"$val1\", received:\"$val2\"
+ fi
+ done
+}
+
+bootstrap
+
+# If Traffic Server is not up, bring it up ...
+alive cop || startup || fatal unable to start Traffic Server
+trap shutdown 0 EXIT
+
+# Wait for traffic_manager to start.
+alive manager
+msgwait 1
+
+check
+
+exit $TSQA_FAIL
+
+# vim: set sw=2 ts=2 et :
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/fc974bf7/mgmt/api/CoreAPIRemote.cc
----------------------------------------------------------------------
diff --git a/mgmt/api/CoreAPIRemote.cc b/mgmt/api/CoreAPIRemote.cc
index 0dc360a..c15979e 100644
--- a/mgmt/api/CoreAPIRemote.cc
+++ b/mgmt/api/CoreAPIRemote.cc
@@ -487,7 +487,7 @@ mgmt_record_get_reply(TSRecordEle * rec_ele)
void *val;
char *name;
- rec_ele->rec_name = NULL;
+ ink_zero(*rec_ele);
rec_ele->rec_type = TS_REC_UNDEFINED;
// parse the reply to get record value and type
@@ -536,7 +536,7 @@ MgmtRecordGet(const char *rec_name, TSRecordEle * rec_ele)
}
// create and send request
- ret = send_record_get_request(main_socket_fd, rec_ele->rec_name);
+ ret = send_record_get_request(main_socket_fd, rec_name);
if (ret != TS_ERR_OKAY) {
return ret;
}
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/fc974bf7/mgmt/api/TSControlMain.cc
----------------------------------------------------------------------
diff --git a/mgmt/api/TSControlMain.cc b/mgmt/api/TSControlMain.cc
index 950e3b5..97a7613 100644
--- a/mgmt/api/TSControlMain.cc
+++ b/mgmt/api/TSControlMain.cc
@@ -219,7 +219,6 @@ ts_ctrl_main(void *arg)
case RECORD_MATCH_GET:
ret = handle_record_match(client_entry->sock_info, req);
- // XXX
break;
case RECORD_SET:
@@ -432,7 +431,12 @@ send_record_match(RecT /* rec_type */, void *edata, int /* registered */, const
match->err = send_record_get_reply(match->sock, TS_ERR_OKAY, &(rec_val->rec_counter), sizeof(TSCounter), TS_REC_COUNTER, name);
break;
case RECD_STRING:
- match->err = send_record_get_reply(match->sock, TS_ERR_OKAY, rec_val->rec_string, rec_val->rec_string ? strlen(rec_val->rec_string): 0, TS_REC_STRING, name);
+ // For NULL string parameters, end the literal "NULL" to match the behavior of MgmtRecordGet().
+ if (rec_val->rec_string) {
+ match->err = send_record_get_reply(match->sock, TS_ERR_OKAY, rec_val->rec_string, strlen(rec_val->rec_string), TS_REC_STRING, name);
+ } else {
+ match->err = send_record_get_reply(match->sock, TS_ERR_OKAY, (void *)"NULL", strlen("NULL"), TS_REC_STRING, name);
+ }
break;
case RECD_FLOAT:
match->err = send_record_get_reply(match->sock, TS_ERR_OKAY, &(rec_val->rec_float), sizeof(TSFloat), TS_REC_FLOAT, name);