(t *testing.T)
| 164 | } |
| 165 | |
| 166 | func TestCreateConsumer(t *testing.T) { |
| 167 | tests := []struct { |
| 168 | name string |
| 169 | consumerConfig jetstream.ConsumerConfig |
| 170 | shouldCreate bool |
| 171 | withError error |
| 172 | }{ |
| 173 | { |
| 174 | name: "create durable consumer", |
| 175 | consumerConfig: jetstream.ConsumerConfig{Durable: "dur"}, |
| 176 | shouldCreate: true, |
| 177 | }, |
| 178 | { |
| 179 | name: "idempotent create, no error", |
| 180 | consumerConfig: jetstream.ConsumerConfig{Durable: "dur"}, |
| 181 | shouldCreate: true, |
| 182 | }, |
| 183 | { |
| 184 | name: "create ephemeral pull consumer", |
| 185 | consumerConfig: jetstream.ConsumerConfig{AckPolicy: jetstream.AckNonePolicy}, |
| 186 | shouldCreate: true, |
| 187 | }, |
| 188 | { |
| 189 | name: "with filter subject", |
| 190 | consumerConfig: jetstream.ConsumerConfig{FilterSubject: "FOO.A"}, |
| 191 | shouldCreate: true, |
| 192 | }, |
| 193 | { |
| 194 | name: "with metadata", |
| 195 | consumerConfig: jetstream.ConsumerConfig{Metadata: map[string]string{"foo": "bar", "baz": "quux"}}, |
| 196 | shouldCreate: true, |
| 197 | }, |
| 198 | { |
| 199 | name: "with multiple filter subjects", |
| 200 | consumerConfig: jetstream.ConsumerConfig{FilterSubjects: []string{"FOO.A", "FOO.B"}}, |
| 201 | shouldCreate: true, |
| 202 | }, |
| 203 | { |
| 204 | name: "with multiple filter subjects, overlapping subjects", |
| 205 | consumerConfig: jetstream.ConsumerConfig{FilterSubjects: []string{"FOO.*", "FOO.B"}}, |
| 206 | withError: jetstream.ErrOverlappingFilterSubjects, |
| 207 | }, |
| 208 | { |
| 209 | name: "with multiple filter subjects and filter subject provided", |
| 210 | consumerConfig: jetstream.ConsumerConfig{FilterSubjects: []string{"FOO.A", "FOO.B"}, FilterSubject: "FOO.C"}, |
| 211 | withError: jetstream.ErrDuplicateFilterSubjects, |
| 212 | }, |
| 213 | { |
| 214 | name: "with empty subject in FilterSubjects", |
| 215 | consumerConfig: jetstream.ConsumerConfig{FilterSubjects: []string{"FOO.A", ""}}, |
| 216 | withError: jetstream.ErrEmptyFilter, |
| 217 | }, |
| 218 | { |
| 219 | name: "with invalid filter subject, leading dot", |
| 220 | consumerConfig: jetstream.ConsumerConfig{FilterSubject: ".foo"}, |
| 221 | withError: jetstream.ErrInvalidSubject, |
| 222 | }, |
| 223 | { |
nothing calls this directly
no test coverage detected