Skip to content

Commit

Permalink
Merge branch '1.x-stable' into delner/add_2x_deprecation_warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
ivoanjo authored Dec 9, 2024
2 parents 4b44893 + 19b2d38 commit 2a836ad
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 65 deletions.
12 changes: 8 additions & 4 deletions .github/workflows/lib-injection.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ on:
jobs:
build-and-publish-test-image:
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
Expand Down Expand Up @@ -50,20 +52,21 @@ jobs:
env:
TEST_LIBRARY: ruby
WEBLOG_VARIANT: ${{ matrix.weblog-variant }}
DOCKER_REGISTRY_IMAGES_PATH: ghcr.io/datadog
DOCKER_IMAGE_TAG: ${{ github.sha }}
LIB_INIT_IMAGE: ghcr.io/datadog/dd-trace-rb/dd-lib-ruby-init:${{ github.sha }}
LIBRARY_INJECTION_TEST_APP_IMAGE: ghcr.io/datadog/system-tests/${{ matrix.weblog-variant }}:latest
BUILDX_PLATFORMS: linux/amd64,linux/arm64/v8
steps:
- name: Checkout system tests
uses: actions/checkout@v4
with:
repository: 'DataDog/system-tests'
persist-credentials: false

- name: Install runner
uses: ./.github/actions/install_runner
uses: ./.github/actions/install_runner

- name: Run K8s Lib Injection Tests
run: ./run.sh K8S_LIB_INJECTION_BASIC
run: ./run.sh K8S_LIBRARY_INJECTION_BASIC

- name: Compress logs
id: compress_logs
Expand Down Expand Up @@ -91,6 +94,7 @@ jobs:
uses: actions/checkout@v4
with:
repository: DataDog/system-tests
persist-credentials: false
path: system-tests
- name: Overwrite auto inject script with commit SHA
run: |
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/system-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,15 @@ jobs:
- name: proxy
internal: datadog/system-tests:proxy-v1
runs-on: ubuntu-latest
permissions:
packages: write
name: Build (${{ matrix.image.name }})
steps:
- name: Checkout
uses: actions/checkout@v4
with:
repository: 'DataDog/system-tests'
persist-credentials: false
- name: Pull released image
run: |
if docker pull ${{ env.REPO }}/system-tests/${{ matrix.image.name }}:latest; then
Expand Down Expand Up @@ -99,11 +102,14 @@ jobs:
- rails71
runs-on: ubuntu-latest
name: Build (${{ matrix.app }})
permissions:
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
repository: 'DataDog/system-tests'
persist-credentials: false
- name: Checkout ${{ matrix.library.repository }}
uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -250,6 +256,7 @@ jobs:
uses: actions/checkout@v4
with:
repository: 'DataDog/system-tests'
persist-credentials: false
- name: Pull runner image
run: |
docker pull ${{ env.REPO }}/system-tests/runner:gha${{ github.run_id }}-g${{ github.sha }}
Expand Down Expand Up @@ -316,6 +323,7 @@ jobs:
uses: actions/checkout@v4
with:
repository: 'DataDog/system-tests'
persist-credentials: false
- name: Retrieve logs
uses: actions/download-artifact@v4
with:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/update-gemfiles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ jobs:
check:
name: Update Gemfiles
runs-on: ubuntu-22.04
permissions:
contents: write
pull-requests: write
steps:
# Only execute if there's a PR attached to this branch.
# Because we execute on `push`, we have to double check here if this is part of a PR.
Expand Down
20 changes: 6 additions & 14 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ stages:
include:
- remote: https://gitlab-templates.ddbuild.io/apm/packaging.yml
- local: ".gitlab/benchmarks.yml"
- local: ".gitlab/onboarding_tests.yml"
- remote: https://gitlab-templates.ddbuild.io/libdatadog/include/single-step-instrumentation-tests.yml

variables:
DOWNSTREAM_BRANCH:
Expand Down Expand Up @@ -199,27 +199,19 @@ oci-internal-test-ecr-publish:
IMG_REGISTRIES: agent-qa

