blob: c9cbcba202c3637b568f1e443e89cc7bfa80d9d8 [file] [log] [blame]
Éric Lemoine71272712016-11-08 12:53:51 +00001-- Copyright 2015 Mirantis, Inc.
2--
3-- Licensed under the Apache License, Version 2.0 (the "License");
4-- you may not use this file except in compliance with the License.
5-- You may obtain a copy of the License at
6--
7-- http://www.apache.org/licenses/LICENSE-2.0
8--
9-- Unless required by applicable law or agreed to in writing, software
10-- distributed under the License is distributed on an "AS IS" BASIS,
11-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-- See the License for the specific language governing permissions and
13-- limitations under the License.
14
Éric Lemoine5b3435a2016-11-08 13:01:14 +000015EXPORT_ASSERT_TO_GLOBALS=true
Éric Lemoine71272712016-11-08 12:53:51 +000016require('luaunit')
17package.path = package.path .. ";../heka/files/lua/common/?.lua;lua/mocks/?.lua"
18
19local gse_utils = require('gse_utils')
20local consts = require('gse_constants')
21
22TestGseUtils = {}
23
24 function TestGseUtils:test_max_status()
25 local status = gse_utils.max_status(consts.DOWN, consts.WARN)
26 assertEquals(consts.DOWN, status)
27 local status = gse_utils.max_status(consts.OKAY, consts.WARN)
28 assertEquals(consts.WARN, status)
29 local status = gse_utils.max_status(consts.OKAY, consts.DOWN)
30 assertEquals(consts.DOWN, status)
31 local status = gse_utils.max_status(consts.UNKW, consts.DOWN)
32 assertEquals(consts.DOWN, status)
33 end
34
35lu = LuaUnit
36lu:setVerbosity( 1 )
37os.exit( lu:run() )