Skip to content

Commit

Permalink
Test fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
GUI committed Feb 12, 2024
1 parent 920608c commit 3b3cab3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion test/processes/test_file_permissions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def test_etc_perp_uninstalled_service_dir
end

def test_etc_perp_disabled_service_dir
stat = File.stat(File.join($config["etc_dir"], "perp", "opensearch-aws-signing-proxy"))
stat = File.stat(File.join($config["etc_dir"], "perp", "geoip-auto-updater"))
assert_equal("40750", stat.mode.to_s(8))
assert_process_owner(stat)
assert_group(stat)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require_relative "../test_helper"
require_relative "../../test_helper"

class Test::Proxy::Logging::TestHostRealip < Minitest::Test
include ApiUmbrellaTestHelpers::Setup
Expand Down
7 changes: 6 additions & 1 deletion test/proxy/logging/test_special_chars.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ def test_valid_utf8_encoding_in_url_path_url_params_headers
end

def test_invalid_utf8_encoding_in_url_path_url_params_headers
log_tail = LogTail.new("fluent-bit/current")

# Test various encodings of the ISO-8859-1 pound symbol: £ (but since this
# is the ISO-8859-1 version, it's not valid UTF-8).
url_encoded = "%A3"
Expand All @@ -125,12 +127,15 @@ def test_invalid_utf8_encoding_in_url_path_url_params_headers

record = wait_for_log(response)[:hit_source]

log = log_tail.read.encode("UTF-8", invalid: :replace)
assert_match("invalid UTF-8 bytes found, skipping bytes", log)

# Since the encoding of this string wasn't actually a valid UTF-8 string,
# we test situations where it's sent as the raw ISO-8859-1 value, as well
# as the UTF-8 replacement character.
expected_raw_in_url_path = url_encoded.downcase
expected_raw_in_url_query = url_encoded
expected_raw_in_header = " "
expected_raw_in_header = ""
expected_raw_utf8_in_url_path = "%ef%bf%bd"
expected_raw_utf8_in_url_query = "%EF%BF%BD"
expected_raw_utf8_in_header = Base64.decode64("77+9").force_encoding("utf-8")
Expand Down

0 comments on commit 3b3cab3

Please sign in to comment.