Skip to content

Commit

Permalink
Merge pull request #721 from junaruga/wip/conditional-legacy-provider…
Browse files Browse the repository at this point in the history
…-test

test_provider.rb: Make a legacy provider test optional.
  • Loading branch information
rhenium authored Mar 13, 2024
2 parents b77ef14 + 7223da7 commit 043c503
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ jobs:
- { os: ubuntu-latest, ruby: "3.0", openssl: openssl-3.2.1, fips-enabled: true, append-configure: 'enable-fips', name-extra: 'fips' }
- { os: ubuntu-latest, ruby: "3.0", openssl: openssl-head, git: 'git://git.openssl.org/openssl.git', branch: 'master' }
- { 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' }
- { 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' }
steps:
- name: repo checkout
uses: actions/checkout@v4
Expand Down
19 changes: 10 additions & 9 deletions test/openssl/test_provider.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,14 @@ def test_openssl_provider_name_inspect
end

def test_openssl_provider_names
omit if /freebsd/ =~ RUBY_PLATFORM

with_openssl <<-'end;'
legacy_provider = OpenSSL::Provider.load("legacy")
base_provider = OpenSSL::Provider.load("base")
assert_equal(2, OpenSSL::Provider.provider_names.size)
assert_includes(OpenSSL::Provider.provider_names, "legacy")
assert_includes(OpenSSL::Provider.provider_names, "base")
assert_equal(true, legacy_provider.unload)
assert_equal(true, base_provider.unload)
assert_equal(1, OpenSSL::Provider.provider_names.size)
assert_not_includes(OpenSSL::Provider.provider_names, "legacy")
assert_not_includes(OpenSSL::Provider.provider_names, "base")
end;
end

Expand All @@ -35,10 +33,13 @@ def test_unloaded_openssl_provider
end

def test_openssl_legacy_provider
omit if /freebsd/ =~ RUBY_PLATFORM

with_openssl(<<-'end;')
OpenSSL::Provider.load("legacy")
begin
OpenSSL::Provider.load("legacy")
rescue OpenSSL::Provider::ProviderError
omit "Only for OpenSSL with legacy provider"
end
algo = "RC4"
data = "a" * 1000
key = OpenSSL::Random.random_bytes(16)
Expand Down

0 comments on commit 043c503

Please sign in to comment.