Class: MockServer::LoadProfile
- Inherits:
-
Object
- Object
- MockServer::LoadProfile
- Defined in:
- lib/mockserver/models.rb
Overview
The traffic-shaping profile of a load scenario: EITHER an ordered list of LoadStage objects run in sequence, each holding or ramping a setpoint (virtual users, an arrival rate, or a pause) for its duration, OR a single named LoadShape that expands into stages. Set one, not both; if both are set the explicit stages win. The total run length is the sum of the stage durations.
Instance Attribute Summary collapse
-
#shape ⇒ Object
Returns the value of attribute shape.
-
#stages ⇒ Object
Returns the value of attribute stages.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(stages: nil, shape: nil) ⇒ LoadProfile
constructor
A new instance of LoadProfile.
- #to_h ⇒ Object
Constructor Details
#initialize(stages: nil, shape: nil) ⇒ LoadProfile
Returns a new instance of LoadProfile.
2961 2962 2963 2964 |
# File 'lib/mockserver/models.rb', line 2961 def initialize(stages: nil, shape: nil) @stages = stages @shape = shape end |
Instance Attribute Details
#shape ⇒ Object
Returns the value of attribute shape.
2959 2960 2961 |
# File 'lib/mockserver/models.rb', line 2959 def shape @shape end |
#stages ⇒ Object
Returns the value of attribute stages.
2959 2960 2961 |
# File 'lib/mockserver/models.rb', line 2959 def stages @stages end |
Class Method Details
.from_hash(data) ⇒ Object
2973 2974 2975 2976 2977 2978 2979 2980 2981 |
# File 'lib/mockserver/models.rb', line 2973 def self.from_hash(data) return nil if data.nil? stages_data = data['stages'] new( stages: stages_data ? stages_data.map { |s| LoadStage.from_hash(s) } : nil, shape: LoadShape.from_hash(data['shape']) ) end |
Instance Method Details
#to_h ⇒ Object
2966 2967 2968 2969 2970 2971 |
# File 'lib/mockserver/models.rb', line 2966 def to_h MockServer.strip_none({ 'stages' => @stages.nil? ? nil : @stages.map(&:to_h), 'shape' => @shape&.to_h }) end |