diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 15:08:53 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 15:08:53 +0300 |
commit | 110225407ff1476b102ae905ba2e9a01e5ab34a2 (patch) | |
tree | 0959369327271f807266606a882aaf479dc96e00 /spec/lib | |
parent | b28d414aeffb5d1974747325a3be905dd42f2ad0 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib')
-rw-r--r-- | spec/lib/gitlab/tracking/snowplow_schema_validation_spec.rb | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/spec/lib/gitlab/tracking/snowplow_schema_validation_spec.rb b/spec/lib/gitlab/tracking/snowplow_schema_validation_spec.rb new file mode 100644 index 00000000000..32c601ae47d --- /dev/null +++ b/spec/lib/gitlab/tracking/snowplow_schema_validation_spec.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'Snowplow Schema Validation' do + context 'snowplow events definition' do + shared_examples 'matches schema' do + it 'conforms schema json' do + paths = Dir[Rails.root.join(yaml_path)] + + events = paths.each_with_object([]) do |path, metrics| + metrics.push( + YAML.safe_load(File.read(path), aliases: true) + ) + end + + expect(events).to all match_schema(Rails.root.join('config/events/schema.json')) + end + end + + describe 'matches the schema for CE' do + let(:yaml_path) { 'config/events/*.yml' } + + it_behaves_like 'matches schema' + end + + describe 'matches the schema for EE' do + let(:yaml_path) { 'ee/config/events/*.yml' } + + it_behaves_like 'matches schema' + end + end +end |