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 4, 2018

No description provided.

Configuration config(std::stringstream(
"KubernetesClusterName: TestClusterName\n"
"KubernetesClusterLocation: TestClusterLocation\n"
"MetadataApiResourceTypePerarator: \".\"\n"
Copy link
Contributor

Choose a reason for hiding this comment

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

Please fix. TypeSeparator?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, fixed.

})},
});

auto metadatas = GetPodAndContainerMetadata(
Copy link
Contributor

Choose a reason for hiding this comment

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

why not m like in other places.
If you want plural, then metadata_list or something is better.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed to metadata_list

Copy link
Contributor

Choose a reason for hiding this comment

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

Frankly, I prefer m for brevity. Any reason to not go with that? As @supriyagarg mentioned, this is a convention in other tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I guess I have a strong aversion to single-letter variable names. Changed.

EXPECT_EQ(time::rfc3339::FromString("2018-03-03T01:23:45.678901234Z"),
metadatas[1].metadata().created_at);
EXPECT_EQ(Timestamp(), metadatas[1].metadata().collected_at);
json::value metadata1 = 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.

metadata1 -> container1

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed

EXPECT_EQ(time::rfc3339::FromString("2018-03-03T01:23:45.678901234Z"),
metadatas[2].metadata().created_at);
EXPECT_EQ(Timestamp(), metadatas[2].metadata().collected_at);
json::value metadata2 = 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.

metadata2 -> container2

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed

@igorpeshansky igorpeshansky self-requested a review April 5, 2018 03:59
"KubernetesClusterName: TestClusterName\n"
"KubernetesClusterLocation: TestClusterLocation\n"
"MetadataApiResourceTypePerarator: \",\"\n"
"MetadataApiResourceTypeSeperator: \",\"\n"
Copy link
Contributor

Choose a reason for hiding this comment

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

Make that MetadataApiResourceTypeSeparator (here and below).
Sigh, the config revamp in #127 would allow catching invalid config options.

Copy link
Contributor

Choose a reason for hiding this comment

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

This still needs to be fixed.

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, sorry about that

EXPECT_EQ("gke_container.TestNamespace.TestPodUid.TestContainerName0",
metadata_list[0].ids()[0]);
EXPECT_EQ("gke_container.TestNamespace.TestPodName.TestContainerName0",
metadata_list[0].ids()[1]);
Copy link
Contributor

Choose a reason for hiding this comment

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

  EXPECT_EQ(std::vector<std::string>{
    "gke_container.TestNamespace.TestPodUid.TestContainerName0",
    "gke_container.TestNamespace.TestPodName.TestContainerName0",
  }, metadata_list[0].ids());

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

EXPECT_EQ("k8s_container.TestPodUid.TestContainerName0",
metadata_list[1].ids()[0]);
EXPECT_EQ("k8s_container.TestNamespace.TestPodName.TestContainerName0",
metadata_list[1].ids()[1]);
Copy link
Contributor

Choose a reason for hiding this comment

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

  EXPECT_EQ(std::vector<std::string>{
    "k8s_container.TestPodUid.TestContainerName0",
    "k8s_container.TestNamespace.TestPodName.TestContainerName0",
  }, metadata_list[1].ids());

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

EXPECT_EQ(time::rfc3339::FromString("2018-03-03T01:23:45.678901234Z"),
metadata_list[2].metadata().created_at);
EXPECT_EQ(Timestamp(), metadata_list[2].metadata().collected_at);
json::value container2 = 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.

Should this not be pod metadata?

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

Choose a reason for hiding this comment

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

I actually meant that this looks like container metadata (with the "metadata", "spec", and "status" fields). Should this not be pod metadata (with one "api" field)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm, well reading the code, it does seem to me that a pod should be played at the end of the metadata list. Truthfully, I had a hard time following all the code paths closely, so its difficult for me to evaluate whether this is an actual bug.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, silly me. This is pod metadata. I miscounted the nesting depth. Never mind.

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.

There's one more comment about the typo in the option name...

EXPECT_EQ(time::rfc3339::FromString("2018-03-03T01:23:45.678901234Z"),
metadata_list[2].metadata().created_at);
EXPECT_EQ(Timestamp(), metadata_list[2].metadata().collected_at);
json::value container2 = 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 actually meant that this looks like container metadata (with the "metadata", "spec", and "status" fields). Should this not be pod metadata (with one "api" field)?

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 remaining rename that still needs to happen.

"KubernetesClusterName: TestClusterName\n"
"KubernetesClusterLocation: TestClusterLocation\n"
"MetadataApiResourceTypePerarator: \",\"\n"
"MetadataApiResourceTypeSeperator: \",\"\n"
Copy link
Contributor

Choose a reason for hiding this comment

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

This still needs to be fixed.

EXPECT_EQ(time::rfc3339::FromString("2018-03-03T01:23:45.678901234Z"),
metadata_list[2].metadata().created_at);
EXPECT_EQ(Timestamp(), metadata_list[2].metadata().collected_at);
json::value container2 = 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.

Oh, silly me. This is pod metadata. I miscounted the nesting depth. Never mind.

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.

is_deleted);
}

std::vector<MetadataUpdater::ResourceMetadata> GetPodAndContainerMetadata(
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason these accessors are not static?

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:

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 c17e8de into master Apr 11, 2018
@ACEmilG ACEmilG deleted the ACEmilG-GetPodAndContainerMetadata-test branch April 11, 2018 12:57
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