1
- ##
1
+ # Contributing
2
2
3
+ ## Development Workflow
4
+
5
+ This project uses the most basic development workflow possible:
6
+
7
+ * Identify a problem
8
+ * Add a failing test or any other way to reproduce it
9
+ * Fix it
10
+ * Make sure all tests pass
11
+ * Submit a pull request on GitHub explaining ** why** the change it necessary
12
+ and how to reproduce it
13
+ * Wait for maintainer's feedback
14
+
15
+ That's about it.
3
16
4
17
## Running Tests
5
18
6
- First, run Carthage bootstrap:
19
+ ### Building Dependencies
20
+
21
+ Carthage bootstrap will clone and build the dependencies:
7
22
8
23
```
9
24
gmake bootstrap
10
25
```
11
26
12
- Then start a local RabbitMQ node (any way you please, doesn't have to be from Homebrew or source),
13
- configure it using files under ` .travis/etc/ ` and enable the
14
- [ x509 certificate authentication mechanism] ( https://github.com/rabbitmq/rabbitmq-auth-mechanism-ssl ) :
27
+ ### Run a Local RabbitMQ Node
28
+
29
+ There are two sets of tests that can be executed, each with its own
30
+ XCode scheme:
31
+
32
+ * Unit and integration tests (core tests) use the ` RMQClient ` scheme
33
+ and can be executed against a RabbitMQ node with stock defaults
34
+ (assuming that certain setup targets are executed, see below)
35
+ * TLS tests use the ` RMQClient with TLS tests ` scheme and requires
36
+ a RabbitMQ node configured in a particular way
37
+
38
+ The RabbitMQ node can be installed from Homebrew or by downloading
39
+ and extracting a [ generic binary build] ( https://www.rabbitmq.com/install-generic-unix.html ) .
40
+
41
+ ### Node Configuration for TLS Tests
15
42
16
- brew install rabbitmq
17
- cp .travis/etc/* /path/to/etc/rabbitmq/
18
- rabbitmq-plugins enable rabbitmq_auth_mechanism_ssl
43
+ To configure a node to run the TLS tests, configure the node to use the [ certificates and keys] ( https://www.rabbitmq.com/ssl.html#certificates-and-keys )
44
+ under ` TestCertificates ` . The certificates have a Subject Alternative Name of ` localhost `
45
+ which makes them not to be dependent on the host they were generated on.
46
+
47
+ The following minimalistic [ RabbitMQ configuration file] ( https://www.rabbitmq.com/configure.html#configuration-files ) is used by CI:
48
+
49
+ ``` ini
50
+ listeners.tcp.1 = 0.0.0.0:5672
51
+ listeners.tcp.2 = 0.0.0.0:5674
52
+
53
+
54
+ listeners.ssl.default = 5671
55
+
56
+ ssl_options.cacertfile = /usr/local/etc/rabbitmq/ca_certificate.pem
57
+ ssl_options.certfile = /usr/local/etc/rabbitmq/server_certificate.pem
58
+ ssl_options.keyfile = /usr/local/etc/rabbitmq/server_key.pem
59
+ ssl_options.verify = verify_peer
60
+ ssl_options.fail_if_no_peer_cert = false
61
+
62
+
63
+ auth_mechanisms.1 = PLAIN
64
+ auth_mechanisms.2 = AMQPLAIN
65
+ auth_mechanisms.3 = EXTERNAL
66
+ ```
67
+
68
+ The test suite also requires the [ x509 certificate authentication mechanism] ( https://github.com/rabbitmq/rabbitmq-auth-mechanism-ssl )
69
+ plugin to be enabled:
70
+
71
+ ``` shell
72
+ brew install rabbitmq
73
+ cp TestCertificates/* /path/to/rabbitmq/installation/etc/rabbitmq/
74
+ rabbitmq-plugins enable rabbitmq_auth_mechanism_ssl --offline
75
+ ```
19
76
20
77
Then restart RabbitMQ.
21
78
22
- Now what's left is running a few setup steps:
79
+ ### Node Preconfiguration
80
+
81
+ To seed the node (pre-create certain [ virtual hosts] ( https://www.rabbitmq.com/vhosts.html ) , users,
82
+ [ permissions] ( https://www.rabbitmq.com/access-control.html ) ):
23
83
24
84
```
25
85
# use RABBITMQCTL="/path/to/rabbitmqctl"
@@ -34,29 +94,47 @@ gmake set_up_test_users RABBITMQCTL="/path/to/rabbitmqctl"
34
94
gmake before_build RABBITMQCTL="/path/to/rabbitmqctl" RABBITMQ_PLUGINS="/path/to/rabbitmq-plugins"
35
95
```
36
96
37
- Finally, to run the tests:
97
+ ### Test Targets
98
+
99
+ To run the core test suite:
100
+
38
101
102
+ ``` shell
103
+ # runs all tests with iOS and MacOS destinations
104
+ gmake tests
39
105
40
- ``` bash
41
- # for iOS
106
+ # iOS only
42
107
gmake tests_ios iOS_VERSION=12.1
43
108
44
- # for macOS
109
+ # MacOS only
45
110
gmake tests_macos
111
+
46
112
```
47
113
48
- ## SwiftLint
114
+ or run the tests using the ` RMQClient ` scheme from XCode.
115
+
116
+ To run the TLS test suite:
117
+
118
+
119
+ ``` shell
120
+ # see the
121
+ gmake tests_with_tls
122
+ ```
123
+
124
+ or run the tests using the ` RMQClient with TLS tests ` scheme in XCode.
125
+
126
+ ## Linting with SwiftLint
49
127
50
128
The test suite uses [ SwiftLint] ( https://github.com/realm/SwiftLint ) as a build phase.
51
129
It must be installed in order for XCode to use it:
52
130
53
- ``` bash
131
+ ``` shell
54
132
brew install swiftlint
55
133
```
56
134
57
135
In order to lint from the command line, use
58
136
59
- ``` bash
137
+ ``` shell
60
138
swiftlint
61
139
```
62
140
0 commit comments