blob: 6dd9fd88ed3a0e2166065a30c412d75e822d1624 [file] [log] [blame]
Scott Baker104b67d2019-10-29 15:56:27 -07001/*
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 */
16package kafka
17
18import (
19 "github.com/stretchr/testify/assert"
20 "testing"
21)
22
23func TestSaramaClientEnableLivenessChannel(t *testing.T) {
24 // Note: This doesn't actually start the client
25 client := NewSaramaClient()
26
Scott Bakere6685952020-06-23 04:05:39 +000027 ch := client.EnableLivenessChannel(true)
Scott Baker104b67d2019-10-29 15:56:27 -070028
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}