Skip to content

Commit 043c503

Browse files
authored
Merge pull request #721 from junaruga/wip/conditional-legacy-provider-test
test_provider.rb: Make a legacy provider test optional.
2 parents b77ef14 + 7223da7 commit 043c503

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ jobs:
100100
- { os: ubuntu-latest, ruby: "3.0", openssl: openssl-3.2.1, fips-enabled: true, append-configure: 'enable-fips', name-extra: 'fips' }
101101
- { os: ubuntu-latest, ruby: "3.0", openssl: openssl-head, git: 'git://git.openssl.org/openssl.git', branch: 'master' }
102102
- { os: ubuntu-latest, ruby: "3.0", openssl: openssl-head, git: 'git://git.openssl.org/openssl.git', branch: 'master', fips-enabled: true, append-configure: 'enable-fips', name-extra: 'fips' }
103+
- { os: ubuntu-latest, ruby: "3.0", openssl: openssl-head, git: 'git://git.openssl.org/openssl.git', branch: 'master', append-configure: 'no-legacy', name-extra: 'no-legacy' }
103104
steps:
104105
- name: repo checkout
105106
uses: actions/checkout@v4

test/openssl/test_provider.rb

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,14 @@ def test_openssl_provider_name_inspect
1212
end
1313

1414
def test_openssl_provider_names
15-
omit if /freebsd/ =~ RUBY_PLATFORM
16-
1715
with_openssl <<-'end;'
18-
legacy_provider = OpenSSL::Provider.load("legacy")
16+
base_provider = OpenSSL::Provider.load("base")
1917
assert_equal(2, OpenSSL::Provider.provider_names.size)
20-
assert_includes(OpenSSL::Provider.provider_names, "legacy")
18+
assert_includes(OpenSSL::Provider.provider_names, "base")
2119
22-
assert_equal(true, legacy_provider.unload)
20+
assert_equal(true, base_provider.unload)
2321
assert_equal(1, OpenSSL::Provider.provider_names.size)
24-
assert_not_includes(OpenSSL::Provider.provider_names, "legacy")
22+
assert_not_includes(OpenSSL::Provider.provider_names, "base")
2523
end;
2624
end
2725

@@ -35,10 +33,13 @@ def test_unloaded_openssl_provider
3533
end
3634

3735
def test_openssl_legacy_provider
38-
omit if /freebsd/ =~ RUBY_PLATFORM
39-
4036
with_openssl(<<-'end;')
41-
OpenSSL::Provider.load("legacy")
37+
begin
38+
OpenSSL::Provider.load("legacy")
39+
rescue OpenSSL::Provider::ProviderError
40+
omit "Only for OpenSSL with legacy provider"
41+
end
42+
4243
algo = "RC4"
4344
data = "a" * 1000
4445
key = OpenSSL::Random.random_bytes(16)

0 commit comments

Comments
 (0)