deimos-ruby 1.8.2.pre.beta1 → 1.8.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +48 -0
  3. data/Gemfile.lock +84 -79
  4. data/README.md +41 -3
  5. data/deimos-ruby.gemspec +2 -2
  6. data/docs/CONFIGURATION.md +1 -0
  7. data/docs/INTEGRATION_TESTS.md +52 -0
  8. data/docs/PULL_REQUEST_TEMPLATE.md +1 -0
  9. data/docs/UPGRADING.md +128 -0
  10. data/lib/deimos/active_record_consume/message_consumption.rb +9 -0
  11. data/lib/deimos/active_record_consumer.rb +8 -0
  12. data/lib/deimos/backends/db.rb +10 -1
  13. data/lib/deimos/config/configurable.rb +12 -0
  14. data/lib/deimos/config/configuration.rb +4 -0
  15. data/lib/deimos/config/phobos_config.rb +4 -1
  16. data/lib/deimos/kafka_source.rb +3 -2
  17. data/lib/deimos/kafka_topic_info.rb +2 -5
  18. data/lib/deimos/producer.rb +5 -3
  19. data/lib/deimos/schema_backends/avro_schema_coercer.rb +5 -3
  20. data/lib/deimos/schema_backends/avro_schema_registry.rb +1 -1
  21. data/lib/deimos/utils/db_poller.rb +2 -1
  22. data/lib/deimos/utils/db_producer.rb +5 -1
  23. data/lib/deimos/utils/inline_consumer.rb +9 -3
  24. data/lib/deimos/utils/schema_controller_mixin.rb +5 -1
  25. data/lib/deimos/version.rb +1 -1
  26. data/spec/active_record_consumer_spec.rb +13 -0
  27. data/spec/backends/db_spec.rb +6 -0
  28. data/spec/config/configuration_spec.rb +15 -0
  29. data/spec/generators/active_record_generator_spec.rb +1 -1
  30. data/spec/kafka_source_spec.rb +83 -0
  31. data/spec/kafka_topic_info_spec.rb +6 -6
  32. data/spec/producer_spec.rb +49 -0
  33. data/spec/schema_backends/avro_base_shared.rb +26 -1
  34. data/spec/schemas/com/my-namespace/request/CreateTopic.avsc +11 -0
  35. data/spec/schemas/com/my-namespace/response/CreateTopic.avsc +11 -0
  36. data/spec/spec_helper.rb +1 -1
  37. data/spec/utils/db_producer_spec.rb +27 -0
  38. data/spec/utils/inline_consumer_spec.rb +31 -0
  39. data/spec/utils/schema_controller_mixin_spec.rb +16 -0
  40. metadata +21 -13
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ce4c0e112957a2a8983372b2eda22b139e1eadac18945d4cbd9945c31e181b9d
4
- data.tar.gz: 43df5dcfd68305868cc2ac19f33c070bfc2d6b3c3679fc85116d81939e3a5ce2
3
+ metadata.gz: fb39b256f4c8fe4df29db4eb3605b3131d32910b09117d6bed254a06a887d615
4
+ data.tar.gz: 0d326e5d41ccc69b1da7670ee7a8b57655aae6f434b11365dd33b3297f75f488
5
5
  SHA512:
6
- metadata.gz: ffdbf97e2ad36eafd643cf958b44990a16315da4d346e8b5aaa8dacbdf8d0caecfd493063305b888e240091ab26f5a39bf044b8c3919419f2a6c35c460d774f8
7
- data.tar.gz: cb200f4a2d47519f2cb3f0f577a0295690842eb7a8367867749a3cc75236d7205eddb413cc22c28efba7b44b6c8d8a4a98744cd4d3adacedfbc2d64d690397d7
6
+ metadata.gz: 3e1f504e2b62f5e6a530ab79ced9e6116954131efe65885fc86fe3148d2fa019f8c6ddc803b723919ba3240dbbbddfa6747d8e8cb4a3dd36bfb534c87fb22870
7
+ data.tar.gz: efbaa2ca661b9dffbd815efea85da62af3486a4a4770f9b3601a4f1722dd1a995ea61aa7f3e79eb1339b7ecf79ad8532a2a04c6e1e52371987ac757d63a5cb3a
@@ -7,6 +7,54 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## UNRELEASED
9
9
 