onboarding_tests:
extends: .base_job_onboarding_tests
extends: .base_job_onboarding
stage: integration-tests
needs: [ package-amd64, package-arm64, oci-internal-test-ecr-publish]
needs: [ oci-internal-test-ecr-publish ]
allow_failure: false
variables:
TEST_LIBRARY: ruby
ONBOARDING_FILTER_ENV: prod
SCENARIO: SIMPLE_INSTALLER_AUTO_INJECTION
DD_INSTALLER_LIBRARY_VERSION: pipeline-${CI_PIPELINE_ID}
parallel:
matrix:
- ONBOARDING_FILTER_WEBLOG: [test-app-ruby]
SCENARIO: [SIMPLE_HOST_AUTO_INJECTION]
- ONBOARDING_FILTER_WEBLOG: [test-app-ruby-container]
SCENARIO: [SIMPLE_CONTAINER_AUTO_INJECTION]
- ONBOARDING_FILTER_WEBLOG: [test-app-ruby,test-app-ruby-container]
SCENARIO: [INSTALLER_AUTO_INJECTION]
- ONBOARDING_FILTER_WEBLOG: [test-app-ruby, test-app-ruby-container]
script:
- git clone https://[email protected]/DataDog/system-tests.git system-tests
- cp packaging/*.rpm system-tests/binaries
- cp packaging/*.deb system-tests/binaries
- export DD_INSTALLER_LIBRARY_VERSION="pipeline-${CI_PIPELINE_ID}"
- ls system-tests/binaries
- cd system-tests
- ./build.sh -i runner
- timeout 2700s ./run.sh $SCENARIO --vm-weblog ${ONBOARDING_FILTER_WEBLOG} --vm-env prod --vm-library ${TEST_LIBRARY} --vm-provider aws --vm-skip-branches ubuntu18_amd64
Expand Down
34 changes: 0 additions & 34 deletions .gitlab/onboarding_tests.yml

This file was deleted.

6 changes: 5 additions & 1 deletion integration/apps/rack/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ source "https://rubygems.org"

gem 'puma'
gem 'unicorn'
gem 'passenger'
if RUBY_VERSION < '2.6.0'
gem 'passenger', '< 6.0.23'
else
gem 'passenger'
end
gem 'rack'
gem 'rackup' if RUBY_VERSION >= '2.4' # The `rackup` is its own gem since Rack 3.0

Expand Down
4 changes: 3 additions & 1 deletion lib/datadog/tracing.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,11 @@ def correlation
# # dd.env=prod dd.service=auth dd.version=13.8 dd.trace_id=5458478252992251 dd.span_id=7117552347370098 My message
# ```
#
# @return [String] correlation information
# @return [String] correlation information; or an empty String if Tracing is disabled (`!enabled?`)
# @public_api
def log_correlation
return '' unless enabled?

correlation.to_log_format
end

Expand Down
22 changes: 11 additions & 11 deletions spec/datadog/core/environment/execution_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@

context 'when in an IRB session' do
it 'returns true' do
_, err = Bundler.with_clean_env do # Ruby 2.6 does not have irb by default in a bundle, but has it outside of it.
Open3.capture3('irb', '--noprompt', '--noverbose', stdin_data: repl_script)
_, err, = Bundler.with_clean_env do # Ruby 2.6 does not have irb by default in a bundle, but has it outside of it.
Open3.capture3('irb', '--noprompt', '--noverbose', '--noecho', stdin_data: repl_script)
end
expect(err).to end_with('true')
expect(err).to end_with('ACTUAL:true')
end
end

Expand All @@ -70,8 +70,8 @@
f.write(repl_script)
f.close

out, = Open3.capture2e('pry', '-f', '--noprompt', f.path)
expect(out).to eq('ACTUAL:true')
_, err, = Open3.capture3('pry', '-f', '--noprompt', f.path)
expect(err).to end_with('ACTUAL:true')
end
end
end
Expand Down Expand Up @@ -128,7 +128,7 @@ def test_it_does_something_useful

it 'returns true' do
_, err, = Open3.capture3('ruby', stdin_data: script)
expect(err).to end_with('true')
expect(err).to end_with('ACTUAL:true')
end
end

Expand Down Expand Up @@ -186,9 +186,10 @@ def test_it_does_something_useful
# Add our script to `env.rb`, which is always run before any feature is executed.
File.write('features/support/env.rb', repl_script)

_, err = Bundler.with_clean_env do
_, err, = Bundler.with_clean_env do
Open3.capture3('ruby', stdin_data: script)
end

expect(err).to include('ACTUAL:true')
end
end
Expand Down Expand Up @@ -252,7 +253,7 @@ def test_it_does_something_useful

context 'when given WebMock', skip: Gem::Version.new(Bundler::VERSION) < Gem::Version.new('2') do
it do
out, err = Bundler.with_clean_env do
out, = Bundler.with_clean_env do
Open3.capture3('ruby', stdin_data: <<-RUBY
require 'bundler/inline'
Expand All @@ -268,13 +269,12 @@ def test_it_does_something_useful
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'datadog/core/environment/execution'
STDOUT.print Datadog::Core::Environment::Execution.webmock_enabled?
STDOUT.print "ACTUAL:\#{Datadog::Core::Environment::Execution.webmock_enabled?}"
RUBY
)
end

expect(err).to be_empty
expect(out).to eq('true')
expect(out).to end_with('ACTUAL:true')
end
end
end
Expand Down
10 changes: 10 additions & 0 deletions spec/datadog/tracing_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,16 @@
expect(log_correlation).to eq(returned)
end
# rubocop:enable RSpec/MessageChain

context 'with tracing disabled' do
before do
allow(Datadog.send(:components).tracer).to receive(:enabled).and_return(false)
end

it 'returns an empty string' do
expect(log_correlation).to eq('')
end
end
end

describe '.shutdown!' do
Expand Down

0 comments on commit 2a836ad

Please sign in to comment.