Scott Baker | 104b67d | 2019-10-29 15:56:27 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2018-present Open Networking Foundation |
| 3 | |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | package kafka |
| 17 | |
| 18 | import ( |
| 19 | "github.com/stretchr/testify/assert" |
| 20 | "testing" |
| 21 | ) |
| 22 | |
| 23 | func TestSaramaClientEnableLivenessChannel(t *testing.T) { |
| 24 | // Note: This doesn't actually start the client |
| 25 | client := NewSaramaClient() |
| 26 | |
Scott Baker | e668595 | 2020-06-23 04:05:39 +0000 | [diff] [blame] | 27 | ch := client.EnableLivenessChannel(true) |
Scott Baker | 104b67d | 2019-10-29 15:56:27 -0700 | [diff] [blame] | 28 | |
| 29 | // The channel should have one "true" message on it |
| 30 | assert.NotEmpty(t, ch) |
| 31 | |
| 32 | select { |
| 33 | case stuff := <-ch: |
| 34 | assert.True(t, stuff) |
| 35 | default: |
| 36 | t.Error("Failed to read from the channel") |
| 37 | } |
| 38 | } |