blob: cbbfe7eeda4792cf2c6f209d8b5075e7007aebe1 [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 (
Neha Sharma94f16a92020-06-26 04:17:55 +000019 "context"
Scott Baker104b67d2019-10-29 15:56:27 -070020 "github.com/stretchr/testify/assert"
21 "testing"
22)
23
24func TestSaramaClientEnableLivenessChannel(t *testing.T) {
25 // Note: This doesn't actually start the client
26 client := NewSaramaClient()
27
Neha Sharma94f16a92020-06-26 04:17:55 +000028 ch := client.EnableLivenessChannel(context.Background(), true)
Scott Baker104b67d2019-10-29 15:56:27 -070029
30 // The channel should have one "true" message on it
31 assert.NotEmpty(t, ch)
32
33 select {
34 case stuff := <-ch:
35 assert.True(t, stuff)
36 default:
37 t.Error("Failed to read from the channel")
38 }
39}