blob: 8bc2728b8a85239c723b23e7c7c392f9ee28b90e [file] [log] [blame]
Scott Baker104b67d2019-10-29 15:56:27 -07001/*
Joey Armstrong7f8436c2023-07-09 20:23:27 -04002* Copyright 2018-2023 Open Networking Foundation (ONF) and the ONF Contributors
Scott Baker104b67d2019-10-29 15:56:27 -07003
Joey Armstrong7f8436c2023-07-09 20:23:27 -04004* 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
Scott Baker104b67d2019-10-29 15:56:27 -07007
Joey Armstrong7f8436c2023-07-09 20:23:27 -04008* http://www.apache.org/licenses/LICENSE-2.0
Scott Baker104b67d2019-10-29 15:56:27 -07009
Joey Armstrong7f8436c2023-07-09 20:23:27 -040010* 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.
Scott Baker104b67d2019-10-29 15:56:27 -070015 */
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}