Migrate http_response_test.cpp from Gerrit to Google3. Google-Bug-Id:548089848 PiperOrigin-RevId: 970249038 Change-Id: I5f3d9ac5277317233e0cdb9df2ed7a4b2b3f394d
diff --git a/copy.bara.sky b/copy.bara.sky index 7046332..9fc2671 100644 --- a/copy.bara.sky +++ b/copy.bara.sky
@@ -97,6 +97,7 @@ ("http/http_request.h", "http/http_request.hpp"), ("http/http_response.cc", "http/http_response.cpp"), ("http/http_response.h", "http/http_response.hpp"), + ("http/http_response_test.cc", "test/http/http_response_test.cpp"), ("http/http_server.h", "http/http_server.hpp"), ("http/logging.h", "http/logging.hpp"), ("http/mutual_tls.h", "http/mutual_tls.hpp"), @@ -1767,7 +1768,7 @@ ("third_party/gbmcweb/redfish_core/lib/thermal_subsystem.h", "thermal_subsystem.hpp"), ("third_party/gbmcweb/redfish_core/lib/trusted_component.h", "trusted_component.hpp"), ("third_party/gbmcweb/redfish_core/lib/update_service.h", "update_service.hpp"), - ("third_party/gbmcweb/test/redfish_core/lib/snapshot_fixture.h", "snapshot_fixture.hpp"), + ("third_party/gbmcweb/test/redfish_core/lib/snapshot_fixture.h", "test/redfish-core/lib/snapshot_fixture.hpp"), ("third_party/milotic/external/cc/tlbmc/central_config/config.h", "tlbmc/central_config/config.h"), ("third_party/milotic/external/cc/tlbmc/configs/entity_config_json_impl.h", "tlbmc/configs/entity_config_json_impl.h"), ("third_party/milotic/external/cc/tlbmc/configs/topology_config.proto.h", "topology_config.pb.h"), @@ -2220,7 +2221,7 @@ ), core.replace( before = "third_party/gbmcweb/test/redfish_core/lib/snapshot_fixture.h", - after = "snapshot_fixture.hpp", + after = "test/redfish-core/lib/snapshot_fixture.hpp", paths = glob(_g3_cc_files), ), core.replace( @@ -3475,6 +3476,11 @@ paths = glob(_gob_cc_files), ), core.replace( + before = "test/redfish-core/lib/snapshot_fixture.hpp", + after = "third_party/gbmcweb/test/redfish_core/lib/snapshot_fixture.h", + paths = glob(_gob_cc_files), + ), + core.replace( before = "snapshot_fixture.hpp", after = "third_party/gbmcweb/test/redfish_core/lib/snapshot_fixture.h", paths = glob(_gob_cc_files),
diff --git a/test/http/http_response_test.cpp b/test/http/http_response_test.cpp index d8b9e9f..0faaad8 100644 --- a/test/http/http_response_test.cpp +++ b/test/http/http_response_test.cpp
@@ -1,38 +1,32 @@ #include "http_response.hpp" -#include "test/redfish-core/lib/snapshot_fixture.hpp" - -#include <nlohmann/json.hpp> #include <gmock/gmock.h> #include <gtest/gtest.h> +#include "test/redfish-core/lib/snapshot_fixture.hpp" +#include <nlohmann/json.hpp> -namespace redfish -{ -namespace -{ +namespace redfish { +namespace { -using ::testing::Contains; using ::testing::IsEmpty; using ::testing::Not; -TEST_F(SnapshotFixture, TimetraceToJson) -{ - crow::Response response = crow::Response(); +TEST_F(SnapshotFixture, TimetraceToJson) { + crow::Response response = crow::Response(); - response.startTimetrace("TEST"); + response.startTimetrace("TEST"); - response.requestStartTime("test/request"); - response.requestEndTime(); + response.requestStartTime("test/request"); + response.requestEndTime(); - response.endTimetrace("TEST"); + response.endTimetrace("TEST"); - nlohmann::json timetraceJson = response.timetraceToJson(); + nlohmann::json timetraceJson = response.timetraceToJson(); - ASSERT_TRUE(timetraceJson["starttime"] <= timetraceJson["endtime"]); - EXPECT_EQ(timetraceJson["uri"], "test/request"); - EXPECT_THAT(timetraceJson["hops"], Not(IsEmpty())); - + ASSERT_TRUE(timetraceJson["starttime"] <= timetraceJson["endtime"]); + EXPECT_EQ(timetraceJson["uri"], "test/request"); + EXPECT_THAT(timetraceJson["hops"], Not(IsEmpty())); } -} // namespace -} // namespace redfish +} // namespace +} // namespace redfish
diff --git a/test/redfish-core/lib/assembly_test.cpp b/test/redfish-core/lib/assembly_test.cpp index 903c008..8e1995a 100644 --- a/test/redfish-core/lib/assembly_test.cpp +++ b/test/redfish-core/lib/assembly_test.cpp
@@ -3,7 +3,7 @@ #include <gtest/gtest.h> #include "chassis.hpp" -#include "snapshot_fixture.hpp" +#include "test/redfish-core/lib/snapshot_fixture.hpp" #include <nlohmann/json.hpp> namespace redfish {
diff --git a/test/redfish-core/lib/bios_multi_host_test.cpp b/test/redfish-core/lib/bios_multi_host_test.cpp index 76ecca5..6ab66fd 100644 --- a/test/redfish-core/lib/bios_multi_host_test.cpp +++ b/test/redfish-core/lib/bios_multi_host_test.cpp
@@ -19,7 +19,7 @@ #include "async_resp.hpp" #include "dbus_utility.hpp" #include "bios.hpp" -#include "snapshot_fixture.hpp" +#include "test/redfish-core/lib/snapshot_fixture.hpp" #include <nlohmann/json.hpp> #include "managed_store.hpp" #include "test/g3/mock_managed_store.hpp"
diff --git a/test/redfish-core/lib/bios_test.cpp b/test/redfish-core/lib/bios_test.cpp index ac99aba..9bddea9 100644 --- a/test/redfish-core/lib/bios_test.cpp +++ b/test/redfish-core/lib/bios_test.cpp
@@ -18,7 +18,7 @@ #include "http_request.hpp" #include "logging.hpp" #include "dbus_utility.hpp" -#include "snapshot_fixture.hpp" +#include "test/redfish-core/lib/snapshot_fixture.hpp" #include <nlohmann/json.hpp> #include "managed_store.hpp" #include "managed_store_types.hpp"
diff --git a/test/redfish-core/lib/boot_time_test.cpp b/test/redfish-core/lib/boot_time_test.cpp index 23b22ad..a950941 100644 --- a/test/redfish-core/lib/boot_time_test.cpp +++ b/test/redfish-core/lib/boot_time_test.cpp
@@ -19,7 +19,7 @@ #include "http_response.hpp" #include "async_resp.hpp" #include "boottime.hpp" -#include "snapshot_fixture.hpp" +#include "test/redfish-core/lib/snapshot_fixture.hpp" #include <nlohmann/json.hpp> namespace redfish::boottime {
diff --git a/test/redfish-core/lib/cable_test.cpp b/test/redfish-core/lib/cable_test.cpp index 9b3c56e..2c18fbc 100644 --- a/test/redfish-core/lib/cable_test.cpp +++ b/test/redfish-core/lib/cable_test.cpp
@@ -7,7 +7,7 @@ #include <gtest/gtest.h> #include "http_request.hpp" #include "utility.hpp" -#include "snapshot_fixture.hpp" +#include "test/redfish-core/lib/snapshot_fixture.hpp" #include <nlohmann/json.hpp> #include "managed_store.hpp" #include "test/g3/mock_managed_store_test.hpp"
diff --git a/test/redfish-core/lib/chassis_test.cpp b/test/redfish-core/lib/chassis_test.cpp index 9c4d1a1..12134bd 100644 --- a/test/redfish-core/lib/chassis_test.cpp +++ b/test/redfish-core/lib/chassis_test.cpp
@@ -14,7 +14,7 @@ #include "dbus_utility.hpp" // IWYU pragma: keep #include "subprocess_utils.hpp" #include "subprocess_utils_fake.hpp" -#include "snapshot_fixture.hpp" +#include "test/redfish-core/lib/snapshot_fixture.hpp" #include <nlohmann/json.hpp> #include "managed_store.hpp" #include "managed_store_types.hpp"
diff --git a/test/redfish-core/lib/component_integrity_test.cpp b/test/redfish-core/lib/component_integrity_test.cpp index cff3924..c495847 100644 --- a/test/redfish-core/lib/component_integrity_test.cpp +++ b/test/redfish-core/lib/component_integrity_test.cpp
@@ -8,7 +8,7 @@ #include <gmock/gmock.h> #include <gtest/gtest.h> #include "boost/beast/http/message.hpp" // NOLINT -#include "snapshot_fixture.hpp" +#include "test/redfish-core/lib/snapshot_fixture.hpp" #include <nlohmann/json.hpp> #include "managed_store.hpp" #include "test/g3/mock_managed_store_test.hpp"
diff --git a/test/redfish-core/lib/control_test.cpp b/test/redfish-core/lib/control_test.cpp index 3d7ab6c..1d36879 100644 --- a/test/redfish-core/lib/control_test.cpp +++ b/test/redfish-core/lib/control_test.cpp
@@ -11,7 +11,7 @@ #include "absl/strings/str_cat.h" #include "absl/strings/string_view.h" #include "dbus_utility.hpp" -#include "snapshot_fixture.hpp" +#include "test/redfish-core/lib/snapshot_fixture.hpp" #include <nlohmann/json.hpp> #include "managed_store.hpp" #include "managed_store_types.hpp"
diff --git a/test/redfish-core/lib/fan_test.cpp b/test/redfish-core/lib/fan_test.cpp index 71c5418..aee4e36 100644 --- a/test/redfish-core/lib/fan_test.cpp +++ b/test/redfish-core/lib/fan_test.cpp
@@ -12,7 +12,7 @@ #include "absl/status/status.h" #include "absl/strings/str_cat.h" #include "dbus_utility.hpp" -#include "snapshot_fixture.hpp" +#include "test/redfish-core/lib/snapshot_fixture.hpp" #include <nlohmann/json.hpp> #include "managed_store.hpp" #include "managed_store_types.hpp"
diff --git a/test/redfish-core/lib/health_test.cpp b/test/redfish-core/lib/health_test.cpp index 67bfd74..7726c4f 100644 --- a/test/redfish-core/lib/health_test.cpp +++ b/test/redfish-core/lib/health_test.cpp
@@ -8,7 +8,7 @@ #include <gtest/gtest.h> #include "http_response.hpp" #include "dbus_utility.hpp" -#include "snapshot_fixture.hpp" +#include "test/redfish-core/lib/snapshot_fixture.hpp" #include <nlohmann/json.hpp> #include "managed_store.hpp" #include "managed_store_types.hpp"
diff --git a/test/redfish-core/lib/log_services_eventlog_test.cpp b/test/redfish-core/lib/log_services_eventlog_test.cpp index 7f34912..ac172db 100644 --- a/test/redfish-core/lib/log_services_eventlog_test.cpp +++ b/test/redfish-core/lib/log_services_eventlog_test.cpp
@@ -6,7 +6,7 @@ #include "absl/functional/any_invocable.h" #include "dbus_utility.hpp" #include "log_services.hpp" -#include "snapshot_fixture.hpp" +#include "test/redfish-core/lib/snapshot_fixture.hpp" #include "managed_store.hpp" #include "test/g3/mock_managed_store.hpp"
diff --git a/test/redfish-core/lib/log_services_test.cpp b/test/redfish-core/lib/log_services_test.cpp index 2034ef5..79b9cc6 100644 --- a/test/redfish-core/lib/log_services_test.cpp +++ b/test/redfish-core/lib/log_services_test.cpp
@@ -29,7 +29,7 @@ #include "query.hpp" #include "registries/privilege_registry.hpp" #include "health.hpp" -#include "snapshot_fixture.hpp" +#include "test/redfish-core/lib/snapshot_fixture.hpp" #include <nlohmann/json.hpp> #include "managed_store.hpp" #include "managed_store_types.hpp"
diff --git a/test/redfish-core/lib/manager_diagnostic_data_test.cpp b/test/redfish-core/lib/manager_diagnostic_data_test.cpp index f6d0870..1164c03 100644 --- a/test/redfish-core/lib/manager_diagnostic_data_test.cpp +++ b/test/redfish-core/lib/manager_diagnostic_data_test.cpp
@@ -11,7 +11,7 @@ #include "http_response.hpp" #include "dbus_utility.hpp" #include "query.hpp" -#include "snapshot_fixture.hpp" +#include "test/redfish-core/lib/snapshot_fixture.hpp" #include <nlohmann/json.hpp> #include "managed_store.hpp" #include "managed_store_types.hpp"
diff --git a/test/redfish-core/lib/manager_test.cpp b/test/redfish-core/lib/manager_test.cpp index da3a399..66c037b 100644 --- a/test/redfish-core/lib/manager_test.cpp +++ b/test/redfish-core/lib/manager_test.cpp
@@ -14,7 +14,7 @@ #include "async_resp.hpp" #include "dbus_utility.hpp" #include "managers.hpp" -#include "snapshot_fixture.hpp" +#include "test/redfish-core/lib/snapshot_fixture.hpp" #include <nlohmann/json.hpp> #include "managed_store.hpp" #include "managed_store_types.hpp"
diff --git a/test/redfish-core/lib/network_adapter_test.cpp b/test/redfish-core/lib/network_adapter_test.cpp index 7b2fd67..e930d05 100644 --- a/test/redfish-core/lib/network_adapter_test.cpp +++ b/test/redfish-core/lib/network_adapter_test.cpp
@@ -7,7 +7,7 @@ #include <gtest/gtest.h> #include "http_response.hpp" #include "dbus_utility.hpp" -#include "snapshot_fixture.hpp" +#include "test/redfish-core/lib/snapshot_fixture.hpp" #include <nlohmann/json.hpp> #include "managed_store.hpp" #include "managed_store_types.hpp"
diff --git a/test/redfish-core/lib/nvme_features_test.cpp b/test/redfish-core/lib/nvme_features_test.cpp index 60e515e..065f9b2 100644 --- a/test/redfish-core/lib/nvme_features_test.cpp +++ b/test/redfish-core/lib/nvme_features_test.cpp
@@ -14,7 +14,7 @@ #include "http_request.hpp" #include "http_response.hpp" #include "dbus_utility.hpp" -#include "snapshot_fixture.hpp" +#include "test/redfish-core/lib/snapshot_fixture.hpp" #include <nlohmann/json_fwd.hpp> #include "managed_store.hpp" #include "managed_store_types.hpp"
diff --git a/test/redfish-core/lib/nvme_metric_test.cpp b/test/redfish-core/lib/nvme_metric_test.cpp index 3343052..528da09 100644 --- a/test/redfish-core/lib/nvme_metric_test.cpp +++ b/test/redfish-core/lib/nvme_metric_test.cpp
@@ -18,7 +18,7 @@ #include "dbus_utility.hpp" #include "nvme_metric_utils.hpp" #include "storage.hpp" -#include "snapshot_fixture.hpp" +#include "test/redfish-core/lib/snapshot_fixture.hpp" #include <nlohmann/json.hpp> #include "managed_store.hpp" #include "managed_store_types.hpp"
diff --git a/test/redfish-core/lib/pcie_slots_test.cpp b/test/redfish-core/lib/pcie_slots_test.cpp index 2f2b770..9b8ba5d 100644 --- a/test/redfish-core/lib/pcie_slots_test.cpp +++ b/test/redfish-core/lib/pcie_slots_test.cpp
@@ -11,7 +11,7 @@ #include "boost/beast/http/status.hpp" // NOLINT #include "http_response.hpp" #include "dbus_utility.hpp" -#include "snapshot_fixture.hpp" +#include "test/redfish-core/lib/snapshot_fixture.hpp" #include <nlohmann/json.hpp> #include "managed_store.hpp" #include "managed_store_types.hpp"
diff --git a/test/redfish-core/lib/pcie_test.cpp b/test/redfish-core/lib/pcie_test.cpp index f81dc85..c9d415a 100644 --- a/test/redfish-core/lib/pcie_test.cpp +++ b/test/redfish-core/lib/pcie_test.cpp
@@ -10,7 +10,7 @@ #include "boost/beast/http/status.hpp" // NOLINT #include "http_response.hpp" #include "dbus_utility.hpp" -#include "snapshot_fixture.hpp" +#include "test/redfish-core/lib/snapshot_fixture.hpp" #include <nlohmann/json.hpp> #include "managed_store.hpp" #include "managed_store_types.hpp"
diff --git a/test/redfish-core/lib/port_metrics_test.cpp b/test/redfish-core/lib/port_metrics_test.cpp index 7d9a3f5..0cad07e 100644 --- a/test/redfish-core/lib/port_metrics_test.cpp +++ b/test/redfish-core/lib/port_metrics_test.cpp
@@ -2,7 +2,7 @@ #include <gtest/gtest.h> #include "http_response.hpp" -#include "snapshot_fixture.hpp" +#include "test/redfish-core/lib/snapshot_fixture.hpp" #include <nlohmann/json.hpp> namespace redfish {
diff --git a/test/redfish-core/lib/ports_test.cpp b/test/redfish-core/lib/ports_test.cpp index 41792e0..24a0dea 100644 --- a/test/redfish-core/lib/ports_test.cpp +++ b/test/redfish-core/lib/ports_test.cpp
@@ -3,7 +3,7 @@ #include <gmock/gmock.h> #include <gtest/gtest.h> #include "http_response.hpp" -#include "snapshot_fixture.hpp" +#include "test/redfish-core/lib/snapshot_fixture.hpp" #include <nlohmann/json.hpp> namespace redfish {
diff --git a/test/redfish-core/lib/power_supply_metrics_test.cpp b/test/redfish-core/lib/power_supply_metrics_test.cpp index c3fe273..8ac5930 100644 --- a/test/redfish-core/lib/power_supply_metrics_test.cpp +++ b/test/redfish-core/lib/power_supply_metrics_test.cpp
@@ -5,7 +5,7 @@ #include <gtest/gtest.h> #include "boost/beast/http/status.hpp" // NOLINT -#include "snapshot_fixture.hpp" +#include "test/redfish-core/lib/snapshot_fixture.hpp" #include <nlohmann/json.hpp> #include "managed_store.hpp" #include "managed_store_types.hpp"
diff --git a/test/redfish-core/lib/power_supply_test.cpp b/test/redfish-core/lib/power_supply_test.cpp index 900615b..946bf8a 100644 --- a/test/redfish-core/lib/power_supply_test.cpp +++ b/test/redfish-core/lib/power_supply_test.cpp
@@ -8,7 +8,7 @@ #include <gtest/gtest.h> #include "utility.hpp" #include "async_resp.hpp" -#include "snapshot_fixture.hpp" +#include "test/redfish-core/lib/snapshot_fixture.hpp" #include <nlohmann/json.hpp> #include "test/g3/mock_managed_store_test.hpp"
diff --git a/test/redfish-core/lib/power_test.cpp b/test/redfish-core/lib/power_test.cpp index dd45b70..a5fa324 100644 --- a/test/redfish-core/lib/power_test.cpp +++ b/test/redfish-core/lib/power_test.cpp
@@ -8,7 +8,7 @@ #include <gtest/gtest.h> #include "boost/beast/http/status.hpp" // NOLINT #include "dbus_utility.hpp" -#include "snapshot_fixture.hpp" +#include "test/redfish-core/lib/snapshot_fixture.hpp" #include <nlohmann/json.hpp> #include "managed_store.hpp" #include "managed_store_types.hpp"
diff --git a/test/redfish-core/lib/processor_test.cpp b/test/redfish-core/lib/processor_test.cpp index 1dd74ab..dff7bcc 100644 --- a/test/redfish-core/lib/processor_test.cpp +++ b/test/redfish-core/lib/processor_test.cpp
@@ -10,7 +10,7 @@ #include "dbus_utility.hpp" #include "query.hpp" #include "external_storer.hpp" -#include "snapshot_fixture.hpp" +#include "test/redfish-core/lib/snapshot_fixture.hpp" #include <nlohmann/json.hpp> #include "managed_store.hpp" #include "managed_store_types.hpp"
diff --git a/test/redfish-core/lib/snapshot_fixture_test.cpp b/test/redfish-core/lib/snapshot_fixture_test.cpp index acf33a7..f190ab0 100644 --- a/test/redfish-core/lib/snapshot_fixture_test.cpp +++ b/test/redfish-core/lib/snapshot_fixture_test.cpp
@@ -1,4 +1,4 @@ -#include "snapshot_fixture.hpp" +#include "test/redfish-core/lib/snapshot_fixture.hpp" #include <gtest/gtest.h>
diff --git a/test/redfish-core/lib/storage_test.cpp b/test/redfish-core/lib/storage_test.cpp index fab09ee..e9c5f2c 100644 --- a/test/redfish-core/lib/storage_test.cpp +++ b/test/redfish-core/lib/storage_test.cpp
@@ -20,7 +20,7 @@ #include "async_resp.hpp" #include "dbus_utility.hpp" #include "storage_utils.hpp" -#include "snapshot_fixture.hpp" +#include "test/redfish-core/lib/snapshot_fixture.hpp" #include <nlohmann/json.hpp> #include "managed_store.hpp" #include "managed_store_types.hpp"
diff --git a/test/redfish-core/lib/system_multi_host_test.cpp b/test/redfish-core/lib/system_multi_host_test.cpp index 082f864..2422228 100644 --- a/test/redfish-core/lib/system_multi_host_test.cpp +++ b/test/redfish-core/lib/system_multi_host_test.cpp
@@ -11,7 +11,7 @@ #include "absl/status/statusor.h" #include "dbus_utility.hpp" #include "systems.hpp" -#include "snapshot_fixture.hpp" +#include "test/redfish-core/lib/snapshot_fixture.hpp" #include <nlohmann/json.hpp> #include "managed_store.hpp" #include "managed_store_types.hpp"
diff --git a/test/redfish-core/lib/system_test.cpp b/test/redfish-core/lib/system_test.cpp index 1aa4ead..fe61971 100644 --- a/test/redfish-core/lib/system_test.cpp +++ b/test/redfish-core/lib/system_test.cpp
@@ -25,7 +25,7 @@ #include "subprocess_utils.hpp" #include "subprocess_utils_fake.hpp" #include "systems.hpp" -#include "snapshot_fixture.hpp" +#include "test/redfish-core/lib/snapshot_fixture.hpp" #include <nlohmann/json.hpp> #include "tlbmc/hal/system_registry_mock.h" #include "managed_store.hpp"
diff --git a/test/redfish-core/lib/system_utils_test.cpp b/test/redfish-core/lib/system_utils_test.cpp index afff859..3ece9b7 100644 --- a/test/redfish-core/lib/system_utils_test.cpp +++ b/test/redfish-core/lib/system_utils_test.cpp
@@ -9,7 +9,7 @@ #include <gtest/gtest.h> #include "async_resp.hpp" #include "storage.hpp" -#include "snapshot_fixture.hpp" +#include "test/redfish-core/lib/snapshot_fixture.hpp" #include <nlohmann/json.hpp> // IWYU pragma: keep #include "managed_store.hpp" // IWYU pragma: keep #include "managed_store_types.hpp" // IWYU pragma: keep
diff --git a/test/redfish-core/lib/trusted_component_test.cpp b/test/redfish-core/lib/trusted_component_test.cpp index a2e0c19..101b07a 100644 --- a/test/redfish-core/lib/trusted_component_test.cpp +++ b/test/redfish-core/lib/trusted_component_test.cpp
@@ -11,7 +11,7 @@ #include "boost/beast/http/message.hpp" // NOLINT #include "boost/beast/http/status.hpp" #include "dbus_utility.hpp" -#include "snapshot_fixture.hpp" +#include "test/redfish-core/lib/snapshot_fixture.hpp" #include <nlohmann/json.hpp> #include "managed_store.hpp" #include "managed_store_types.hpp"
diff --git a/test/redfish-core/lib/update_service_test.cpp b/test/redfish-core/lib/update_service_test.cpp index b6f1916..d5373e4 100644 --- a/test/redfish-core/lib/update_service_test.cpp +++ b/test/redfish-core/lib/update_service_test.cpp
@@ -5,7 +5,7 @@ #include <gmock/gmock.h> #include <gtest/gtest.h> -#include "snapshot_fixture.hpp" +#include "test/redfish-core/lib/snapshot_fixture.hpp" #include <nlohmann/json.hpp> namespace redfish {