File tree Expand file tree Collapse file tree
lib/async/service/managed
test/async/service/managed Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ def health_check_timeout
3636 # @returns [Hash] The options for the container.
3737 def container_options
3838 {
39+ name : self . name ,
3940 restart : true ,
4041 count : self . count ,
4142 startup_timeout : self . startup_timeout ,
Original file line number Diff line number Diff line change 2323 it "provides default container options" do
2424 options = evaluator . container_options
2525
26+ expect ( options [ :name ] ) . to be == "test-managed"
2627 expect ( options [ :restart ] ) . to be == true
2728 expect ( options [ :count ] ) . to be == 3
2829 expect ( options [ :health_check_timeout ] ) . to be == 10
Original file line number Diff line number Diff line change 5757
5858 # Verify the container options were passed correctly
5959 expect ( options_captured ) . not . to be_nil
60+ expect ( options_captured [ :name ] ) . to be == "test-container"
6061 expect ( options_captured [ :count ] ) . to be == 2
6162 expect ( options_captured [ :health_check_timeout ] ) . to be == 5
6263 expect ( options_captured [ :restart ] ) . to be == true
6364 end
6465
66+ it "allows container options to override the process name" do
67+ configuration = Async ::Service ::Configuration . build do
68+ service "test-container" do
69+ service_class Async ::Service ::Managed ::Service
70+ include Async ::Service ::Managed ::Environment
71+
72+ container_options do
73+ super ( ) . merge ( name : "custom-process-name" )
74+ end
75+ end
76+ end
77+
78+ service = configuration . services . first
79+ container = Async ::Container . new
80+ options_captured = nil
81+
82+ mock ( container ) do |mock |
83+ mock . replace ( :run ) do |**options , &block |
84+ options_captured = options
85+ nil
86+ end
87+ end
88+
89+ service . setup ( container )
90+
91+ expect ( options_captured [ :name ] ) . to be == "custom-process-name"
92+ end
93+
6594 with "integration test" do
6695 include Sus ::Fixtures ::Async ::SchedulerContext
6796
You can’t perform that action at this time.
0 commit comments