greenplumn s3log_test 源码

  • 2022-08-18
  • 浏览 (459)

greenplumn s3log_test 代码

文件路径:/gpcontrib/gpcloud/test/s3log_test.cpp

#include "s3log.cpp"
#include "gtest/gtest.h"

TEST(Logger, simple) {
    S3Params params = InitConfig("s3://abc/a config=data/s3test.conf section=default");

    InitRemoteLog();

    s3ext_logtype = STDERR_LOG;
    S3DEBUG("Hello, STDERR DEBUG");
    S3ERROR("Hello, STDERR ERROR");

    s3ext_logtype = INTERNAL_LOG;
    S3DEBUG("Hello, INTERNAL DEBUG");
    S3ERROR("Hello, INTERNAL ERROR");

    s3ext_logtype = REMOTE_LOG;
    S3DEBUG("Hello, REMOTE DEBUG");
    S3ERROR("Hello, REMOTE ERROR");
}

TEST(Logger, getstr) {
    EXPECT_EQ(EXT_DEBUG, getLogLevel("DEBUG"));
    EXPECT_EQ(EXT_WARNING, getLogLevel("WARNING"));
    EXPECT_EQ(EXT_INFO, getLogLevel("INFO"));
    EXPECT_EQ(EXT_ERROR, getLogLevel("ERROR"));
    EXPECT_EQ(EXT_FATAL, getLogLevel("FATAL"));
    EXPECT_EQ(EXT_FATAL, getLogLevel("XX"));
    EXPECT_EQ(EXT_FATAL, getLogLevel(NULL));

    EXPECT_EQ(STDERR_LOG, getLogType("STDERR"));
    EXPECT_EQ(REMOTE_LOG, getLogType("REMOTE"));
    EXPECT_EQ(INTERNAL_LOG, getLogType("INTERNAL"));
    EXPECT_EQ(STDERR_LOG, getLogType(""));
    EXPECT_EQ(STDERR_LOG, getLogType(NULL));
}

TEST(Logger, getstrCaseInsensitive) {
    EXPECT_EQ(EXT_DEBUG, getLogLevel("DeBug"));
    EXPECT_EQ(EXT_ERROR, getLogLevel("error"));

    EXPECT_EQ(INTERNAL_LOG, getLogType("Internal"));
    EXPECT_EQ(REMOTE_LOG, getLogType("reMOTE"));
}

相关信息

greenplumn 源码目录

相关文章

greenplumn compress_writer_test 源码

greenplumn decompress_reader_test 源码

greenplumn gpreader_test 源码

greenplumn gpwriter_test 源码

greenplumn mock_classes 源码

greenplumn s3bucket_reader_test 源码

greenplumn s3common_reader_test 源码

greenplumn s3common_writer_test 源码

greenplumn s3conf_test 源码

greenplumn s3http_headers_test 源码

0  赞