Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
Signed-off-by: Marco Hofstetter <[email protected]>
  • Loading branch information
mhofstetter committed Jan 7, 2025
1 parent 8cde471 commit 366a4b6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
5 changes: 2 additions & 3 deletions tests/cilium_websocket_decap_integration_test.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#include <bits/basic_string.h>
#include <fmt/base.h>
#include <fmt/format.h>
#include <gtest/gtest-param-test.h>
Expand Down Expand Up @@ -290,7 +289,7 @@ TEST_P(CiliumWebSocketIntegrationTest, AcceptedWebSocket) {

// Masked frames
ASSERT_EQ(buf.length(), 0);
auto msg = "heello there\r\n"s;
auto msg = std::string{"heello there\r\n"};
unsigned char mask[4] = {0x12, 0x34, 0x56, 0x78};
auto masked = msg;
for (size_t i = 0; i < msg.length(); i++) {
Expand Down Expand Up @@ -318,7 +317,7 @@ TEST_P(CiliumWebSocketIntegrationTest, AcceptedWebSocket) {

// 2nd masked frame
ASSERT_EQ(buf.length(), 0);
auto msg2 = "hello there\r\n"s;
auto msg2 = std::string{"hello there\r\n"};
unsigned char mask2[4] = {0x90, 0xab, 0xcd, 0xef};
auto masked2 = msg2;
for (size_t i = 0; i < msg2.length(); i++) {
Expand Down
9 changes: 4 additions & 5 deletions tests/cilium_websocket_encap_integration_test.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#include <bits/basic_string.h>
#include <fmt/base.h>
#include <fmt/format.h>
#include <gtest/gtest-param-test.h>
Expand Down Expand Up @@ -154,8 +153,8 @@ static const char EXPECTED_HANDSHAKE_FMT[] =
"GET / HTTP/1.1" CRLF "host: jarno.cilium.rocks" CRLF "upgrade: websocket" CRLF
"connection: upgrade" CRLF "sec-websocket-key: c3VwZXItc2VjcmV0LWtleQ==" CRLF
"sec-websocket-version: 13" CRLF "origin: jarno.cilium.rocks" CRLF
"x-envoy-original-dst-host: {}" CRLF X_REQUEST_ID_HEADER HEADER_SEPARATOR X_REQUEST_ID_VALUE
CRLF "content-length: 0" CRLF CRLF;
"x-envoy-original-dst-host: {}" CRLF X_REQUEST_ID_HEADER HEADER_SEPARATOR
X_REQUEST_ID_VALUE CRLF "content-length: 0" CRLF CRLF;

namespace {

Expand Down Expand Up @@ -392,7 +391,7 @@ TEST_P(CiliumWebSocketIntegrationTest, CiliumWebSocketLargeWrite) {
ASSERT_EQ(received_data.substr(frame_offset, 16 * 1024), data.substr(16 * 1024, 16 * 1024));

// writing data in one large chunk
ASSERT_TRUE(fake_upstream_connection->write("\x82\x7e\x80\x00"s));
ASSERT_TRUE(fake_upstream_connection->write(std::string{"\x82\x7e\x80\x00"}));
ASSERT_TRUE(fake_upstream_connection->write(data));
tcp_client->waitForData(data);
tcp_client->close();
Expand Down Expand Up @@ -448,7 +447,7 @@ TEST_P(CiliumWebSocketIntegrationTest, CiliumWebSocketDownstreamFlush) {

// writing data in one large chunk

ASSERT_TRUE(fake_upstream_connection->write("\x82\x7f\x03\x20\0\0"s));
ASSERT_TRUE(fake_upstream_connection->write(std::string{"\x82\x7f\x03\x20\0\0"}));
ASSERT_TRUE(fake_upstream_connection->write(data, true));

test_server_->waitForCounterGe("cluster.cluster1.upstream_flow_control_paused_reading_total", 1);
Expand Down

0 comments on commit 366a4b6

Please sign in to comment.