blob: c38b70e2011e4184220af9af167a899dbb88c16a [file] [log] [blame]
gerardo.laurenzidc3ddb42019-10-04 14:33:58 +00001/*
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
17package afrouter
18
19import (
gerardo.laurenzidc3ddb42019-10-04 14:33:58 +000020 "github.com/stretchr/testify/assert"
21 "testing"
22)
23
gerardo.laurenzidc3ddb42019-10-04 14:33:58 +000024func TestRouter(t *testing.T) {
25 routeConfig, routerConfig := MakeRoundRobinTestConfig(1, 1)
26 router, err := newRouter(routerConfig)
27 assert.NotNil(t, router)
28 assert.NotNil(t, routeConfig)
29 assert.Nil(t, err)
30}
31
32func TestSubRouter(t *testing.T) {
33 routeConfig, routerConfig := MakeRoundRobinTestConfig(1, 1)
34 router, err := newSubRouter(routerConfig, routeConfig)
35 assert.NotNil(t, router)
36 assert.Nil(t, err)
37}
38
39func TestRouterNoProtoService(t *testing.T) {
40 routeConfig, routerConfig := MakeRoundRobinTestConfig(1, 1)
41 routerConfig.ProtoService = ""
42
43 _, err := newRouter(routerConfig)
44 assert.NotNil(t, routeConfig)
45 assert.NotNil(t, err)
46}