# 0
        url = 'http://172.31.17.179:8080/recommend/popup-sentence?sessionId=123&sentence=ok&'
    elif source == 'en_online1':
        # 1
        url = 'http://172.31.28.21:8080/recommend/popup-sentence?sessionId=123&sentence=ok&'
    elif source == 'en_online2':
        # 2
        url = 'http://172.31.18.118:8080/recommend/popup-sentence?sessionId=123&sentence=ok&'
    elif source == 'kika_online':
        # kika
        # url = 'http://kika-en.recommend.model.intranet.com/recommend/popup-sentence?sessionId=123&sentence=ok&'
        url = 'http://172.31.21.219:8080/recommend/popup-sentence?sessionId=123&sentence=ok&'
    elif source == 'business':
        url = 'http://172.31.31.224:8080/recommend/popup-sentence?sessionId=123&sentence=ok&'
    if isinstance(url, list):
        for url_ in url:
            case_runner(test_case, url_)
    else:
        case_runner(test_case, url)
        # print(url)


def run(source):
    test_case = get_test_data(source)
    for case in constitute_test_case(test_case):
        request_test(case, source)


if __name__ == "__main__":
    run(source_input())
Beispiel #2
0
def check(data, source, p_t_time=1):
    fail = []
    created_sessionId = run_predict_create_kafka(data, source, p_t_time=1)
    time.sleep(30)
    train_sessionId_list = get_train_sessionId()
    print('Train sessionId:')
    print(train_sessionId_list)
    for sessionId in created_sessionId:
        if sessionId['sessionId'] not in str(train_sessionId_list):
            fail.append(sessionId)
    if len(fail) > 0:
        print('没有找到的sessionId')
        print(fail)
        print('失败')


if __name__ == "__main__":
    data = {'2:PtBeforeBucket': {'duid': '25ad4b27c4c3410784ee7fab223f3a98', 'tag': 'eita', 'kb_lang': 'pt_BR'},
            '15:EnUsBeforeNotMod2GBDTBucket': {'duid': 'bc21bc8ea7ea480d85a0b6df109a0159', 'tag': 'morning',
                                               'kb_lang': 'en_US'},
            '16:KikaEnUsBeforeBucket': {'duid': '37dfbe888ef147c8a83b60588dc2da21', 'tag': 'no', 'kb_lang': 'en_US'},
            '5:EnUsBeforeMod2Bucket': {'duid': '32b4256f0c934e91aaf5f9201ccf4f54', 'tag': 'yea', 'kb_lang': 'en_US'},
            '7:EnUsBeforeNotMod2GBDTMLeapBucket': {'duid': '7bfe28fb712c4b2c9873d0b53458f6a8', 'tag': 'thanks',
                                                   'kb_lang': 'en_US'},
            '11:EnNotUsBeforeGBDTBucket': {'duid': '269145da9def4d52b85c7a4f2893678a', 'tag': 'haha',
                                           'kb_lang': 'ms_MY'},
            }
    # print(run_predict_create_kafka(data=data, source=source_input()))
    check(data=data, source=source_input())