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

Add GetContainerMetadata test.#119

Merged
ACEmilG merged 7 commits intomasterfrom
ACEmilG-GetContainerMetadata-test
Apr 4, 2018
Merged

Add GetContainerMetadata test.#119
ACEmilG merged 7 commits intomasterfrom
ACEmilG-GetContainerMetadata-test

Conversation

@ACEmilG
Copy link
Copy Markdown
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
Comment thread test/kubernetes_unittest.cc Outdated
})->As<json::Object>(),
json::string("TestAssociations"),
Timestamp(),
false);
Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added.

Comment thread test/kubernetes_unittest.cc Outdated
})->As<json::Object>(),
json::object({{"name", json::string("TestSpecName")}})->As<json::Object>(),
json::object({
{"containerID", json::string("docker://TestContainerID")}
Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added

Comment thread test/kubernetes_unittest.cc Outdated
{"uid", json::string("TestUid")},
{"creationTimestamp", json::string("2018-03-03T01:23:45.678901234Z")},
{"labels", json::object({{"label", json::string("TestLabel")}})},
})}
Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added

Comment thread test/kubernetes_unittest.cc Outdated
{"raw", json::object({
{"containerID", json::string("docker://TestContainerID")},
})},
{"version", json::string("1.6")}
Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added

Comment thread test/kubernetes_unittest.cc Outdated
EXPECT_EQ(std::vector<std::string>({
"k8s_container.TestUid.TestSpecName",
"k8s_container.TestNamespace.TestName.TestSpecName",
"k8s_container.TestContainerID"}), m.ids());
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

Comment thread test/kubernetes_unittest.cc Outdated
KubernetesReader reader(config, nullptr); // Don't need HealthChecker.
const auto m = GetContainerMetadata(
reader,
json::object({
Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated

Comment thread test/kubernetes_unittest.cc Outdated
const auto m = GetContainerMetadata(
reader,
pod->As<json::Object>(),
json::object({{"name", json::string("TestSpecName")}})->As<json::Object>(),
Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed

Comment thread test/kubernetes_unittest.cc Outdated
});
json::value spec = json::object({{"name", json::string("TestSpecName")}});
json::value status = json::object({{
"containerID", json::string("docker://TestContainerID")}});
Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed

Comment thread test/kubernetes_unittest.cc Outdated
});
json::value spec = json::object({{"name", json::string("TestSpecName")}});
json::value status = json::object({
{"containerID", json::string("docker://TestContainerID")}
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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