aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/actors/core/mon_ut.cpp
blob: a2991e8a10c7809a89b0fe0b0f5eb7f7180659d5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <library/cpp/testing/unittest/registar.h>
#include <library/cpp/actors/core/mon.h>

using namespace NActors;
using namespace NMon;

Y_UNIT_TEST_SUITE(ActorSystemMon) {
    Y_UNIT_TEST(SerializeEv) {
        NActorsProto::TRemoteHttpInfo info;
        info.SetPath("hello");

        auto ev = std::make_unique<TEvRemoteHttpInfo>(info);
        UNIT_ASSERT(ev->ExtendedQuery);
        UNIT_ASSERT_VALUES_EQUAL(ev->ExtendedQuery->GetPath(), info.GetPath());
        UNIT_ASSERT_VALUES_EQUAL(ev->PathInfo(), info.GetPath());

        TAllocChunkSerializer ser;
        const bool success = ev->SerializeToArcadiaStream(&ser);
        Y_VERIFY(success);
        auto buffer = ser.Release(ev->CreateSerializationInfo());
        std::unique_ptr<TEvRemoteHttpInfo> restored(dynamic_cast<TEvRemoteHttpInfo*>(TEvRemoteHttpInfo::Load(buffer.Get())));
        UNIT_ASSERT(restored->Query == ev->Query);
        UNIT_ASSERT(restored->Query.size());
        UNIT_ASSERT(restored->Query[0] == '\0');
        UNIT_ASSERT(restored->ExtendedQuery);
        UNIT_ASSERT_VALUES_EQUAL(restored->ExtendedQuery->GetPath(), ev->ExtendedQuery->GetPath());
        UNIT_ASSERT_VALUES_EQUAL(restored->PathInfo(), ev->PathInfo());
    }
}