<commit_before>local src_path = "lib/lua"
local call_redis_script = require "./test-lua/harness";
 
describe("healthCheck.lua", function()
    local script = './lib/lua/healthCheck.lua'
    local keys = {
        ["gh"]="test:gh",
        ["wh"]="test:wh",
        ["bh"]="test:bh",
        ["cz"]="test:cz:pvp",
        ["bz"]="test:bz:pvp",
        ["wz"]="test:wz:br01",
        ["rz"]="test:rz:br01"
    }
    local chPrefix = "test:ch"
 
    -- Flush the database before running the tests
    setup(function()
    end)

    before_each(function()
        redis.call('FLUSHDB')
        redis.call("HSET", keys.gh, "chPrefix", chPrefix) 
    end)

    it("Empty bz should fail", function()
        local brId = "br01"
        local result = call_redis_script(script,  {
            keys.gh,
            keys.wh,
            keys.bh,
            keys.cz,
            keys.bz
        }, {
            brId
        })
        assert.are.equals(type(result), "table")
        assert.are.equals(#result, 2)
        assert.are.equals(result[1], 2)
        print("Error msg: " .. result[2])
    end)

    it("Should fail if the broker is not in the bz table", function()
        redis.call("ZADD", keys.cz, 10, "br00")
        redis.call("ZADD", keys.bz, 123, "br00")
        local brId = "br01"
        local result = call_redis_script(script,  {
            keys.gh,
            keys.wh,
            keys.bh,
            keys.cz,
            keys.bz
        }, {
            brId
        })
        assert.are.equals(type(result), "table")<commit_msg>Remove the duplicate test case.<commit_after>local src_path = "lib/lua"
local call_redis_script = require "./test-lua/harness";
 
describe("healthCheck.lua", function()
    local script = './lib/lua/healthCheck.lua'
    local keys = {
        ["gh"]="test:gh",
        ["wh"]="test:wh",
        ["bh"]="test:bh",
        ["cz"]="test:cz:pvp",
        ["bz"]="test:bz:pvp",
        ["wz"]="test:wz:br01",
        ["rz"]="test:rz:br01"
    }
    local chPrefix = "test:ch"
 
    -- Flush the database before running the tests
    setup(function()
    end)

    before_each(function()
        redis.call('FLUSHDB')
        redis.call("HSET", keys.gh, "chPrefix", chPrefix) 
    end)

    it("Empty bz should fail", function()
        local brId = "br01"
        local result = call_redis_script(script,  {
            keys.gh,
            keys.wh,
            keys.bh,
            keys.cz,
            keys.bz
        }, {
            brId
        })
        assert.are.equals(type(result), "table")
{'fraction_non_alphanumeric': 0.1618860510805501, 'fraction_numerical': 0.010609037328094302, 'mean_word_length': 1.8638920134983128, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1981078', 'n_tokens_mistral': 876, 'n_tokens_neox': 835, 'n_words': 163}