adding smoke tests layer

mostly testing ipv6 connectivity now
This commit is contained in:
HoneyryderChuck 2024-12-16 10:57:13 +00:00
parent ec27524a3a
commit 8fd2f4316a
4 changed files with 50 additions and 0 deletions

View File

@ -121,6 +121,22 @@ regression tests:
- bundle install
script:
- bundle exec rake regression_tests
smoke_tests:
image: "ruby:3.3"
variables:
BUNDLE_WITHOUT: lint:assorted
CI: 1
COVERAGE_KEY: "$RUBY_ENGINE-$RUBY_VERSION-smoke-tests"
artifacts:
paths:
- coverage/
stage: test
before_script:
- host example.com
- apt-get update && apt-get install -y libmagic-dev shared-mime-info
- bundle install
script:
- bundle exec rake smoke_tests
coverage:
coverage: '/Coverage: \d+.\d+\%/'

View File

@ -14,6 +14,7 @@ AllCops:
- regression_tests/**/*.rb
- integration_tests/**/*.rb
- standalone_tests/**/*.rb
- smoke_tests/**/*.rb
- Rakefile
- httpx.gemspec
- profiler/**/*

View File

@ -24,6 +24,13 @@ Rake::TestTask.new(:regression_tests) do |t|
t.warning = false
end
desc "smoke tests for core features not in main tests"
Rake::TestTask.new(:smoke_tests) do |t|
t.libs = %w[lib test]
t.pattern = "smoke_tests/**/*_test.rb"
t.warning = false
end
RUBY_MAJOR_MINOR = RUBY_VERSION.split(".").first(2).join(".")
begin

View File

@ -0,0 +1,26 @@
# frozen_string_literal: true
require "test_helper"
require "support/http_helpers"
# https://test-ipv6.com/
class HappyEyeballsTest < Minitest::Test
include HTTPHelpers
IPV6_HOST = "https://ipv6.test-ipv6.com"
IPV4_HOST = "https://ipv4.test-ipv6.com"
def test_happy_eyeballs_prefer_ipv6
response = HTTPX.get(IPV6_HOST)
verify_status(response, 200)
peer_address = response.peer_address
assert peer_address.ipv6?
end
def test_happy_eyeballs_prefer_ipv4
response = HTTPX.get(IPV4_HOST)
verify_status(response, 200)
peer_address = response.peer_address
assert peer_address.ipv4?
end
end