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

Added unit test for GetLegacyResource#120

Merged
igorpeshansky merged 4 commits intomasterfrom
ACEmilG-GetLegacyResource-test
Apr 3, 2018
Merged

Added unit test for GetLegacyResource#120
igorpeshansky merged 4 commits intomasterfrom
ACEmilG-GetLegacyResource-test

Conversation

@ACEmilG
Copy link
Copy Markdown
Contributor

@ACEmilG ACEmilG commented Apr 2, 2018

No description provided.

Comment thread test/kubernetes_unittest.cc Outdated
{"pod_id", "TestUid"},
{"zone", "TestZone"},
}), m.resource());
EXPECT_EQ("", m.metadata().version);
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.

change this to:
EXPECT_TRUE(m.metadata().version.empty());

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.

})}
});
const auto m = GetLegacyResource(reader, json::object({
{"metadata", 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.

Isn't this just pod->As<json::Object>()?

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.

Removed pod, it was supposed to be inlined.

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 was actually suggesting you keep pod...

EXPECT_FALSE(m.metadata().is_deleted);
EXPECT_EQ(Timestamp(), m.metadata().created_at);
EXPECT_EQ(Timestamp(), m.metadata().collected_at);
EXPECT_TRUE(m.metadata().ignore);
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.

Leave this one, remove all of the other checks of m.metadata() — they're implementation details.

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.

Removed.

Comment thread test/kubernetes_unittest.cc Outdated
EXPECT_EQ(Timestamp(), m.metadata().created_at);
EXPECT_EQ(Timestamp(), m.metadata().collected_at);
EXPECT_TRUE(m.metadata().ignore);
EXPECT_EQ(json::object({})->ToString(), m.metadata().metadata->ToString());
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.

Irrelevant now, but json::object()->ToString() is just "{}".

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.

Yep, but removed as you pointed out.

Comment thread test/kubernetes_unittest.cc Outdated
})->As<json::Object>(), "TestContainerName");
EXPECT_EQ(std::vector<std::string>({
"gke_container.TestNamespace.TestUid.TestContainerName",
"gke_container.TestNamespace.TestName.TestContainerName"
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.

})}
});
const auto m = GetLegacyResource(reader, json::object({
{"metadata", 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 was actually suggesting you keep pod...

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-GetLegacyResource-test branch from ea02f0f to 9fd6819 Compare April 2, 2018 22:17
@ACEmilG
Copy link
Copy Markdown
Contributor Author

ACEmilG commented Apr 2, 2018

Rebased against master

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:

@igorpeshansky igorpeshansky merged commit 6322a98 into master Apr 3, 2018
@igorpeshansky igorpeshansky deleted the ACEmilG-GetLegacyResource-test branch April 3, 2018 03:11
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