Éric Lemoine | 7127271 | 2016-11-08 12:53:51 +0000 | [diff] [blame] | 1 | -- 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 Lemoine | 5b3435a | 2016-11-08 13:01:14 +0000 | [diff] [blame] | 15 | EXPORT_ASSERT_TO_GLOBALS=true |
Éric Lemoine | 7127271 | 2016-11-08 12:53:51 +0000 | [diff] [blame] | 16 | require('luaunit') |
| 17 | package.path = package.path .. ";../heka/files/lua/common/?.lua;lua/mocks/?.lua" |
| 18 | |
| 19 | local gse_utils = require('gse_utils') |
| 20 | local consts = require('gse_constants') |
| 21 | |
| 22 | TestGseUtils = {} |
| 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 | |
| 35 | lu = LuaUnit |
| 36 | lu:setVerbosity( 1 ) |
| 37 | os.exit( lu:run() ) |