forked from thmeitz/ksqldb-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclient_test.go
40 lines (32 loc) · 999 Bytes
/
client_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package ksqldb_test
import (
"testing"
"github.com/stretchr/testify/require"
"github.com/DinoShambar/ksqldb-go"
"github.com/DinoShambar/ksqldb-go/net"
)
var options = net.Options{
Credentials: net.Credentials{Username: "user", Password: "password"},
BaseUrl: "http://localhost:8088",
AllowHTTP: true,
}
func TestNewClientWithOptions_Error(t *testing.T) {
var opt1 = net.Options{
Credentials: net.Credentials{Username: "user", Password: "password"},
BaseUrl: "fa",
AllowHTTP: true,
}
_, err := ksqldb.NewClientWithOptions(opt1)
require.NotNil(t, err)
require.Equal(t, "invalid host name given", err.Error())
// Ensures that the Ksqldb interface is implemented.
// Aborts the compiler if it does not.
// var _ ksqldb.Ksqldb = kcl
}
func TestClient_EnableParseSQL(t *testing.T) {
kcl, err := ksqldb.NewClientWithOptions(options)
require.Nil(t, err)
require.True(t, kcl.ParseSQLEnabled())
kcl.EnableParseSQL(false)
require.False(t, kcl.ParseSQLEnabled())
}