10
+ ## 1.8.5 - 2021-01-13
11
+
12
+ - ### Fixes :wrench:
13
+ - Fixes for Rails 6.1 (remove usage of `update_attributes!`)
14
+
15
+ ## 1.8.4 - 2020-12-02
16
+
17
+ ### Features :star:
18
+ - Add overridable "process_message?" method to ActiveRecordConsumer to allow for skipping of saving/updating records
19
+
20
+ ### Fixes :wrench:
21
+
22
+ - Do not apply type coercion to `timestamp-millis` and `timestamp-micros` logical types (fixes [#97](https://github.com/flipp-oss/deimos/issues/97))
23
+
24
+ ## 1.8.3 - 2020-11-18
25
+
26
+ ### Fixes :wrench:
27
+ - Do not resend already sent messages when splitting up batches
28
+ (fixes [#24](https://github.com/flipp-oss/deimos/issues/24))
29
+ - KafkaSource crashing on bulk-imports if import hooks are disabled
30
+ (fixes [#73](https://github.com/flipp-oss/deimos/issues/73))
31
+ - #96 Use string-safe encoding for partition keys
32
+ - Retry on offset seek failures in inline consumer
33
+ (fixes [#5](Inline consumer should use retries when seeking))
34
+
35
+ ## 1.8.2 - 2020-09-25
36
+
37
+ ### Features :star:
38
+ - Add "disabled" config field to consumers to allow disabling
39
+ individual consumers without having to comment out their
40
+ entries and possibly affecting unit tests.
41
+
42
+ ### Fixes :wrench:
43
+ - Prepend topic_prefix while encoding messages
44
+ (fixes [#37](https://github.com/flipp-oss/deimos/issues/37))
45
+ - Raise error if producing without a topic
46
+ (fixes [#50](https://github.com/flipp-oss/deimos/issues/50))
47
+ - Don't try to load producers/consumers when running rake tasks involving webpacker or assets
48
+
49
+ ## 1.8.2-beta2 - 2020-09-15
50
+
51
+ ### Features :star:
52
+
53
+ - Add details on using schema backend directly in README.
54
+ - Default to the provided schema if topic is not provided when
55
+ encoding to `AvroSchemaRegistry`.
56
+ - Add mapping syntax for the `schema` call in `SchemaControllerMixin`.
57
+
10
58
  ## 1.8.2-beta1 - 2020-09-09
11
59
 
12
60
  ### Features :star:
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- deimos-ruby (1.8.2.pre.beta1)
4
+ deimos-ruby (1.8.5)
5
5
  avro_turf (~> 0.11)
6
6
  phobos (~> 1.9)
7
7
  ruby-kafka (~> 0.7)
@@ -10,63 +10,67 @@ PATH
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- actioncable (6.0.3.2)
14
- actionpack (= 6.0.3.2)
13
+ actioncable (6.1.1)
14
+ actionpack (= 6.1.1)
15
+ activesupport (= 6.1.1)
15
16
  nio4r (~> 2.0)
16
17
  websocket-driver (>= 0.6.1)
17
- actionmailbox (6.0.3.2)
18
- actionpack (= 6.0.3.2)
19
- activejob (= 6.0.3.2)
20
- activerecord (= 6.0.3.2)
21
- activestorage (= 6.0.3.2)
22
- activesupport (= 6.0.3.2)
18
+ actionmailbox (6.1.1)
19
+ actionpack (= 6.1.1)
20
+ activejob (= 6.1.1)
21
+ activerecord (= 6.1.1)
22
+ activestorage (= 6.1.1)
23
+ activesupport (= 6.1.1)
23
24
  mail (>= 2.7.1)
24
- actionmailer (6.0.3.2)
25
- actionpack (= 6.0.3.2)
26
- actionview (= 6.0.3.2)
27
- activejob (= 6.0.3.2)
25
+ actionmailer (6.1.1)
26
+ actionpack (= 6.1.1)
27
+ actionview (= 6.1.1)
28
+ activejob (= 6.1.1)
29
+ activesupport (= 6.1.1)
28
30
  mail (~> 2.5, >= 2.5.4)
29
31
  rails-dom-testing (~> 2.0)
30
- actionpack (6.0.3.2)
31
- actionview (= 6.0.3.2)
32
- activesupport (= 6.0.3.2)
33
- rack (~> 2.0, >= 2.0.8)
32
+ actionpack (6.1.1)
33
+ actionview (= 6.1.1)
34
+ activesupport (= 6.1.1)
35
+ rack (~> 2.0, >= 2.0.9)
34
36
  rack-test (>= 0.6.3)
35
37
  rails-dom-testing (~> 2.0)
36
38
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
37
- actiontext (6.0.3.2)
38
- actionpack (= 6.0.3.2)
39
- activerecord (= 6.0.3.2)
40
- activestorage (= 6.0.3.2)
41
- activesupport (= 6.0.3.2)
39
+ actiontext (6.1.1)
40
+ actionpack (= 6.1.1)
41
+ activerecord (= 6.1.1)
42
+ activestorage (= 6.1.1)
43
+ activesupport (= 6.1.1)
42
44
  nokogiri (>= 1.8.5)
43
- actionview (6.0.3.2)
44
- activesupport (= 6.0.3.2)
45
+ actionview (6.1.1)
46
+ activesupport (= 6.1.1)
45
47
  builder (~> 3.1)
46
48
  erubi (~> 1.4)
47
49
  rails-dom-testing (~> 2.0)
48
50
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
49
- activejob (6.0.3.2)
50
- activesupport (= 6.0.3.2)
51
+ activejob (6.1.1)
52
+ activesupport (= 6.1.1)
51
53
  globalid (>= 0.3.6)
52
- activemodel (6.0.3.2)
53
- activesupport (= 6.0.3.2)
54
- activerecord (6.0.3.2)
55
- activemodel (= 6.0.3.2)
56
- activesupport (= 6.0.3.2)
57
- activerecord-import (1.0.5)
54
+ activemodel (6.1.1)
55
+ activesupport (= 6.1.1)
56
+ activerecord (6.1.1)
57
+ activemodel (= 6.1.1)
58
+ activesupport (= 6.1.1)
59
+ activerecord-import (1.0.7)
58
60
  activerecord (>= 3.2)
59
- activestorage (6.0.3.2)
60
- actionpack (= 6.0.3.2)
61
- activejob (= 6.0.3.2)
62
- activerecord (= 6.0.3.2)
61
+ activestorage (6.1.1)
62
+ actionpack (= 6.1.1)
63
+ activejob (= 6.1.1)
64
+ activerecord (= 6.1.1)
65
+ activesupport (= 6.1.1)
63
66
  marcel (~> 0.3.1)
64
- activesupport (6.0.3.2)
67
+ mimemagic (~> 0.3.2)
68
+ activesupport (6.1.1)
65
69
  concurrent-ruby (~> 1.0, >= 1.0.2)
66
- i18n (>= 0.7, < 2)
67
- minitest (~> 5.1)
68
- tzinfo (~> 1.1)
69
- zeitwerk (~> 2.2, >= 2.2.2)
70
+ i18n (>= 1.6, < 2)
71
+ minitest (>= 5.1)
72
+ tzinfo (~> 2.0)
73
+ zeitwerk (~> 2.3)
70
74
  ast (2.4.1)
71
75
  avro (1.9.2)
72
76
  multi_json
@@ -83,11 +87,11 @@ GEM
83
87
  ddtrace (0.37.0)
84
88
  msgpack
85
89
  diff-lcs (1.4.4)
86
- digest-crc (0.6.1)
87
- rake (~> 13.0)
90
+ digest-crc (0.6.3)
91
+ rake (>= 12.0.0, < 14.0.0)
88
92
  dogstatsd-ruby (4.8.1)
89
- erubi (1.9.0)
90
- excon (0.76.0)
93
+ erubi (1.10.0)
94
+ excon (0.78.1)
91
95
  exponential-backoff (0.0.4)
92
96
  ffi (1.13.1)
93
97
  formatador (0.2.5)
@@ -110,7 +114,7 @@ GEM
110
114
  guard-rubocop (1.3.0)
111
115
  guard (~> 2.0)
112
116
  rubocop (~> 0.20)
113
- i18n (1.8.4)
117
+ i18n (1.8.7)
114
118
  concurrent-ruby (~> 1.0)
115
119
  listen (3.2.1)
116
120
  rb-fsevent (~> 0.10, >= 0.10.3)
@@ -119,7 +123,7 @@ GEM
119
123
  logging (2.3.0)
120
124
  little-plugger (~> 1.1)
121
125
  multi_json (~> 1.14)
122
- loofah (2.6.0)
126
+ loofah (2.8.0)
123
127
  crass (~> 1.0.2)
124
128
  nokogiri (>= 1.5.9)
125
129
  lumberjack (1.2.6)
@@ -130,15 +134,16 @@ GEM
130
134
  method_source (1.0.0)
131
135
  mimemagic (0.3.5)
132
136
  mini_mime (1.0.2)
133
- mini_portile2 (2.4.0)
134
- minitest (5.14.1)
137
+ mini_portile2 (2.5.0)
138
+ minitest (5.14.3)
135
139
  msgpack (1.3.3)
136
140
  multi_json (1.15.0)
137
141
  mysql2 (0.5.3)
138
142
  nenv (0.3.0)
139
- nio4r (2.5.2)
140
- nokogiri (1.10.10)
141
- mini_portile2 (~> 2.4.0)
143
+ nio4r (2.5.4)
144
+ nokogiri (1.11.1)
145
+ mini_portile2 (~> 2.5.0)
146
+ racc (~> 1.4)
142
147
  notiffany (0.1.3)
143
148
  nenv (~> 0.1)
144
149
  shellany (~> 0.0)
@@ -157,37 +162,38 @@ GEM
157
162
  pry (0.13.1)
158
163
  coderay (~> 1.1)
159
164
  method_source (~> 1.0)
165
+ racc (1.5.2)
160
166
  rack (2.2.3)
161
167
  rack-test (1.1.0)
162
168
  rack (>= 1.0, < 3)
163
- rails (6.0.3.2)
164
- actioncable (= 6.0.3.2)
165
- actionmailbox (= 6.0.3.2)
166
- actionmailer (= 6.0.3.2)
167
- actionpack (= 6.0.3.2)
168
- actiontext (= 6.0.3.2)
169
- actionview (= 6.0.3.2)
170
- activejob (= 6.0.3.2)
171
- activemodel (= 6.0.3.2)
172
- activerecord (= 6.0.3.2)
173
- activestorage (= 6.0.3.2)
174
- activesupport (= 6.0.3.2)
175
- bundler (>= 1.3.0)
176
- railties (= 6.0.3.2)
169
+ rails (6.1.1)
170
+ actioncable (= 6.1.1)
171
+ actionmailbox (= 6.1.1)
172
+ actionmailer (= 6.1.1)
173
+ actionpack (= 6.1.1)
174
+ actiontext (= 6.1.1)
175
+ actionview (= 6.1.1)
176
+ activejob (= 6.1.1)
177
+ activemodel (= 6.1.1)
178
+ activerecord (= 6.1.1)
179
+ activestorage (= 6.1.1)
180
+ activesupport (= 6.1.1)
181
+ bundler (>= 1.15.0)
182
+ railties (= 6.1.1)
177
183
  sprockets-rails (>= 2.0.0)
178
184
  rails-dom-testing (2.0.3)
179
185
  activesupport (>= 4.2.0)
180
186
  nokogiri (>= 1.6)
181
187
  rails-html-sanitizer (1.3.0)
182
188
  loofah (~> 2.3)
183
- railties (6.0.3.2)
184
- actionpack (= 6.0.3.2)
185
- activesupport (= 6.0.3.2)
189
+ railties (6.1.1)
190
+ actionpack (= 6.1.1)
191
+ activesupport (= 6.1.1)
186
192
  method_source
187
193
  rake (>= 0.8.7)
188
- thor (>= 0.20.3, < 2.0)
194
+ thor (~> 1.0)
189
195
  rainbow (3.0.0)
190
- rake (13.0.1)
196
+ rake (13.0.3)
191
197
  rb-fsevent (0.10.4)
192
198
  rb-inotify (0.10.1)
193
199
  ffi (~> 1.0)
@@ -239,20 +245,19 @@ GEM
239
245
  sprockets (4.0.2)
240
246
  concurrent-ruby (~> 1.0)
241
247
  rack (> 1, < 3)
242
- sprockets-rails (3.2.1)
248
+ sprockets-rails (3.2.2)
243
249
  actionpack (>= 4.0)
244
250
  activesupport (>= 4.0)
245
251
  sprockets (>= 3.0.0)
246
252
  sqlite3 (1.4.2)
247
253
  thor (1.0.1)
248
- thread_safe (0.3.6)
249
- tzinfo (1.2.7)
250
- thread_safe (~> 0.1)
254
+ tzinfo (2.0.4)
255
+ concurrent-ruby (~> 1.0)
251
256
  unicode-display_width (1.7.0)
252
257
  websocket-driver (0.7.3)
253
258
  websocket-extensions (>= 0.1.0)
254
259
  websocket-extensions (0.1.5)
255
- zeitwerk (2.4.0)
260
+ zeitwerk (2.4.2)
256
261
 
257
262
  PLATFORMS
258
263
  ruby
@@ -274,9 +279,9 @@ DEPENDENCIES
274
279
  rspec (~> 3)
275
280
  rspec-rails (~> 4)
276
281
  rspec_junit_formatter (~> 0.3)
277
- rubocop (~> 0.72)
278
- rubocop-rspec (~> 1.27)
282
+ rubocop (= 0.88.0)
283
+ rubocop-rspec (= 1.42.0)
279
284
  sqlite3 (~> 1.3)
280
285
 
281
286
  BUNDLED WITH
282
- 2.1.4
287
+ 2.2.5
data/README.md CHANGED
@@ -11,6 +11,7 @@ a useful toolbox of goodies for Ruby-based Kafka development.
11
11
  Built on Phobos and hence Ruby-Kafka.
12
12
 
13
13
  <!--ts-->
14
+ * [Additional Documentation](#additional-documentation)
14
15
  * [Installation](#installation)
15
16
  * [Versioning](#versioning)
16
17
  * [Configuration](#configuration)
@@ -29,9 +30,20 @@ Built on Phobos and hence Ruby-Kafka.
29
30
  * [Metrics](#metrics)
30
31
  * [Testing](#testing)
31
32
  * [Integration Test Helpers](#integration-test-helpers)
33
+ * [Utilities](#utilities)
32
34
  * [Contributing](#contributing)
33
35
  <!--te-->
34
36
 
37
+ # Additional Documentation
38
+
39
+ Please see the following for further information not covered by this readme:
40
+
41
+ * [Architecture Design](docs/ARCHITECTURE.md)
42
+ * [Configuration Reference](docs/CONFIGURATION.md)
43
+ * [Database Backend Feature](docs/DATABASE_BACKEND.md)
44
+ * [Upgrading Deimos](docs/UPGRADING.md)
45
+ * [Contributing to Integration Tests](docs/INTEGRATION_TESTS.md)
46
+
35
47
  # Installation
36
48
 
37
49
  Add this line to your application's Gemfile:
@@ -482,6 +494,12 @@ class WhateverController < ApplicationController
482
494
  # will look for: my.namespace.requests.Index.avsc
483
495
  # my.namespace.responses.Index.avsc
484
496
 
497
+ # Can use mapping to change the schema but keep the namespaces,
498
+ # i.e. use the same schema name across the two namespaces
499
+ schemas create: 'CreateTopic'
500
+ # will look for: my.namespace.requests.CreateTopic.avsc
501
+ # my.namespace.responses.CreateTopic.avsc
502
+
485
503
  # If all routes use the default, you can add them all at once
486
504
  schemas :index, :show, :update
487
505
 
@@ -608,6 +626,15 @@ class MyConsumer < Deimos::ActiveRecordConsumer
608
626
  def record_key(payload)
609
627
  super
610
628
  end
629
+
630
+ # Optional override, returns true by default.
631
+ # When this method returns true, a record corresponding to the message
632
+ # is created/updated.
633
+ # When this method returns false, message processing is skipped and a
634
+ # corresponding record will NOT be created/updated.
635
+ def process_message?(payload)
636
+ super
637
+ end
611
638
  end
612
639
  ```
613
640
 
@@ -989,13 +1016,24 @@ Deimos::Utils::InlineConsumer.get_messages_for(
989
1016
  )
990
1017
  ```
991
1018
 
1019
+ ## Utilities
1020
+
1021
+ You can use your configured schema backend directly if you want to
1022
+ encode and decode payloads outside of the context of sending messages.
1023
+
1024
+ ```ruby
1025
+ backend = Deimos.schema_backend(schema: 'MySchema', namespace: 'com.my-namespace')
1026
+ encoded = backend.encode(my_payload)
1027
+ decoded = backend.decode(my_encoded_payload)
1028
+ coerced = backend.coerce(my_payload) # coerce to correct types
1029
+ backend.validate(my_payload) # throws an error if not valid
1030
+ fields = backend.schema_fields # list of fields defined in the schema
1031
+ ```
1032
+
992
1033
  ## Contributing
993
1034
 
994
1035
  Bug reports and pull requests are welcome on GitHub at https://github.com/flipp-oss/deimos .
995
1036
 
996
- We have more information on the [internal architecture](docs/ARCHITECTURE.md) of Deimos
997
- for contributors!
998
-
999
1037
  ### Linting
1000
1038
 
1001
1039
  Deimos uses Rubocop to lint the code. Please run Rubocop on your code
@@ -38,7 +38,7 @@ Gem::Specification.new do |spec|
38
38
  spec.add_development_dependency('rspec', '~> 3')
39
39
  spec.add_development_dependency('rspec_junit_formatter', '~>0.3')
40
40
  spec.add_development_dependency('rspec-rails', '~> 4')
41
- spec.add_development_dependency('rubocop', '~> 0.72')
42
- spec.add_development_dependency('rubocop-rspec', '~> 1.27')
41
+ spec.add_development_dependency('rubocop', '0.88.0')
42
+ spec.add_development_dependency('rubocop-rspec', '1.42.0')
43
43
  spec.add_development_dependency('sqlite3', '~> 1.3')
44
44
  end
@@ -79,6 +79,7 @@ topic|nil|Topic to produce to.
79
79
  schema|nil|This is optional but strongly recommended for testing purposes; this will validate against a local schema file used as the reader schema, as well as being able to write tests against this schema. This is recommended since it ensures you are always getting the values you expect.
80
80
  namespace|nil|Namespace of the schema to use when finding it locally.
81
81
  key_config|nil|Configuration hash for message keys. See [Kafka Message Keys](../README.md#installation)
82
+ disabled|false|Set to true to skip starting an actual listener for this consumer on startup.
82
83
  group_id|nil|ID of the consumer group.
83
84
  max_concurrency|1|Number of threads created for this listener. Each thread will behave as an independent consumer. They don't share any state.
84
85
  start_from_beginning|true|Once the consumer group has checkpointed its progress in the topic's partitions, the consumers will always start from the checkpointed offsets, regardless of config. As such, this setting only applies when the consumer initially starts consuming from a topic
@@ -0,0 +1,52 @@
1
+ # Running Integration Tests
2
+
3
+ This repo includes integration tests in the [spec/utils](spec/utils) directory.
4
+ Here, there are tests for more deimos features that include a database integration like
5
+ * [Database Poller](README.md#Database Poller)
6
+ * [Database Backend](docs/DATABASE_BACKEND.md)
7
+ * [Deadlock Retrying](lib/deimos/utils/deadlock_retry.rb)
8
+
9
+ You will need to set up the following databases to develop and create unit tests in these test suites.
10
+ * [SQLite](#SQLite)
11
+ * [MySQL](#MySQL)
12
+ * [PostgreSQL](#PostgreSQL)
13
+
14
+ ### SQLite
15
+ This database is covered through the `sqlite3` gem.
16
+
17
+ ## MySQL
18
+ ### Setting up a local MySQL server (Mac)
19
+ ```bash
20
+ # Download MySQL (Optionally, choose a version you are comfortable with)
21
+ brew install mysql
22
+ # Start automatically after rebooting your machine
23
+ brew services start mysql
24
+
25
+ # Cleanup once you are done with MySQL
26
+ brew services stop mysql
27
+ ```
28
+
29
+ ## PostgreSQL
30
+ ### Setting up a local PostgreSQL server (Mac)
31
+ ```bash
32
+ # Install postgres if it's not already installed
33
+ brew install postgres
34
+
35
+ # Initialize and Start up postgres db
36
+ brew services start postgres
37
+ initdb /usr/local/var/postgres
38
+ # Create the default database and user
39
+ # Use the password "root"
40
+ createuser -s --password postgres
41
+
42
+ # Cleanup once done with Postgres
43
+ killall postgres
44
+ brew services stop postgres
45
+ ```
46
+
47
+ ## Running Integration Tests
48
+ You must specify the tag "integration" when running these these test suites.
49
+ This can be done through the CLI with the `--tag integration` argument.
50
+ ```bash
51
+ rspec spec/utils/ --tag integration
52
+ ```