Skip to content
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

Push raising error message #269

Merged
merged 27 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
e31e742
Push raising error message
nd4p90x Apr 17, 2024
d3cb44a
Update codecov token
MichaelGHSeg May 1, 2024
89fe8e2
Trying another format
MichaelGHSeg May 1, 2024
18fc214
Add codecov gh action to replace per-test upload
MichaelGHSeg May 1, 2024
c1b7951
Remove deprecated codecov uploader
MichaelGHSeg May 1, 2024
08e2049
Removing codecov dependency, using GH actions instead
MichaelGHSeg May 1, 2024
a77c1f3
Adding new codecov depenencies
MichaelGHSeg May 1, 2024
a0f577f
Adding new cov formatter
MichaelGHSeg May 1, 2024
fbe081b
Fixing nit from codecov's tutorial code
MichaelGHSeg May 1, 2024
42d4dd8
Codecov says commit yaml was invalid, reverting?
MichaelGHSeg May 1, 2024
8733904
Merge pull request #271 from segmentio/MichaelGHSegcodecov-token
MichaelGHSeg May 2, 2024
91548db
Push raising error message
nd4p90x Apr 17, 2024
bc16068
Merge branch 'Issue-268-Raise-Error' of github.com:North-Two-Five/ana…
nd4p90x May 2, 2024
d993c8e
Resolve test response issue
nd4p90x May 28, 2024
ce515b2
update
nd4p90x May 28, 2024
aded43d
update
nd4p90x May 28, 2024
2440e09
update
nd4p90x May 28, 2024
9b190dd
update
nd4p90x May 28, 2024
44c94ce
upd
nd4p90x May 28, 2024
bad6777
upd
nd4p90x May 28, 2024
b4506dd
upd
nd4p90x May 28, 2024
78bf82e
upd
nd4p90x May 28, 2024
f26d642
test
nd4p90x May 28, 2024
91a24a5
updt
nd4p90x May 28, 2024
6ede327
Final Adjustment
nd4p90x May 28, 2024
bdf9d9d
Fix auto correct quotes and spaces
nd4p90x May 28, 2024
ee68d65
Missed a few single quotes
nd4p90x May 28, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/gem-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
packages: write

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,15 @@ jobs:
ruby-version: ['2.4', '2.5', '2.6', '2.7', '3.0', '3.1', '3.2']

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Run tests
run: bundle exec rake
- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
source 'http://rubygems.org'
gemspec

gem 'simplecov'
gem 'simplecov-cobertura'
1 change: 0 additions & 1 deletion analytics-ruby.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,4 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'oj', '~> 3.6.2'
end
spec.add_development_dependency 'rubocop', '~> 1.0'
spec.add_development_dependency 'codecov', '~> 0.6'
end
1 change: 1 addition & 0 deletions lib/segment/analytics/message_batch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
message_json_size = message_json.bytesize
if message_too_big?(message_json_size)
logger.error('a message exceeded the maximum allowed size')
raise JSONGenerationError, 'Message Exceeded Maximum Allowed Size'

Check warning on line 32 in lib/segment/analytics/message_batch.rb

View check run for this annotation

Codecov / codecov/patch

lib/segment/analytics/message_batch.rb#L32

Added line #L32 was not covered by tests
else
@messages << message
@json_size += message_json_size + 1 # One byte for the comma
Expand Down
7 changes: 6 additions & 1 deletion spec/segment/analytics/message_batch_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,21 @@ class Analytics

describe '#<<' do
it 'appends messages' do
expect(subject.length).to eq(0)

subject << { 'a' => 'b' }

expect(subject.length).to eq(1)
end

it 'rejects messages that exceed the maximum allowed size' do
max_bytes = Defaults::Message::MAX_BYTES
message = { 'a' => 'b' * max_bytes }

subject << message
expect(subject.length).to eq(0)

expect { subject << message }.to raise_error(MessageBatch::JSONGenerationError)
.with_message('Message Exceeded Maximum Allowed Size')
end
end

Expand Down
5 changes: 2 additions & 3 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# frozen_string_literal: true

# https://github.com/codecov/codecov-ruby#usage
require 'simplecov'
SimpleCov.start
require 'codecov'
SimpleCov.formatter = SimpleCov::Formatter::Codecov
require 'simplecov-cobertura'
SimpleCov.formatter = SimpleCov::Formatter::CoberturaFormatter

require 'segment/analytics'
require 'active_support/time'
Expand Down
Loading