Add this line to your application's Gemfile:
gem 'avro_contract_testing', git: 'https://github.com/viewthespace/avro_contract_testing.git'
And then execute:
$ bundle
AvroContractTesting.configure do |config|
config.s3_bucket_name = S3_BUCKET_NAME
config.application_name = APPLICATION_NAME
config.aws_access_key_id = AWS_ACCESS_KEY_ID
config.aws_secret_access_key = AWS_SCECRET_KEY
config.schema_path = SCHEMA_PATH
config.region = REGION
end
describe 'test schema' do
let(:producer_schema) { AvroTurf::SchemaStore.new(path: SCHEMA_PATH).find('test_schema').to_s }
AvroContractTesting::SchemaRepository.consumers('test_schema').each do |consumer|
it "is compatible with consumer: #{consumer.name}" do
expect(consumer).to be_compatible(producer_schema)
end
end
end
AvroContractTesting::SchemaRepository.upload(SCHEMA_NAME)
After checking out the repo, run bin/setup
to install dependencies. Then, run rspec && rubocop
to run the tests and linter. You can also run bin/console
for an interactive prompt that will allow you to experiment.