@@ -362,6 +362,30 @@ conditions: {
362362}
363363)" ;
364364
365+ /*
366+ * Templates for namespace updates.
367+ */
368+ const char * kRunningNamespaceUpdatePbTxt = R"(
369+ uid: "namespace_uid"
370+ name: "namespace1"
371+ start_timestamp_ns: 101
372+ stop_timestamp_ns: 0
373+ )" ;
374+
375+ const char * kTerminatingNamespaceUpdatePbTxt = R"(
376+ uid: "terminating_namespace_uid"
377+ name: "terminating_namespace1"
378+ start_timestamp_ns: 123
379+ stop_timestamp_ns: 0
380+ )" ;
381+
382+ const char * kTerminatedNamespaceUpdatePbTxt = R"(
383+ uid: "terminating_namespace_uid"
384+ name: "terminating_namespace1"
385+ start_timestamp_ns: 123
386+ stop_timestamp_ns: 150
387+ )" ;
388+
365389std::unique_ptr<px::shared::k8s::metadatapb::ResourceUpdate> CreateRunningPodUpdatePB () {
366390 auto update = std::make_unique<px::shared::k8s::metadatapb::ResourceUpdate>();
367391 auto update_proto = absl::Substitute (kResourceUpdateTmpl , " pod_update" , kRunningPodUpdatePbTxt );
@@ -530,6 +554,33 @@ std::unique_ptr<px::shared::k8s::metadatapb::ResourceUpdate> CreateTerminatedDep
530554 return update;
531555}
532556
557+ std::unique_ptr<px::shared::k8s::metadatapb::ResourceUpdate> CreateRunningNamespaceUpdatePB () {
558+ auto update = std::make_unique<px::shared::k8s::metadatapb::ResourceUpdate>();
559+ auto update_proto =
560+ absl::Substitute (kResourceUpdateTmpl , " namespace_update" , kRunningNamespaceUpdatePbTxt );
561+ CHECK (google::protobuf::TextFormat::MergeFromString (update_proto, update.get ()))
562+ << " Failed to parse proto" ;
563+ return update;
564+ }
565+
566+ std::unique_ptr<px::shared::k8s::metadatapb::ResourceUpdate> CreateTerminatingNamespaceUpdatePB () {
567+ auto update = std::make_unique<px::shared::k8s::metadatapb::ResourceUpdate>();
568+ auto update_proto =
569+ absl::Substitute (kResourceUpdateTmpl , " namespace_update" , kTerminatingNamespaceUpdatePbTxt );
570+ CHECK (google::protobuf::TextFormat::MergeFromString (update_proto, update.get ()))
571+ << " Failed to parse proto" ;
572+ return update;
573+ }
574+
575+ std::unique_ptr<px::shared::k8s::metadatapb::ResourceUpdate> CreateTerminatedNamespaceUpdatePB () {
576+ auto update = std::make_unique<px::shared::k8s::metadatapb::ResourceUpdate>();
577+ auto update_proto =
578+ absl::Substitute (kResourceUpdateTmpl , " namespace_update" , kTerminatedNamespaceUpdatePbTxt );
579+ CHECK (google::protobuf::TextFormat::MergeFromString (update_proto, update.get ()))
580+ << " Failed to parse proto" ;
581+ return update;
582+ }
583+
533584} // namespace testutils
534585} // namespace metadatapb
535586} // namespace px
0 commit comments