Skip to content
This repository was archived by the owner on Aug 19, 2019. It is now read-only.

Conversation

@ACEmilG
Copy link
Contributor

@ACEmilG ACEmilG commented Apr 2, 2018

No description provided.

@igorpeshansky igorpeshansky changed the title Add get container metadata test Add GetContainerMetadata test. Apr 2, 2018
})->As<json::Object>(),
json::string("TestAssociations"),
Timestamp(),
false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's make this /*is_deleted=*/false.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added.

})->As<json::Object>(),
json::object({{"name", json::string("TestSpecName")}})->As<json::Object>(),
json::object({
{"containerID", json::string("docker://TestContainerID")}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing comma, please.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added

{"uid", json::string("TestUid")},
{"creationTimestamp", json::string("2018-03-03T01:23:45.678901234Z")},
{"labels", json::object({{"label", json::string("TestLabel")}})},
})}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing comma, please.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added

{"raw", json::object({
{"containerID", json::string("docker://TestContainerID")},
})},
{"version", json::string("1.6")}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing comma, please.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added

EXPECT_EQ(std::vector<std::string>({
"k8s_container.TestUid.TestSpecName",
"k8s_container.TestNamespace.TestName.TestSpecName",
"k8s_container.TestContainerID"}), m.ids());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's break before the } and add a trailing comma.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much better, updated.

Copy link
Contributor

@igorpeshansky igorpeshansky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more.

KubernetesReader reader(config, nullptr); // Don't need HealthChecker.
const auto m = GetContainerMetadata(
reader,
json::object({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would factor this call out to a pod local variable...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

const auto m = GetContainerMetadata(
reader,
pod->As<json::Object>(),
json::object({{"name", json::string("TestSpecName")}})->As<json::Object>(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These too, as spec and status?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

});
json::value spec = json::object({{"name", json::string("TestSpecName")}});
json::value status = json::object({{
"containerID", json::string("docker://TestContainerID")}});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When split over multiple lines, let's use the following formatting:

  json::value status = json::object({
    {"containerID", json::string("docker://TestContainerID")},
  });

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

});
json::value spec = json::object({{"name", json::string("TestSpecName")}});
json::value status = json::object({
{"containerID", json::string("docker://TestContainerID")}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing comma, please.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Copy link
Contributor

@igorpeshansky igorpeshansky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM :shipit:

@ACEmilG ACEmilG force-pushed the ACEmilG-GetContainerMetadata-test branch from b71d992 to 590cd89 Compare April 4, 2018 13:57
@ACEmilG
Copy link
Contributor Author

ACEmilG commented Apr 4, 2018

Rebased against master

@ACEmilG ACEmilG force-pushed the ACEmilG-GetContainerMetadata-test branch from 590cd89 to 418ec6f Compare April 4, 2018 14:02
Copy link
Contributor

@supriyagarg supriyagarg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ACEmilG ACEmilG merged commit 9310cf8 into master Apr 4, 2018
@ACEmilG ACEmilG deleted the ACEmilG-GetContainerMetadata-test branch April 4, 2018 14:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants