Skip to content

run a verbose test #353

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,10 @@ jobs:
done
cat ${{ github.workspace }}/setup.sql | cockroach sql --insecure
- name: Test
run: bundle exec rake test TESTOPTS='--profile=5'
run: AR_LOG=summary bundle exec rake test TESTOPTS='--stackprof=tmp/stackprof.dump --profile-setup --profile=5 --verbose'
- name: Upload test information
uses: actions/upload-artifact@v4
if: always()
with:
name: crdb-${{ matrix.crdb }}_ruby-${{ matrix.ruby }}_test_information
path: tmp/*
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ group :development, :test do
gem "minitest-github_action_reporter", github: "BuonOmo/minitest-github_action_reporter", require: "minitest/github_action_reporter_plugin"
gem "ostruct", "~> 0.6"

gem "minitest-stackprof"

# Gems used for tests meta-programming.
gem "parser"

Expand Down
2 changes: 1 addition & 1 deletion bin/start-cockroachdb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ die() { echo "$0: $*" 1>&2 ; false; }

root_dir="$(dirname $(dirname "$0:A"))"
pid_file="$root_dir/tmp/cockroach.pid"
log_file="$root_dir/tmp/cockroachdb.log"
log_file="$root_dir/tmp/cockroach.log"

mkdir -p "$root_dir/tmp"
[[ -f "$pid_file" ]] && kill -9 $(cat "$pid_file") || true
Expand Down
6 changes: 6 additions & 0 deletions test/cases/helper_cockroachdb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -222,3 +222,9 @@ def header(stream)
class BaseCompatibilityTest < ActiveRecord::TestCase
self.use_transactional_tests = false
end

FileUtils.mkdir_p("tmp")

# require "stackprof"
# StackProf.start(mode: :wall, interval: 1000, out: "tmp/stackprof.dump", raw: true)
# Minitest.after_run { StackProf.stop; StackProf.results("tmp/stackprof.dump") }
4 changes: 2 additions & 2 deletions test/support/sql_logger.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ def summary_log
time = detail.values.sum { |(total, _, _)| total } / 1_000
count = detail.values.sum { |(_, _, count)| count }
puts "Total time spent in SQL: #{time}s (#{count} queries)"
puts "Detail per query kind available in tmp/query_time.json (total time in ms, avg time in ms, query count). Sorted by avg time."
puts "Detail per query kind available in #{Dir.pwd}/tmp/query_time.json (total time in ms, avg time in ms, query count). Sorted by avg time."
File.write(
"tmp/query_time.json",
Dir.pwd + "/tmp/query_time.json",
JSON.pretty_generate(detail)
)
}
Expand Down
Loading