Skip to content

Commit 63c7301

Browse files
committed
add in update container
1 parent c959eee commit 63c7301

3 files changed

Lines changed: 41 additions & 40 deletions

File tree

src/events_cmd_exec.hh

Whitespace-only changes.

tests/update_container_cmd_test.cc

Lines changed: 41 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include <memory>
33

44
#include "update_container_cmd.hh"
5+
#include "update_container_cmd_exec.hh"
56
#include "docker_client.hh"
67

78
using namespace dockercpp::command;
@@ -17,56 +18,56 @@ class UpdateContainerCmdTest : public ::testing::Test {
1718
}
1819
};
1920

20-
// TEST_F(UpdateContainerCmdTest, TestUpdateContainerCmdBasicProperties) {
21-
// std::unique_ptr<update::Exec> exec = std::make_unique<update::Exec>();
22-
// UpdateContainerCmdImpl cmd(std::move(exec));
21+
TEST_F(UpdateContainerCmdTest, TestUpdateContainerCmdBasicProperties) {
22+
std::unique_ptr<update::Exec> exec = std::make_unique<dockercpp::command::exec::UpdateContainerCmdExec>();
23+
UpdateContainerCmdImpl cmd(std::move(exec));
2324

24-
// std::string testContainerId = "test_container_123";
25-
// cmd.withContainerId(testContainerId);
25+
std::string testContainerId = "test_container_123";
26+
cmd.withContainerId(testContainerId);
2627

27-
// EXPECT_EQ(cmd.getContainerId(), testContainerId);
28-
// }
28+
EXPECT_EQ(cmd.getContainerId(), testContainerId);
29+
}
2930

30-
// TEST_F(UpdateContainerCmdTest, TestUpdateContainerCmdResourceLimits) {
31-
// std::unique_ptr<update::Exec> exec = std::make_unique<update::Exec>();
32-
// UpdateContainerCmdImpl cmd(std::move(exec));
31+
TEST_F(UpdateContainerCmdTest, TestUpdateContainerCmdResourceLimits) {
32+
std::unique_ptr<update::Exec> exec = std::make_unique<dockercpp::command::exec::UpdateContainerCmdExec>();
33+
UpdateContainerCmdImpl cmd(std::move(exec));
3334

34-
// int testCpuShares = 512;
35-
// int64_t testMemory = 1024 * 1024 * 1024; // 1GB
36-
// int testMemorySwap = 2048;
35+
int testCpuShares = 512;
36+
int64_t testMemory = 1024 * 1024 * 1024; // 1GB
37+
int testMemorySwap = 2048;
3738

38-
// cmd.withCpuShares(testCpuShares)
39-
// .withMemory(testMemory)
40-
// .withMemorySwap(testMemorySwap);
39+
cmd.withCpuShares(testCpuShares)
40+
.withMemory(testMemory)
41+
.withMemorySwap(testMemorySwap);
4142

42-
// EXPECT_EQ(cmd.getCpuShares(), testCpuShares);
43-
// EXPECT_EQ(cmd.getMemory(), testMemory);
44-
// EXPECT_EQ(cmd.getMemorySwap(), testMemorySwap);
45-
// }
43+
EXPECT_EQ(cmd.getCpuShares(), testCpuShares);
44+
EXPECT_EQ(cmd.getMemory(), testMemory);
45+
EXPECT_EQ(cmd.getMemorySwap(), testMemorySwap);
46+
}
4647

47-
// TEST_F(UpdateContainerCmdTest, TestUpdateContainerCmdCpuSet) {
48-
// std::unique_ptr<update::Exec> exec = std::make_unique<update::Exec>();
49-
// UpdateContainerCmdImpl cmd(std::move(exec));
48+
TEST_F(UpdateContainerCmdTest, TestUpdateContainerCmdCpuSet) {
49+
std::unique_ptr<update::Exec> exec = std::make_unique<dockercpp::command::exec::UpdateContainerCmdExec>();
50+
UpdateContainerCmdImpl cmd(std::move(exec));
5051

51-
// std::vector<std::string> testCpusetCpus = {"0", "1", "2"};
52-
// cmd.withCpusetCpus(testCpusetCpus);
52+
std::vector<std::string> testCpusetCpus = {"0", "1", "2"};
53+
cmd.withCpusetCpus(testCpusetCpus);
5354

54-
// EXPECT_EQ(cmd.getCpusetCpus(), testCpusetCpus);
55-
// }
55+
EXPECT_EQ(cmd.getCpusetCpus(), testCpusetCpus);
56+
}
5657

57-
// TEST_F(UpdateContainerCmdTest, TestUpdateContainerCmdChaining) {
58-
// std::unique_ptr<update::Exec> exec = std::make_unique<update::Exec>();
59-
// UpdateContainerCmdImpl cmd(std::move(exec));
58+
TEST_F(UpdateContainerCmdTest, TestUpdateContainerCmdChaining) {
59+
std::unique_ptr<update::Exec> exec = std::make_unique<dockercpp::command::exec::UpdateContainerCmdExec>();
60+
UpdateContainerCmdImpl cmd(std::move(exec));
6061

61-
// std::string testContainerId = "test_container_123";
62-
// int testCpuShares = 256;
63-
// int64_t testMemory = 512 * 1024 * 1024;
62+
std::string testContainerId = "test_container_123";
63+
int testCpuShares = 256;
64+
int64_t testMemory = 512 * 1024 * 1024;
6465

65-
// cmd.withContainerId(testContainerId)
66-
// .withCpuShares(testCpuShares)
67-
// .withMemory(testMemory);
66+
cmd.withContainerId(testContainerId)
67+
.withCpuShares(testCpuShares)
68+
.withMemory(testMemory);
6869

69-
// EXPECT_EQ(cmd.getContainerId(), testContainerId);
70-
// EXPECT_EQ(cmd.getCpuShares(), testCpuShares);
71-
// EXPECT_EQ(cmd.getMemory(), testMemory);
72-
// }
70+
EXPECT_EQ(cmd.getContainerId(), testContainerId);
71+
EXPECT_EQ(cmd.getCpuShares(), testCpuShares);
72+
EXPECT_EQ(cmd.getMemory(), testMemory);
73+
}

0 commit comments

Comments
 (0)