Commit 161c2b70 authored by Andrew Mitchell's avatar Andrew Mitchell
Browse files

Updated to version 2.0.1 of the protocol, updated capacity reporting as a result

parent 729fd22a
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -65,8 +65,8 @@ ExternalProject_add(
    INSTALL_COMMAND ""
)

set(KINETIC_PROTO_VERSION "6dcceb871d03ae8b727d48ddcc88053d9e9d6874")
set(KINETIC_PROTO_MD5 "de61424f3340a6216a3576c1997f2f2c")
set(KINETIC_PROTO_VERSION "2.0.1")
set(KINETIC_PROTO_MD5 "1505fab102afc04994932c7c1406a697")

ExternalProject_add(
    kinetic-proto
+1 −1
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@ This repo contains code for producing C and C++ kinetic clients.

Protocol Version
=================
The client is using version `2.0.0` of the [Kinetic-Protocol](https://github.com/Seagate/kinetic-protocol/releases/tag/2.0.0).
The client is using version `2.0.1` of the [Kinetic-Protocol](https://github.com/Seagate/kinetic-protocol/releases/tag/2.0.1).


Dependencies
+2 −2
Original line number Diff line number Diff line
@@ -26,8 +26,8 @@
namespace kinetic {

typedef struct {
    uint64_t remaining_bytes;
    uint64_t total_bytes;
    uint64_t nominal_capacity_in_bytes;
    float portion_full;
} Capacity;

typedef struct {
+2 −2
Original line number Diff line number Diff line
@@ -148,8 +148,8 @@ void GetLogHandler::Handle(const Message& response, unique_ptr<const string> val
    drive_log->configuration.tls_port = configuration.tlsport();

    auto capacity = getlog.capacity();
    drive_log->capacity.remaining_bytes = capacity.remaining();
    drive_log->capacity.total_bytes = capacity.total();
    drive_log->capacity.nominal_capacity_in_bytes = capacity.nominalcapacityinbytes();
    drive_log->capacity.portion_full = capacity.portionfull();

    auto limits = getlog.limits();
    drive_log->limits.max_key_size = limits.maxkeysize();
+7 −5
Original line number Diff line number Diff line
@@ -48,6 +48,7 @@ using com::seagate::kinetic::client::proto::Message_GetLog_Type_CAPACITIES;
using com::seagate::kinetic::client::proto::Message_GetLog_Type_CONFIGURATION;
using com::seagate::kinetic::client::proto::Message_GetLog_Type_STATISTICS;
using com::seagate::kinetic::client::proto::Message_GetLog_Type_MESSAGES;
using com::seagate::kinetic::client::proto::Message_GetLog_Type_LIMITS;
using com::seagate::kinetic::client::proto::Message_Security;
using com::seagate::kinetic::client::proto::Message_Security_ACL;
using com::seagate::kinetic::client::proto::Message_Security_ACL_Scope;
@@ -274,21 +275,22 @@ TEST_F(NonblockingKineticConnectionTest, GetLogBuildsCorrectMessage) {
    connection_.GetLog(NULL);

    EXPECT_EQ(Message_MessageType_GETLOG, message.command().header().messagetype());
    EXPECT_EQ(6, message.command().body().getlog().type_size());
    EXPECT_EQ(7, message.command().body().getlog().type_size());
    EXPECT_EQ(Message_GetLog_Type_UTILIZATIONS, message.command().body().getlog().type(0));
    EXPECT_EQ(Message_GetLog_Type_TEMPERATURES, message.command().body().getlog().type(1));
    EXPECT_EQ(Message_GetLog_Type_CAPACITIES, message.command().body().getlog().type(2));
    EXPECT_EQ(Message_GetLog_Type_CONFIGURATION, message.command().body().getlog().type(3));
    EXPECT_EQ(Message_GetLog_Type_STATISTICS, message.command().body().getlog().type(4));
    EXPECT_EQ(Message_GetLog_Type_MESSAGES, message.command().body().getlog().type(5));
    EXPECT_EQ(Message_GetLog_Type_LIMITS, message.command().body().getlog().type(6));
}

TEST_F(NonblockingKineticConnectionTest, GetLogParsesMessageCorrectly) {
    Message response;
    response.mutable_command()->mutable_body()->mutable_getlog()
            ->mutable_capacity()->set_remaining(123);
            ->mutable_capacity()->set_nominalcapacityinbytes(123);
    response.mutable_command()->mutable_body()->mutable_getlog()
            ->mutable_capacity()->set_total(456);
            ->mutable_capacity()->set_portionfull(0.5);

    response.mutable_command()->mutable_body()->mutable_getlog()
            ->mutable_configuration()->set_vendor("vendor");
@@ -337,8 +339,8 @@ TEST_F(NonblockingKineticConnectionTest, GetLogParsesMessageCorrectly) {
    unique_ptr<const string> empty_str(new string(""));
    handler.Handle(response, move(empty_str));

    EXPECT_EQ((uint64_t) 123, drive_log.capacity.remaining_bytes);
    EXPECT_EQ((uint64_t) 456, drive_log.capacity.total_bytes);
    EXPECT_EQ((uint64_t) 123, drive_log.capacity.nominal_capacity_in_bytes);
    EXPECT_EQ((float) 0.5, drive_log.capacity.portion_full);

    EXPECT_EQ("vendor", drive_log.configuration.vendor);
    EXPECT_EQ("model", drive_log.configuration.model);