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 2022/06/15 22:26:09 UTC

[trafficserver] branch 9.2.x updated (b303fd8cc -> 09b378163)

This is an automated email from the ASF dual-hosted git repository.

zwoop pushed a change to branch 9.2.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


    from b303fd8cc Updated ChangeLog
     new 917131810 Add AuTest for stats-over-http plugin (#8422)
     new 09b378163 Fix plugin stats_over_http OK reason phrase (#8902)

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 plugins/stats_over_http/stats_over_http.c          | 16 +++---
 .../gold/stats_over_http_0_stderr.gold             | 11 ++++
 .../gold/stats_over_http_0_stdout.gold             |  4 ++
 .../stats_over_http/stats_over_http.test.py}       | 58 +++++-----------------
 4 files changed, 36 insertions(+), 53 deletions(-)
 create mode 100644 tests/gold_tests/pluginTest/stats_over_http/gold/stats_over_http_0_stderr.gold
 create mode 100644 tests/gold_tests/pluginTest/stats_over_http/gold/stats_over_http_0_stdout.gold
 copy tests/gold_tests/{connect/connect.test.py => pluginTest/stats_over_http/stats_over_http.test.py} (50%)


[trafficserver] 02/02: Fix plugin stats_over_http OK reason phrase (#8902)

Posted by zw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

zwoop pushed a commit to branch 9.2.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

commit 09b378163ba85eca742c60471669a7d27e368f7f
Author: Robert O Butts <ro...@users.noreply.github.com>
AuthorDate: Tue Jun 14 15:16:09 2022 -0600

    Fix plugin stats_over_http OK reason phrase (#8902)
    
    (cherry picked from commit 18fc00a78aca1db1d39f3eab20bd9bf0986e5bd4)
---
 plugins/stats_over_http/stats_over_http.c                | 16 ++++++++--------
 .../stats_over_http/gold/stats_over_http_0_stderr.gold   |  2 +-
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/plugins/stats_over_http/stats_over_http.c b/plugins/stats_over_http/stats_over_http.c
index 5dae13b99..c480e7900 100644
--- a/plugins/stats_over_http/stats_over_http.c
+++ b/plugins/stats_over_http/stats_over_http.c
@@ -244,20 +244,20 @@ stats_add_data_to_resp_buffer(const char *s, stats_state *my_state)
   return s_len;
 }
 
-static const char RESP_HEADER_JSON[] = "HTTP/1.0 200 Ok\r\nContent-Type: text/json\r\nCache-Control: no-cache\r\n\r\n";
+static const char RESP_HEADER_JSON[] = "HTTP/1.0 200 OK\r\nContent-Type: text/json\r\nCache-Control: no-cache\r\n\r\n";
 static const char RESP_HEADER_JSON_GZIP[] =
-  "HTTP/1.0 200 Ok\r\nContent-Type: text/json\r\nContent-Encoding: gzip\r\nCache-Control: no-cache\r\n\r\n";
+  "HTTP/1.0 200 OK\r\nContent-Type: text/json\r\nContent-Encoding: gzip\r\nCache-Control: no-cache\r\n\r\n";
 static const char RESP_HEADER_JSON_DEFLATE[] =
-  "HTTP/1.0 200 Ok\r\nContent-Type: text/json\r\nContent-Encoding: deflate\r\nCache-Control: no-cache\r\n\r\n";
+  "HTTP/1.0 200 OK\r\nContent-Type: text/json\r\nContent-Encoding: deflate\r\nCache-Control: no-cache\r\n\r\n";
 static const char RESP_HEADER_JSON_BR[] =
-  "HTTP/1.0 200 Ok\r\nContent-Type: text/json\r\nContent-Encoding: br\r\nCache-Control: no-cache\r\n\r\n";
-static const char RESP_HEADER_CSV[] = "HTTP/1.0 200 Ok\r\nContent-Type: text/csv\r\nCache-Control: no-cache\r\n\r\n";
+  "HTTP/1.0 200 OK\r\nContent-Type: text/json\r\nContent-Encoding: br\r\nCache-Control: no-cache\r\n\r\n";
+static const char RESP_HEADER_CSV[] = "HTTP/1.0 200 OK\r\nContent-Type: text/csv\r\nCache-Control: no-cache\r\n\r\n";
 static const char RESP_HEADER_CSV_GZIP[] =
-  "HTTP/1.0 200 Ok\r\nContent-Type: text/csv\r\nContent-Encoding: gzip\r\nCache-Control: no-cache\r\n\r\n";
+  "HTTP/1.0 200 OK\r\nContent-Type: text/csv\r\nContent-Encoding: gzip\r\nCache-Control: no-cache\r\n\r\n";
 static const char RESP_HEADER_CSV_DEFLATE[] =
-  "HTTP/1.0 200 Ok\r\nContent-Type: text/csv\r\nContent-Encoding: deflate\r\nCache-Control: no-cache\r\n\r\n";
+  "HTTP/1.0 200 OK\r\nContent-Type: text/csv\r\nContent-Encoding: deflate\r\nCache-Control: no-cache\r\n\r\n";
 static const char RESP_HEADER_CSV_BR[] =
-  "HTTP/1.0 200 Ok\r\nContent-Type: text/csv\r\nContent-Encoding: br\r\nCache-Control: no-cache\r\n\r\n";
+  "HTTP/1.0 200 OK\r\nContent-Type: text/csv\r\nContent-Encoding: br\r\nCache-Control: no-cache\r\n\r\n";
 
 static int
 stats_add_resp_header(stats_state *my_state)
diff --git a/tests/gold_tests/pluginTest/stats_over_http/gold/stats_over_http_0_stderr.gold b/tests/gold_tests/pluginTest/stats_over_http/gold/stats_over_http_0_stderr.gold
index 637a06839..23cfc22ce 100644
--- a/tests/gold_tests/pluginTest/stats_over_http/gold/stats_over_http_0_stderr.gold
+++ b/tests/gold_tests/pluginTest/stats_over_http/gold/stats_over_http_0_stderr.gold
@@ -1,7 +1,7 @@
 ``
 > GET /_stats HTTP/1.1
 ``
-< HTTP/1.1 200 Ok
+< HTTP/1.1 200 OK
 < Content-Type: text/json
 < Cache-Control: no-cache
 < Date:``


[trafficserver] 01/02: Add AuTest for stats-over-http plugin (#8422)

Posted by zw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

zwoop pushed a commit to branch 9.2.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

commit 917131810db06c0ba98ad26cce49e4ebcd90969d
Author: Masaori Koshiba <ma...@apache.org>
AuthorDate: Fri Oct 15 07:42:19 2021 +0900

    Add AuTest for stats-over-http plugin (#8422)
    
    (cherry picked from commit b369551b64e63a88cbc2d5fbb4abf9d046c65ff3)
---
 .../gold/stats_over_http_0_stderr.gold             | 11 ++++
 .../gold/stats_over_http_0_stdout.gold             |  4 ++
 .../stats_over_http/stats_over_http.test.py        | 76 ++++++++++++++++++++++
 3 files changed, 91 insertions(+)

diff --git a/tests/gold_tests/pluginTest/stats_over_http/gold/stats_over_http_0_stderr.gold b/tests/gold_tests/pluginTest/stats_over_http/gold/stats_over_http_0_stderr.gold
new file mode 100644
index 000000000..637a06839
--- /dev/null
+++ b/tests/gold_tests/pluginTest/stats_over_http/gold/stats_over_http_0_stderr.gold
@@ -0,0 +1,11 @@
+``
+> GET /_stats HTTP/1.1
+``
+< HTTP/1.1 200 Ok
+< Content-Type: text/json
+< Cache-Control: no-cache
+< Date:``
+< Age:``
+< Transfer-Encoding: chunked
+< Connection:``
+``
diff --git a/tests/gold_tests/pluginTest/stats_over_http/gold/stats_over_http_0_stdout.gold b/tests/gold_tests/pluginTest/stats_over_http/gold/stats_over_http_0_stdout.gold
new file mode 100644
index 000000000..a9315fe22
--- /dev/null
+++ b/tests/gold_tests/pluginTest/stats_over_http/gold/stats_over_http_0_stdout.gold
@@ -0,0 +1,4 @@
+{ "global": {``
+``
+  }
+}
diff --git a/tests/gold_tests/pluginTest/stats_over_http/stats_over_http.test.py b/tests/gold_tests/pluginTest/stats_over_http/stats_over_http.test.py
new file mode 100644
index 000000000..a39a6dac6
--- /dev/null
+++ b/tests/gold_tests/pluginTest/stats_over_http/stats_over_http.test.py
@@ -0,0 +1,76 @@
+'''
+'''
+#  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.
+
+from enum import Enum
+
+Test.Summary = 'Exercise stats-over-http plugin'
+Test.SkipUnless(Condition.PluginExists('stats_over_http.so'))
+Test.ContinueOnFail = True
+
+
+class StatsOverHttpPluginTest:
+    """
+    https://docs.trafficserver.apache.org/en/latest/admin-guide/plugins/stats_over_http.en.html
+    """
+
+    class State(Enum):
+        """
+        State of process
+        """
+        INIT = 0
+        RUNNING = 1
+
+    def __init__(self):
+        self.state = self.State.INIT
+        self.__setupTS()
+
+    def __setupTS(self):
+        self.ts = Test.MakeATSProcess("ts", select_ports=True)
+
+        self.ts.Disk.plugin_config.AddLine('stats_over_http.so _stats')
+
+        self.ts.Disk.records_config.update({
+            "proxy.config.http.server_ports": f"{self.ts.Variables.port}",
+        })
+
+    def __checkProcessBefore(self, tr):
+        if self.state == self.State.RUNNING:
+            tr.StillRunningBefore = self.ts
+        else:
+            tr.Processes.Default.StartBefore(self.ts)
+            self.state = self.State.RUNNING
+
+    def __checkProcessAfter(self, tr):
+        assert (self.state == self.State.RUNNING)
+        tr.StillRunningAfter = self.ts
+
+    def __testCase0(self):
+        tr = Test.AddTestRun()
+        self.__checkProcessBefore(tr)
+        tr.Processes.Default.Command = f"curl -vs --http1.1 http://127.0.0.1:{self.ts.Variables.port}/_stats"
+        tr.Processes.Default.ReturnCode = 0
+        tr.Processes.Default.Streams.stdout = "gold/stats_over_http_0_stdout.gold"
+        tr.Processes.Default.Streams.stderr = "gold/stats_over_http_0_stderr.gold"
+        tr.Processes.Default.TimeOut = 3
+        self.__checkProcessAfter(tr)
+
+    def run(self):
+        self.__testCase0()
+
+
+StatsOverHttpPluginTest().run()