Skip to content

Commit

Permalink
test/openssl/test_config: fix non-deterministic test case
Browse files Browse the repository at this point in the history
Sort keys of a section before comparing. The ordering is not part of the
API. This can cause a test failure if we use OpenSSL's C implementation.

Fixes: 2ad65b5 ("config: support .include directive", 2018-08-16)
  • Loading branch information
rhenium committed May 13, 2020
1 parent 9ce2ccf commit 259e6fd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion test/openssl/test_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def test_s_parse_include
# Include a file by relative path
c1 = OpenSSL::Config.parse(include_file)
assert_equal(["default", "sec-a", "sec-b", "sec-main"], c1.sections.sort)
assert_equal(["file-main", "file-a", "file-b"], c1["default"].keys)
assert_equal(["file-a", "file-b", "file-main"], c1["default"].keys.sort)
assert_equal({"a" => "123"}, c1["sec-a"])
assert_equal({"b" => "123"}, c1["sec-b"])
assert_equal({"main" => "123", "key_outside_section" => "value_a"}, c1["sec-main"])
Expand Down

0 comments on commit 259e6fd

Please sign in to comment.